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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    height: 100vh;
}

.screen.active {
    display: block;
}

/* Аутентификация */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.auth-container h1 {
    color: #4f46e5;
    margin-bottom: 2rem;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form input {
    width: 100%;
    padding: 12px 16px;
    margin: 10px 0;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #4f46e5;
}

.auth-form button {
    width: 100%;
    padding: 14px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.auth-form button:hover {
    background: #4338ca;
}

.auth-switch {
    margin-top: 20px;
    color: #6b7280;
}

.auth-switch a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
}

/* Основной экран */
.header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #4f46e5;
}

/* Сетка чата */
.chat-screen {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100vh;
    padding-top: 70px;
}

.contacts-sidebar {
    background: white;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
}

.contacts-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.contacts-header input {
    width: 100%;
    padding: 10px 12px;
    margin-top: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.contact-item {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.3s;
}

.contact-item:hover {
    background: #f9fafb;
}

.contact-item.active {
    background: #eef2ff;
    border-left: 4px solid #4f46e5;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.contact-info h4 {
    color: #111827;
    font-size: 14px;
}

.contact-info p {
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
}

/* Контейнер сообщений */
.chat-container {
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

.chat-header {
    background: white;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.messages-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message.sent {
    background: #4f46e5;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.received {
    background: white;
    color: #111827;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.media-attachment {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 8px;
    cursor: pointer;
}

/* Ввод сообщений */
.message-input {
    background: white;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
}

.message-input input:focus {
    border-color: #4f46e5;
}

.btn-send {
    background: #4f46e5;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-send:hover {
    background: #4338ca;
}

/* Модальное окно камеры */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#camera-view {
    width: 100%;
    height: 400px;
    background: #000;
    object-fit: cover;
}

.camera-controls {
    padding: 1.5rem;
    text-align: center;
}

.btn-primary {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .chat-screen {
        grid-template-columns: 1fr;
    }
    
    .contacts-sidebar {
        position: fixed;
        left: -100%;
        top: 70px;
        bottom: 0;
        width: 100%;
        transition: left 0.3s;
        z-index: 50;
    }
    
    .contacts-sidebar.active {
        left: 0;
    }
    
    .auth-container {
        margin: 20px;
        padding: 1.5rem;
    }
    
    .message {
        max-width: 85%;
    }
}

/* Анимации */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease;
}
/* Добавьте в styles.css */

/* Статусы пользователей */
.status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-online {
    background-color: #10b981;
}

.status-offline {
    background-color: #9ca3af;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(150%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.notification.show {
    transform: translateX(0);
}

.notification-info {
    background-color: #3b82f6;
}

.notification-success {
    background-color: #10b981;
}

.notification-warning {
    background-color: #f59e0b;
}

.notification-error {
    background-color: #ef4444;
}

/* Загрузка */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Адаптивные улучшения */
@media (max-width: 480px) {
    .auth-container {
        margin: 20px;
        padding: 1.5rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .message-input {
        padding: 0.75rem;
    }
    
    .message-input input {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Темная тема (опционально) */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    }
    
    .auth-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .chat-container {
        background: #111827;
    }
    
    .contacts-sidebar {
        background: #1f2937;
        border-right-color: #374151;
    }
}