/* ============================================================
   MOROZ-OFF — 3D Glassmorphism Design System
   Палитра: глубокий космический синий + ледяной циан + серебро
   ============================================================ */

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

:root {
    /* Основные цвета */
    --ice:        #00d4ff;
    --ice-dark:   #0099cc;
    --ice-glow:   rgba(0, 212, 255, 0.35);
    --frost:      #a8edff;
    --navy:       #0a0e1a;
    --navy-mid:   #0f1628;
    --navy-light: #1a2340;
    --silver:     #c8d8e8;
    --white:      #ffffff;

    /* Семантика */
    --success:    #00e676;
    --danger:     #ff4757;
    --warning:    #ffa502;
    --gray:       #7a8fa6;

    /* Стекло (glassmorphism) */
    --glass:      rgba(255, 255, 255, 0.06);
    --glass-mid:  rgba(255, 255, 255, 0.10);
    --glass-high: rgba(255, 255, 255, 0.16);
    --glass-border: rgba(0, 212, 255, 0.25);

    /* 3D-тени */
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,212,255,0.08);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,212,255,0.12);
    --shadow-lg:  0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(0,212,255,0.08);
    --shadow-glow:0 0 20px rgba(0,212,255,0.4), 0 0 60px rgba(0,212,255,0.15);

    /* Радиусы */
    --r-sm: 12px;
    --r-md: 18px;
    --r-lg: 24px;
    --r-xl: 32px;

    /* Переходы */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Фон и тело ─────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--navy);
    min-height: 100vh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    color: var(--white);
}

/* Анимированный градиентный фон */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0,212,255,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(0,80,160,0.18) 0%, transparent 60%),
        linear-gradient(160deg, #0a0e1a 0%, #0d1530 50%, #0a1020 100%);
    z-index: 0;
    pointer-events: none;
}

/* ── Снежинки-частицы ───────────────────────────────────── */
.particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    top: -30px;
    color: var(--ice);
    animation: snowfall linear infinite;
    user-select: none;
}

@keyframes snowfall {
    0%   { transform: translateY(-30px) rotate(0deg);   opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 0.6; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* ── Экран входа ─────────────────────────────────────────── */
.login-screen {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    position: relative;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    padding: 44px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.1);
    animation: slideUp 0.6s var(--ease);
    /* Эффект объёма: верхняя грань светлее */
    background-image: linear-gradient(
        160deg,
        rgba(255,255,255,0.10) 0%,
        rgba(255,255,255,0.02) 100%
    );
}

/* Блик на верхнем крае карточки */
.login-container::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,212,255,0.6), transparent);
    border-radius: 50%;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Логотип */
.logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,212,255,0.2), rgba(0,80,160,0.3));
    border: 1px solid rgba(0,212,255,0.4);
    box-shadow: 0 0 30px rgba(0,212,255,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    margin: 0 auto 20px;
    animation: floatLogo 3s ease-in-out infinite;
}

.logo-3d {
    font-size: 44px;
    filter: drop-shadow(0 0 12px rgba(0,212,255,0.8));
    animation: spinSlow 8s linear infinite;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.logo h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--white) 30%, var(--ice) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.logo p {
    color: var(--gray);
    font-size: 15px;
}

/* Форма входа */
.login-form { margin-bottom: 28px; }

.input-group {
    position: relative;
    margin-bottom: 14px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    z-index: 1;
}

