
        .download-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    opacity: 0.7;
    transition: all 0.2s;
}

.message.sent .download-btn {
    color: rgba(255,255,255,0.85);
}

.download-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}
      /* ===================== СПИСОК ПРЕПОДАВАТЕЛЕЙ ===================== */
.teachers-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}


.teacher-card {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 14px 20px !important;
    margin: 2px 8px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background 0.15s ease !important;
    border-bottom: 1px solid #f1f3f5 !important;
    background: transparent !important;
}

.teacher-card:last-child {
    border-bottom: none !important;
}

.teacher-card:hover {
    background: #f8fafc !important;
    transform: none !important;
}

.teacher-card.active {
    background: #e3f2fd !important;
}

/* Аватар */
.teacher-avatar {
    position: relative !important;
    flex-shrink: 0 !important;
}

.teacher-avatar img,
.teacher-avatar div {
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}
        .teacher-avatar {
            position: relative;
        }

        .teacher-avatar img {
            width: 78px;
            height: 78px;
            border-radius: 50%;
            object-fit: cover;
        }

        .online-status {
            position: absolute;
            bottom: 6px;
            right: 6px;
            width: 20px;
            height: 20px;
            background: #10b981;
            border: 3px solid white;
            border-radius: 50%;
        }

        .teacher-info h3 {
            margin: 0 0 6px 0;
        }

        .subjects {
            color: var(--primary);
            font-weight: 500;
            margin-bottom: 8px;
        }

        .teacher-meta {
            display: flex;
            gap: 16px;
            color: #64748b;
            font-size: 0.92rem;
        }

        /* Модальное окно чата */
        .chat-modal {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.65);
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .chat-modal-content {
            background: white;
            width: 100%;
            max-width: 520px;
            height: 640px;
            border-radius: 24px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            overflow: hidden;
        }

        .chat-modal-header {
            padding: 20px 24px;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .close-modal-btn {
            background: none;
            border: none;
            font-size: 1.8rem;
            cursor: pointer;
            color: #64748b;
        }

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    position: relative;
    padding: 10px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    min-height: 64px;
}

        .chat-input-area input {
            flex: 1;
            padding: 14px 20px;
            border: 1px solid #e5e7eb;
            border-radius: 50px;
            outline: none;
            font-size: 1rem;
        }

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


            /* === СТАТУС СООБЩЕНИЙ (Telegram-style) === */
.message .message-status {
    font-size: 1.05rem;
    margin-left: 6px;
    color: #94a3b8;
    display: inline-block;
    line-height: 1;
}

.message.sent .message-status {
    opacity: 0.9;
}

.message.sent .message-status.read {
    color: #60a5fa;
}

/* Одинарная галочка */
.message.sent .message-status:not(.read)::after {
    content: "✓";
    font-size: 1.2rem;
}

/* Двойная галочка (компактно) */
.message.sent .message-status.read::after {
    content: "✓✓";
    font-size: 1.18rem;
    letter-spacing: -3px;     /* главное отличие от обычного */
    margin-left: 2px;
}

/* ===================== ЧАТ — ФОН ===================== */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background-color: #f8fafc;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;                    /* важно */
}
/* === СТИЛЬ ДЛЯ ЦИТАТЫ (РЕПЛАЙ) === */
.reply-to-message {
    background: rgba(100, 116, 139, 0.07);
    border-left: 3px solid #64748b;
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
}

.reply-to-message:hover {
    background: rgba(100, 116, 139, 0.11);
    border-left-color: #60a5fa;
}

/* === ПОДСВЕТКА КАК В TELEGRAM (только края) === */
.message.highlight {
    position: relative;
    animation: telegramPulse 2.3s ease forwards;
}

.message.highlight::after {
    content: '';
    position: absolute;
    inset: -5px;
    border: 2.5px solid rgba(59, 130, 246, 0.55);
    border-radius: 16px;
    opacity: 0;
    animation: telegramBorderPulse 2.3s ease forwards;
    pointer-events: none;
    z-index: -1;
}

