:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --primary: #6c63ff;
    --primary-hover: #5a52d5;
    --text: #ffffff;
    --text-secondary: #b0b0b0;
    --gray: #666666;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hidden {
    display: none !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Карточки */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Секция авторизации */
.auth-section {
    width: 100%;
    max-width: 400px;
}

.tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 24px;
}

.tab-button {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-button.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--gray);
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.2);
}

.input-wrapper input::placeholder {
    color: var(--gray);
}

/* Кнопки */
button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--gray);
}

/* Сообщения */
.message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Основная секция */
.main-section {
    width: 100%;
    max-width: 1000px;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.welcome-text {
    font-size: 1.5rem;
    font-weight: 600;
}

.welcome-text span {
    color: var(--primary);
}

/* Поиск */
.search-section {
    margin-bottom: 24px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* Вкладки основной секции */
.tab-buttons {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 24px;
    position: relative;
}

.requests-badge {
    background: var(--error);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    margin-left: 8px;
}

/* Списки */
#friendsList, #conversationsList, #friendRequests, #searchResults {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.user-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.user-avatar.large {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.user-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 12px;
}

.btn-icon:hover {
    background: var(--primary);
}

/* Сообщения */
.messages-container {
    display: flex;
    height: 500px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.conversations-list {
    width: 300px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray);
}

.empty-chat i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Звонки */
.call-modal {
    text-align: center;
}

.call-header {
    margin-bottom: 24px;
}

.call-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

.caller-info {
    margin-bottom: 32px;
}

.call-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn-call {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.accept-call {
    background: var(--success);
}

.decline-call {
    background: var(--error);
}

/* Активный звонок */
.active-call {
    max-width: 800px;
    width: 95%;
}

.video-container {
    position: relative;
    margin-bottom: 24px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-video-pip {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 120px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--primary);
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.call-control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.end-call {
    background: var(--error);
}

/* Минимизированный звонок */
.minimized-call {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 200px;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.minimized-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    font-size: 12px;
}

.minimized-header button {
    padding: 4px;
    background: transparent;
    font-size: 10px;
}

.minimized-video {
    width: 100%;
    height: 120px;
}

#minimizedRemoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.card {
    animation: fadeIn 0.5s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .messages-container {
        flex-direction: column;
        height: 600px;
    }
    
    .conversations-list {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .user-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .active-call {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .video-wrapper {
        height: 300px;
    }
}