.input-group input {
    width: 100%;
    padding: 15px 16px 15px 48px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: var(--r-sm);
    font-size: 15px;
    color: var(--white);
    outline: none;
    transition: all 0.3s var(--ease);
    /* Объёмный инпут: внутренняя тень сверху */
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

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

.input-group input:focus {
    border-color: var(--ice);
    background: rgba(0,212,255,0.08);
    box-shadow:
        inset 0 2px 6px rgba(0,0,0,0.3),
        0 0 0 3px rgba(0,212,255,0.15),
        0 0 20px rgba(0,212,255,0.1);
}

/* Кнопка входа */
.btn-primary {
    position: relative;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #0099cc 0%, #00d4ff 50%, #0099cc 100%);
    background-size: 200% 100%;
    color: var(--white);
    border: none;
    border-radius: var(--r-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s var(--ease);
    box-shadow:
        0 4px 15px rgba(0,212,255,0.4),
        0 1px 0 rgba(255,255,255,0.2) inset,
        0 -2px 0 rgba(0,0,0,0.2) inset;
    letter-spacing: 0.3px;
}

.btn-primary:hover {
    background-position: 100% 0;
    box-shadow: 0 6px 25px rgba(0,212,255,0.55), 0 1px 0 rgba(255,255,255,0.2) inset;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 2px 8px rgba(0,212,255,0.3);
}

/* Блик на кнопке */
.btn-glow {
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
    animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
    0%   { left: -100%; }
    40%  { left: 150%; }
    100% { left: 150%; }
}

/* Фичи */
.login-features {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.feature {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(0,212,255,0.12);
    border-radius: var(--r-sm);
    font-size: 11px;
    color: var(--gray);
    transition: all 0.2s;
}

.feature:hover {
    background: rgba(0,212,255,0.08);
    border-color: rgba(0,212,255,0.3);
    color: var(--ice);
}

/* ── Основной контейнер приложения ──────────────────────── */
.app-container {
    position: relative;
    z-index: 10;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Шапка ───────────────────────────────────────────────── */
.app-header {
    background: rgba(10,14,26,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,212,255,0.18);
    color: var(--white);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 0 0 var(--ice-glow);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    font-size: 26px;
    filter: drop-shadow(0 0 8px rgba(0,212,255,0.7));
    animation: floatLogo 3s ease-in-out infinite;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--white) 30%, var(--ice) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,212,255,0.1);
    border: 1px solid rgba(0,212,255,0.25);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--frost);
}

.online-dot {
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
    50%       { opacity: 0.5; box-shadow: 0 0 12px var(--success); }
}

.icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(0,212,255,0.2);
    background: rgba(0,212,255,0.08);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}

.icon-btn:hover {
    background: rgba(0,212,255,0.18);
    border-color: rgba(0,212,255,0.5);
    box-shadow: 0 0 15px rgba(0,212,255,0.3);
    transform: translateY(-1px);
}

.icon-btn:active { transform: scale(0.92); }

/* ── Панель участников ───────────────────────────────────── */
.users-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: rgba(10,14,26,0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(0,212,255,0.2);
    box-shadow: -8px 0 40px rgba(0,0,0,0.5);
    z-index: 200;
    transition: right 0.35s var(--ease);
}

.users-panel.active { right: 0; }

.panel-header {
    padding: 20px;
    background: rgba(0,212,255,0.06);
    border-bottom: 1px solid rgba(0,212,255,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--ice);
}

.close-panel {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--gray);
    font-size: 16px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-panel:hover { color: var(--white); background: rgba(255,71,87,0.2); border-color: var(--danger); }

.users-list {
    padding: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--r-sm);
    margin-bottom: 6px;
    transition: all 0.2s var(--ease);
    cursor: pointer;
    border: 1px solid transparent;
}

.user-item:hover {
    background: rgba(0,212,255,0.07);
    border-color: rgba(0,212,255,0.15);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,153,204,0.5), rgba(0,212,255,0.3));
    border: 1px solid rgba(0,212,255,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(0,212,255,0.2);
}

.user-info h4 { font-size: 14px; color: var(--white); margin-bottom: 2px; }
.user-info p  { font-size: 11px; color: var(--success); }

.user-actions { display: flex; gap: 6px; margin-left: auto; }

.user-actions button {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: 50%;
    background: rgba(0,212,255,0.06);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-actions button:hover {
    background: rgba(0,212,255,0.18);
    border-color: var(--ice);
    box-shadow: 0 0 10px rgba(0,212,255,0.3);
}

.users-placeholder {
    padding: 24px 8px;
    text-align: center;
    color: var(--gray);
    font-size: 13px;
}

/* ── Область чата ────────────────────────────────────────── */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* Кастомный скроллбар */
.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb {
    background: rgba(0,212,255,0.25);
    border-radius: 2px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.welcome-icon {
    font-size: 72px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(0,212,255,0.5));
    animation: floatLogo 3s ease-in-out infinite;
}

.welcome-message h2 {
    font-size: 22px;
    color: var(--white);
    margin-bottom: 8px;
    font-weight: 700;
}

.welcome-message p { font-size: 14px; }

/* ── Сообщения ───────────────────────────────────────────── */
.message {
    max-width: 82%;
    padding: 11px 16px;
    border-radius: 18px;
    animation: msgPop 0.3s var(--ease);
    position: relative;
    word-wrap: break-word;
}

@keyframes msgPop {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Своё сообщение — справа, ледяной градиент */
.message.own {
    align-self: flex-end;
    background: linear-gradient(135deg, #0077aa 0%, #00b8d9 100%);
    color: var(--white);
    border-bottom-right-radius: 4px;
    box-shadow:
        0 4px 16px rgba(0,184,217,0.35),
        inset 0 1px 0 rgba(255,255,255,0.2),
        inset 0 -1px 0 rgba(0,0,0,0.15);
}

/* Чужое сообщение — слева, стеклянное */
.message.other {
    align-self: flex-start;
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--white);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0,212,255,0.15);
    box-shadow:
        0 4px 16px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.08);
}