@keyframes telegramPulse {
    0%   { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4); }
    15%  { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.25); }
    40%  { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes telegramBorderPulse {
    0%   { opacity: 0.6; transform: scale(0.95); }
    25%  { opacity: 0.45; }
    70%  { opacity: 0.15; }
    100% { opacity: 0; transform: scale(1.06); }
}

/* Для расширенного режима */
.chat-modal-content.expanded .chat-messages {
    background-size: 1600px auto;    /* можно сделать чуть больше */
}

.chat-messages .message {
    z-index: 2;
    position: relative;
}

/* ===================== РАСШИРЕННЫЙ РЕЖИМ ===================== */
.chat-modal-content.expanded .chat-messages {
    background-size: 75% auto;           /* ← Здесь подбирай размер */
    background-position: center;
}

.message {
    max-width: 75%;
    padding: 10px 14px 6px 14px;
    border-radius: 18px;
    line-height: 1.45;
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.message.received {
    align-self: flex-start;
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* === СТАТУС СООБЩЕНИЙ (Telegram-style) === */
.message-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 0.78rem;
    margin-top: 2px;
    opacity: 0.9;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.92);
}

/* Галочки */
.message-status {
    font-size: 1.22rem;
    line-height: 1;
    margin-left: 4px;
}

/* Одинарная галочка (не прочитано) */
.message.sent .message-status::after {
    content: "✓";
    color: rgba(255, 255, 255, 0.85);
}

/* Двойная галочка (прочитано) — синяя */
.message.sent .message-status.read::after {
    content: "✓✓";
    letter-spacing: -3.8px;
    color: #60a5fa;           /* красивый синий цвет */
}

/* Реакции под сообщением */
.message-reactions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.message-reaction {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.message.sent .message-reaction {
    background: rgba(255,255,255,0.25);
}

/* === Обновлённые стили для контекстного меню эмодзи === */
.context-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    padding: 12px;
    z-index: 10000;
    display: none;
    user-select: none;
    width: 340px;
    min-width: 340px;
}

.emoji-menu-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.emoji-row {
    display: flex;
    gap: 5px;
    flex: 1;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.context-menu button {
    background: none;
    border: none;
    font-size: 1.42rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.context-menu button:hover {
    background: #f1f5f9;
    transform: scale(1.22);
}

.toggle-emoji-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 10px;
}

.toggle-emoji-btn:hover {
    color: #3b82f6;
    background: #f8fafc;
}

/* Ссылка внизу */
.unlock-emoji-link {
    display: block;
    text-align: center;
    padding: 8px 12px;
    color: #3b82f6;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.unlock-emoji-link:hover {
    background: #f0f9ff;
    color: #2563eb;
}

/* Добавь эти стили в <style> */
    .emoji-menu-header {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-bottom: 8px;
    }

    .emoji-row {
        display: flex;
        gap: 4px;
    }

    .emoji-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }

    .context-menu button {
        background: none;
        border: none;
        font-size: 1.35rem;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .context-menu button:hover {
        background: #f1f5f9;
        transform: scale(1.25);
    }

    .toggle-emoji-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #64748b;
        cursor: pointer;
        flex-shrink: 0;
    }

    .toggle-emoji-btn:hover {
        color: #3b82f6;
        background: #f1f5f9;
        border-radius: 10px;
    }

    /* Расширение чата */
.chat-modal-content {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 520px;
    width: 100%;
    height: 640px;
}

.chat-modal-content.expanded {
    max-width: 92%;
    height: 88vh;
    max-height: 88vh;
}

/* Кнопка расширения */
.expand-chat-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.expand-chat-btn:hover {
    color: #3b82f6;
    background: #f1f5f9;
}



.chat-messages > * {
    z-index: 2;
    position: relative;
}

/* ===================== МЕНЮ ФОНОВ ===================== */
.background-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    padding: 12px;
    z-index: 10000;
    width: 300px;
    user-select: none;
}

.bg-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.bg-option:hover {
    background: #f8fafc;
}

