* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Main container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn, button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover, button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Profile */
.profile-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.photo-section {
    text-align: center;
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #667eea;
    margin-bottom: 1rem;
}

.info-section {
    flex: 1;
}

/* Search */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.search-results {
    display: grid;
    gap: 1rem;
}

.user-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h4 {
    color: #333;
    margin-bottom: 0.5rem;
}

.user-info p {
    color: #666;
    margin-bottom: 0.5rem;
}

/* Messages */
.messages-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.chats-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem;
}

.chat-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.3s;
}

.chat-item:hover {
    background-color: #f8f9fa;
}

.chat-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-info h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.chat-info p {
    color: #666;
    font-size: 0.9rem;
}

.time {
    color: #999;
    font-size: 0.8rem;
}

/* Chat */
.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 600px;
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.message {
    max-width: 70%;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    position: relative;
}

.my-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
}

.companion-message {
    background: #f1f3f4;
    color: #333;
}

.message-input {
    padding: 1rem;
    border-top: 1px solid #eee;
}

.message-input form {
    display: flex;
    gap: 1rem;
}

.message-input input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 25px;
}

/* Image preview */
.image-preview {
    margin-top: 1rem;
    text-align: center;
}

.image-preview img {
    max-width: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .messages-container {
        grid-template-columns: 1fr;
    }
    
    .message {
        max-width: 90%;
    }
    
    nav {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Стиль для ссылок чатов */
.chat-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.chat-link:hover .chat-item {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Стили для ошибок */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #f44336;
}

.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #4caf50;
}