/* Системное сообщение */
.message.system {
    align-self: center;
    max-width: 90%;
    background: rgba(0,212,255,0.06);
    border: 1px solid rgba(0,212,255,0.12);
    color: var(--gray);
    font-size: 12px;
    font-style: italic;
    text-align: center;
    padding: 5px 14px;
    border-radius: 999px;
    box-shadow: none;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 8px;
}

.message-sender { font-size: 11px; font-weight: 600; opacity: 0.75; }
.message-time   { font-size: 10px; opacity: 0.5; white-space: nowrap; }
.message-text   { font-size: 14px; line-height: 1.45; }

.message-image {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    margin-top: 8px;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.08);
}

.message-file-icon { font-size: 22px; }

/* Голосовое сообщение */
.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.play-btn:hover { background: rgba(255,255,255,0.25); }

.voice-wave {
    flex: 1;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.wave-bar {
    width: 3px;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.7;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 8px;  animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 18px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 13px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 22px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 10px; animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50%       { transform: scaleY(1); }
}

.voice-duration { font-size: 11px; opacity: 0.7; min-width: 28px; }

/* ── Поле ввода ──────────────────────────────────────────── */
.input-area {
    background: rgba(10,14,26,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,212,255,0.15);
    padding: 12px 14px;
    flex-shrink: 0;
}

.media-preview {
    position: relative;
    margin-bottom: 10px;
}

.media-preview img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid rgba(0,212,255,0.2);
}

.remove-preview {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,71,87,0.8);
    border: none;
    color: var(--white);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(0,212,255,0.18);
    background: rgba(0,212,255,0.06);
    border-radius: 50%;
    font-size: 17px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

.action-btn:hover {
    background: rgba(0,212,255,0.16);
    border-color: rgba(0,212,255,0.45);
    box-shadow: 0 0 12px rgba(0,212,255,0.25);
    transform: translateY(-1px);
}

.action-btn:active { transform: scale(0.9); }

.typing-indicator {
    font-size: 12px;
    color: var(--ice);
    padding: 0 4px;
    font-style: italic;
    opacity: 0.8;
}

.message-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-input-row input {
    flex: 1;
    padding: 13px 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: 24px;
    font-size: 14px;
    color: var(--white);
    outline: none;
    transition: all 0.3s var(--ease);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

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

.message-input-row input:focus {
    border-color: var(--ice);
    background: rgba(0,212,255,0.07);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), 0 0 0 3px rgba(0,212,255,0.12);
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0099cc, #00d4ff);
    border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        0 4px 15px rgba(0,212,255,0.4),
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -2px 0 rgba(0,0,0,0.15);
}

.send-btn:hover {
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 6px 22px rgba(0,212,255,0.55);
}

.send-btn:active { transform: scale(0.94); }

/* ── Запись голоса ───────────────────────────────────────── */
.recording-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,14,26,0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,71,87,0.4);
    border-radius: var(--r-lg);
    padding: 36px 40px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255,71,87,0.2), var(--shadow-lg);
    animation: msgPop 0.3s var(--ease);
}

.recording-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 50px;
    margin-bottom: 16px;
}

.recording-animation .wave-bar {
    background: var(--danger);
    animation: recordingWave 0.8s ease-in-out infinite;
}

.recording-animation .wave-bar:nth-child(1) { height: 12px; animation-delay: 0s; }
.recording-animation .wave-bar:nth-child(2) { height: 28px; animation-delay: 0.1s; }
.recording-animation .wave-bar:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.recording-animation .wave-bar:nth-child(4) { height: 32px; animation-delay: 0.3s; }
.recording-animation .wave-bar:nth-child(5) { height: 16px; animation-delay: 0.4s; }