.bg-preview {
    width: 48px;           /* уменьшил */
    height: 38px;          /* уменьшил */
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.bg-option.active {
    background: #f0f9ff;
    border: 1px solid #3b82f6;
}

.bg-option strong {
    font-size: 0.98rem;
}

.bg-option small {
    color: #64748b;
    font-size: 0.82rem;
}

/* Ссылка внизу */
.unlock-bg-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    color: #3b82f6;
    font-weight: 500;
    text-decoration: none;
    border-radius: 10px;
}

.unlock-bg-link:hover {
    background: #f0f9ff;
}

/* Кнопки действий в поле ввода */
.input-action-btn {
    width: 52px;
    height: 52px;
    border: none;
    background: none;
    color: #64748b;
    font-size: 1.35rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.input-action-btn:hover {
    background: #f1f5f9;
    color: #3b82f6;
}

.drag-overlay {
    position: absolute;
    inset: 0;
    background: rgba(59, 130, 246, 0.18);
    border: 4px dashed #3b82f6;
    border-radius: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 35 !important;           /* выше зверька */
    pointer-events: all !important;
    flex-direction: column;
    color: #3b82f6;
    font-size: 1.25rem;
    gap: 16px;
    backdrop-filter: blur(6px);
    font-weight: 500;
}

/* Recording Mode */
.recording-mode {
    position: relative;
}

.recording-mode .chat-input-area {
    gap: 8px;
}


.lock-icon {
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lock-icon.active {
    color: #10b981;
    transform: scale(1.2);
}

/* Индикатор записи */
.recording-bar {
    position: absolute;
    top: -65px;
    left: 70px;
    right: 80px;
    background: #fee2e2;
    border-radius: 30px;
    padding: 10px 16px;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
    z-index: 200;
    user-select: none;
}

.sound-wave {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 28px;
}

.sound-bar {
    width: 4px;
    background: #ef4444;
    border-radius: 999px;
    animation: soundWave 1.2s infinite ease-in-out;
}

.sound-bar:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.sound-bar:nth-child(3) { height: 85%; animation-delay: 0.2s; }
.sound-bar:nth-child(4) { height: 45%; animation-delay: 0.3s; }
.sound-bar:nth-child(5) { height: 75%; animation-delay: 0.4s; }

@keyframes soundWave {
    0%, 100% { height: 30%; }
    50% { height: 100%; }
}

/* ===================== КАСТОМНОЕ ГОЛОСОВОЕ СООБЩЕНИЕ ===================== */
.voice-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 18px;
    min-width: 240px;
}

.voice-play-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.voice-play-btn:hover {
    transform: scale(1.08);
}

.voice-play-btn i {
    font-size: 1.1rem;
}

.voice-wave-container {
    flex: 1;
    height: 28px;
    display: flex;
    align-items: center;
    position: relative;
}

.voice-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 100%;
    width: 100%;
}

.voice-bar {
    width: 3px;
    height: 100%;
    background: rgba(255,255,255,0.85);
    border-radius: 999px;
    transition: height 0.15s ease;
}

.voice-bar.active {
    background: #60a5fa;
    animation: voicePlaying 1.2s infinite ease-in-out;
}

@keyframes voicePlaying {
    0%, 100% { height: 35%; }
    50% { height: 100%; }
}

.voice-duration {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.85);
    min-width: 38px;
    text-align: right;
    font-family: monospace;
}



/* Анимация */
@keyframes soundWaveRecording {
    0%, 100% { height: 25%; }
    50% { height: 95%; }
}

@keyframes fadeInOut {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}
.emoji-limit-notification {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255,255,255,0.1);
}

@keyframes fadeInOut {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

.chat-modal-content {
    position: fixed;           /* Важно! */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    resize: none; /* мы сами контролируем */
}

.resize-handle {
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
    border-radius: 4px 0 8px 0;
}

.chat-modal-content.expanded {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* ===================== МЕССЕНДЖЕР ===================== */
.messenger-layout {
    display: flex;
    height: calc(100vh - 200px);
    background: #f8fafc;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* ===================== ЛЕВАЯ КОЛОНКА ===================== */
/* ===================== ЛЕВАЯ КОЛОНКА — СПИСОК ЧАТОВ ===================== */
.teachers-sidebar {
    width: 360px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 18px 20px 14px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
}

.sidebar-header h2 {
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

/* Поиск */
.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    background: #f8fafc;
}

.search-box input:focus {
    border-color: #5e17eb;
    background: white;
}

/* ===================== СПИСОК ПРЕПОДАВАТЕЛЕЙ ===================== */
.teachers-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

/* Карточка в стиле чата */
.teacher-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    margin: 2px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.teacher-card:hover {
    background: #f8fafc;
}

.teacher-card.active {
    background: #e3f2fd;
}

/* Аватар */
.teacher-avatar {
    position: relative;
    flex-shrink: 0;
}

.teacher-avatar img,
.teacher-avatar div {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

/* Информация */
.teacher-info {
    flex: 1;
    min-width: 0;
}

.teacher-info h3 {
    margin: 0 0 4px 0;
    font-size: 1.08rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subjects {
    color: #64748b;
    font-size: 0.92rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Статус онлайн */
.online-status {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
}

/* Непрочитанные */
.teacher-avatar .unread-badge {
    position: absolute !important;
    top: -3px !important;
    right: 3px !important;
    background: #ef4444 !important;
    color: white !important;
    border-radius: 50% !important;
    min-width: 20px !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    padding: 0 !important;
    border: 2px solid white !important;
    box-shadow: 0 1px 4px rgba(239,68,68,0.5) !important;
    line-height: 1 !important;
    z-index: 2 !important;
    animation: badgePulse 2s infinite !important;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.search-box {
    position: relative;
    margin-top: 4px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-box input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    background: #f8fafc;
}

.search-box input:focus {
    border-color: #5e17eb;
    background: white;
}

.teachers-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    position: relative;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-align: center;
}

.no-chat-icon {
    font-size: 4.5rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background-color: #f8fafc;
    background-size: 550px auto;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Адаптация существующих стилей сообщений */
.message {
    max-width: 75%;
    padding: 10px 14px 6px 14px;
    border-radius: 18px;
    line-height: 1.45;
    position: relative;
}

/* === ИСПРАВЛЕНИЕ ВИДИМОСТИ ТЕКСТА В ПОЛЕ ВВОДА === */
.chat-input-area input {
    flex: 1;
    padding: 11px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 50px;
    outline: none;
    font-size: 1rem;
    min-width: 0;
    background: white !important;
    color: #1f2937 !important;           /* тёмный текст */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chat-input-area input::placeholder {
    color: #94a3b8;
}

/* Фокус */
.chat-input-area input:focus {
    border-color: #5e17eb;
    box-shadow: 0 0 0 3px rgba(94, 23, 235, 0.1);
}
.background-menu {
    position: fixed !important;   /* вместо absolute */
    z-index: 10010 !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25) !important;
}
.context-action {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1rem;
    color: #1f2937;
}

.context-action:hover {
    background: #f1f5f9;
}

.context-action i {
    width: 20px;
    text-align: center;
    color: #64748b;
}

.reply-preview {
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    padding: 10px 16px;
    position: relative;
}

.reply-content {
    background: white;
    border-radius: 12px;
    padding: 8px 12px;
    border-left: 4px solid #3b82f6;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #64748b;
}

.cancel-reply-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
}

.cancel-reply-btn:hover {
    color: #ef4444;
}

.reply-text {
    font-size: 0.95rem;
    color: #1f2937;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===================== УЛУЧШЕННЫЙ REPLY BAR ===================== */
.reply-to-message {
    margin-bottom: 10px;
    padding: 10px 14px 10px 16px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid #60a5fa;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.message.sent .reply-to-message {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: #bae6fd;
}

.reply-to-message:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateX(3px);
}

.message.sent .reply-to-message:hover {
    background: rgba(255, 255, 255, 0.22);
}

.reply-bar {
    position: absolute;
    left: -4px;
    top: 12px;
    bottom: 12px;
    width: 4px;
    background: linear-gradient(to bottom, #60a5fa, #3b82f6);
    border-radius: 4px;
}

.reply-content-small {
    font-size: 0.89rem;
    line-height: 1.4;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-left: 4px;
}

.message.sent .reply-content-small {
    color: rgba(255, 255, 255, 0.85);
}

.emoji-limit-notification {
    animation: fadeInOut 4s forwards;
}

@keyframes fadeInOut {
    0%   { opacity: 0; transform: translateY(8px); }
    8%   { opacity: 1; transform: translateY(0); }
    85%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(8px); }
}
/* ===================== ГЛОБАЛЬНОЕ ОТКЛЮЧЕНИЕ СКРОЛЛА СТРАНИЦЫ ===================== */
html, body {
    height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
    position: fixed !important;
    top: 0;
    left: 0;
    overscroll-behavior: none;
}

/* Разрешаем скролл только в нужных контейнерах */
.teachers-list,
.chat-messages {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Тонкий скроллбар внутри чатов (по желанию) */
.teachers-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.teachers-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 20px;
}


/* ===================== ПАНЕЛЬ ЗАПИСИ ===================== */
.voice-recording-panel {
    display: none;
    width: 100%;
    background: white;
    border-top: 1px solid #e5e7eb;
    position: relative;
    min-height: 64px;
    flex-shrink: 0;
}

.voice-recording-panel.active {
    display: block;
}

.voice-rec-row {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 16px;
    gap: 0;
    width: 100%;
}

.voice-rec-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    width: 90px;
}

.voice-rec-hint {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

.voice-rec-mic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #5e17eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-left: auto;
}
/* Анимированная красная точка */
.recording-dot-anim {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    animation: recDotPulse 1.2s infinite ease-in-out;
}

@keyframes recDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.75); }
}

/* Таймер */
.voice-rec-timer {
    font-family: monospace;
    font-size: 1rem;
    color: #1f2937;
    min-width: 44px;
}

/* --- Центральная подсказка --- */
.voice-rec-hint {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
}

.voice-hint-sep {
    opacity: 0.5;
}

/* --- Иконка микрофона справа --- */
.voice-rec-mic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #5e17eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* --- Зафиксированная строка --- */
.voice-locked-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 16px;
}