@keyframes recordingWave {
    0%, 100% { transform: scaleY(0.5); }
    50%       { transform: scaleY(1.3); }
}

.recording-time {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 20px;
    font-variant-numeric: tabular-nums;
}

.stop-btn {
    padding: 11px 28px;
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,71,87,0.4);
    transition: all 0.2s;
}

.stop-btn:hover { box-shadow: 0 6px 22px rgba(255,71,87,0.55); transform: translateY(-1px); }

/* ── Экран звонка ────────────────────────────────────────── */
.call-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #060a14 0%, #0a1428 50%, #060e1c 100%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.call-content { text-align: center; color: var(--white); width: 100%; }

.caller-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,153,204,0.4), rgba(0,212,255,0.25));
    border: 2px solid rgba(0,212,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    margin: 0 auto 24px;
    animation: callPulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(0,212,255,0.5);
}

@keyframes callPulse {
    0%   { box-shadow: 0 0 0 0   rgba(0,212,255,0.5); }
    70%  { box-shadow: 0 0 0 24px rgba(0,212,255,0); }
    100% { box-shadow: 0 0 0 0   rgba(0,212,255,0); }
}

.caller-info h2 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.caller-info p  { font-size: 15px; opacity: 0.65; margin-bottom: 40px; }

.call-timer {
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    margin-top: -28px;
    margin-bottom: 32px;
    opacity: 0.85;
    color: var(--ice);
}

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

.call-control-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.1);
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.call-control-btn:hover  { transform: scale(1.08); background: rgba(255,255,255,0.18); }
.call-control-btn:active { transform: scale(0.92); }
.call-control-btn.active { background: var(--warning); border-color: var(--warning); }
.end-call-btn { background: var(--danger); border-color: var(--danger); box-shadow: 0 4px 16px rgba(255,71,87,0.4); }
.end-call-btn:hover { box-shadow: 0 6px 24px rgba(255,71,87,0.6); }
.call-control-btn.accept { background: var(--success); border-color: var(--success); box-shadow: 0 4px 16px rgba(0,230,118,0.4); }
.call-control-btn.reject { background: var(--danger);  border-color: var(--danger);  box-shadow: 0 4px 16px rgba(255,71,87,0.4); }

/* Видео */
.video-container {
    position: fixed;
    inset: 0;
    background: var(--navy);
    z-index: 250;
}

.video-container video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

.video-container #localVideo {
    position: absolute;
    bottom: 100px; right: 16px;
    width: 110px; height: 150px;
    border-radius: 14px;
    border: 2px solid rgba(0,212,255,0.4);
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#remoteAudio { display: none; }

/* ── Входящий звонок ─────────────────────────────────────── */
.incoming-call {
    position: fixed;
    inset: 0;
    background: rgba(6,10,20,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.incoming-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(0,212,255,0.25);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0,212,255,0.1);
    padding: 36px 32px;
    text-align: center;
    width: 100%;
    max-width: 320px;
    animation: msgPop 0.25s var(--ease);
}

.incoming-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,153,204,0.4), rgba(0,212,255,0.25));
    border: 2px solid rgba(0,212,255,0.4);
    color: var(--white);
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: callPulse 1.6s infinite;
}

.incoming-card h3 { font-size: 20px; color: var(--white); margin-bottom: 4px; font-weight: 700; }
.incoming-card p  { color: var(--gray); font-size: 13px; margin-bottom: 24px; }

.incoming-actions { display: flex; justify-content: center; gap: 32px; }

/* ── Диалог выбора собеседника ───────────────────────────── */
.call-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10,14,26,0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0,212,255,0.25);
    padding: 28px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 250;
    min-width: 280px;
    animation: msgPop 0.25s var(--ease);
}

.call-dialog h3 { margin-bottom: 16px; text-align: center; color: var(--ice); font-size: 16px; }

.call-users-list { max-height: 280px; overflow-y: auto; }

.call-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.call-user-item:hover {
    background: rgba(0,212,255,0.08);
    border-color: rgba(0,212,255,0.2);
}

/* ── Оверлей (закрытие панели) ───────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 150;
    display: none;
}

.overlay.active { display: block; }

/* ── Адаптив ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .login-container { padding: 32px 22px; }
    .message { max-width: 90%; }
    .app-header h1 { font-size: 17px; }
}

/* ── Скроллбар глобальный ────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 2px; }