.voice-locked-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Кнопка отменить */
.voice-cancel-locked-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.voice-cancel-locked-btn:hover {
    background: #fee2e2;
}

/* Круглая кнопка отправить */
.voice-send-round-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #5e17eb;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.voice-send-round-btn:hover {
    background: #4c12c7;
}

.lock-indicator {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 13px;          /* ровно над кнопкой отправить */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transform: translateY(18px) scale(0.82);
    transition: opacity 0.22s cubic-bezier(.4,0,.2,1),
                transform 0.22s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
    z-index: 100;
}

.lock-indicator.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Чем ближе к замку — тем больше и ярче */
.lock-indicator.near .lock-icon-wrap {
    transform: scale(1.18);
    background: rgba(94, 23, 235, 0.65);     /* фиолетовый намёк */
    border-color: rgba(255, 255, 255, 0.4);
}

.lock-indicator.near .lock-icon-wrap i {
    color: white;
}


.lock-indicator.near .lock-arrow i {
    color: #5e17eb;
}

/* Замок закрылся */
.lock-indicator.locked .lock-icon-wrap {
    background: rgba(94, 23, 235, 0.75);
    border-color: rgba(255, 255, 255, 0.45);
    transform: scale(1.25);
    animation: lockBounce 0.38s cubic-bezier(.36,.07,.19,.97);
}
.lock-indicator.locked .lock-icon-wrap i {
    color: white;
}

@keyframes lockBounce {
    0%   { transform: scale(1.4) rotate(-8deg); }
    40%  { transform: scale(1.1) rotate(4deg); }
    70%  { transform: scale(1.28) rotate(-2deg); }
    100% { transform: scale(1.25) rotate(0deg); }
}

/* Стрелки — мигают вверх */
.lock-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

.lock-arrow i {
    font-size: 9px;
    color: #94a3b8;
    transition: color 0.2s;
}

.lock-arrow i:first-child {
    animation: arrowFade 1s infinite 0.18s ease-in-out;
}
.lock-arrow i:last-child {
    animation: arrowFade 1s infinite 0s ease-in-out;
}

/* При near — стрелки ускоряются */
.lock-indicator.near .lock-arrow i:first-child {
    animation: arrowFade 0.5s infinite 0.1s ease-in-out;
}
.lock-indicator.near .lock-arrow i:last-child {
    animation: arrowFade 0.5s infinite 0s ease-in-out;
}

/* При locked — стрелки скрываются */
.lock-indicator.locked .lock-arrow {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s;
}

@keyframes arrowFade {
    0%, 100% { opacity: 0.25; transform: translateY(2px); }
    50%       { opacity: 1;    transform: translateY(-2px); }
}

.lock-icon-wrap {
    width: 52px;
    height: 52px;
    background: rgba(100, 116, 139, 0.55);   /* такой же как lock-pause-btn */
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    color: white;                             /* иконка белая */
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    transition: background 0.22s, border-color 0.22s, transform 0.22s;
}

.voice-pause-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #1f2937;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.voice-pause-btn:hover {
    background: #e2e8f0;
}

.voice-pause-btn.paused {
    background: #5e17eb;
    color: white;
    border-color: #5e17eb;
}

.lock-pause-btn {
    pointer-events: all !important;
    background: rgba(100, 116, 139, 0.55);
    backdrop-filter: blur(4px);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    width: 52px;
    margin-bottom: 6px;
    height: 52px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: none;    /* показывается только после фиксации */
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}


.lock-pause-btn:hover {
    background: rgba(100, 116, 139, 0.75);
    transform: scale(1.08);
}

.lock-pause-btn.paused {
    background: rgba(16, 185, 129, 0.6);
    border-color: rgba(16, 185, 129, 0.5);
}

.voice-wave-container canvas {
    border-radius: 4px;
    touch-action: none;
}

/* Курсор-указатель при наведении */
.voice-wave-container:hover canvas {
    opacity: 0.92;
}
.message.received .voice-duration {
    color: #374151 !important;
}

.message.received .download-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #555 !important;
}

.message.received .voice-play-btn {
    color: #5e17eb !important;
    background: rgba(94,23,235,0.1) !important;
}


.tg-groups-sidebar {
    width: 64px;
    background: #f1f5f9;          /* светло-серый вместо чёрного */
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 6px;
    flex-shrink: 0;
    overflow-y: auto;
    align-self: stretch;          /* растягивается на всю высоту */
    border-radius: 20px 0 0 20px; /* скругление слева как у всего блока */
}

.tgs-label {
    font-size: 9px;
    font-weight: 700;
    color: #94a3b8;               /* серый вместо белого */
    text-transform: uppercase;
    letter-spacing: .07em;
}

.tgs-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e2e8f0;          /* светлее */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #475569;               /* тёмно-серый текст */
    cursor: pointer;
    position: relative;
    transition: transform .15s, background .15s;
    flex-shrink: 0;
}

.tgs-item:hover { transform: scale(1.1); }

.tgs-item.active {
    outline: 2.5px solid #5e17eb;
    outline-offset: 2px;
    background: #ede9fe;          /* лёгкий фиолетовый фон */
    color: #5e17eb;
}

/* Цветные группы оставляем — просто текст белый */
.tgs-item[style*="background"] {
    color: white;
}

.tgs-item.tgs-add {
    background: transparent;
    border: 1.5px dashed #cbd5e1;
    color: #94a3b8;
    font-size: 20px;
}

.tgs-item.tgs-add:hover {
    background: #ede9fe;
    border-color: #5e17eb;
    color: #5e17eb;
}

.tgs-divider {
    width: 30px;
    height: 1px;
    background: #e2e8f0;
    margin: 2px 0;
}

.tgs-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #f1f5f9;    /* под цвет фона панели */
}