/* chat.css – полная финальная версия */
body {
    overflow: hidden !important;
}

.chat-container {
    position: fixed;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1400px;
    bottom: 90px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
}

.faq-wrapper {
    background: rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
}

.faq-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.faq-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.faq-btn {
    background: rgba(255, 255, 255, 0.6);
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    color: #333;
}

.faq-btn:hover {
    background: white;
}

.faq-answer {
    margin-top: 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px 10px;
    border-radius: 12px;
    display: none;
}

.chat-header {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #333;
}

.online-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.green-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
}

.gray-dot {
    background: #95a5a6;
}

/* Вкладки пользователей */
.chat-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.chat-tab {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    background: rgba(255, 255, 255, 0.3) !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    color: #333 !important;
}

.chat-tab.active {
    background: #2c3e50 !important;
    color: white !important;
}

.chat-tab.active .msg-count {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.chat-tab .msg-count {
    background: rgba(0, 0, 0, 0.1) !important;
    border-radius: 10px !important;
    padding: 0 5px !important;
    margin-left: 5px !important;
    font-size: 10px !important;
}

.tab-delete {
    cursor: pointer !important;
    color: #e74c3c !important;
    font-size: 12px !important;
    margin-left: 5px !important;
}

.chat-tab.active .tab-delete {
    color: #ff9999 !important;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 14px;
    background: white;
    color: black;
    position: relative;
}

.message-user {
    align-self: flex-end;
}

.message-manager {
    align-self: flex-start;
}

.message strong {
    font-size: 12px;
    display: block;
    margin-bottom: 4px;
    color: #333;
}

.message small {
    font-size: 10px;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
}

.reply-btn {
    margin-top: 5px;
    background: #666;
    color: white;
    border: none;
    border-radius: 15px;
    padding: 3px 10px;
    font-size: 10px;
    cursor: pointer;
    margin-right: 5px;
}

.delete-msg-btn {
    margin-left: 5px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
}

.delete-msg-btn:hover {
    background: #c0392b;
}

.send-area {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.send-area textarea {
    width: 100%;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid #aaa;
    background: white;
    color: black;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.send-area input {
    padding: 8px 12px;
    border-radius: 25px;
    border: 1px solid #aaa;
    background: white;
    color: black;
    font-size: 14px;
}

.name-email-row {
    display: flex;
    gap: 8px;
}

.name-email-row input {
    flex: 1;
}

.send-area button {
    background: #555;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.char-counter {
    text-align: right;
    font-size: 11px;
    color: #555;
    margin-top: -5px;
}
/* ========== ГОЛОСОВЫЕ СООБЩЕНИЯ ========== */

/* Кнопка записи голоса */
.voice-btn {
    background: #2c3e50;
    color: white;
    border: none;
    width: 50px;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}
.voice-btn:hover {
    background: #1a252f;
}

/* Анимация записи */
.voice-btn.recording {
    background-color: #e74c3c !important;
    animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Статус записи */
.voice-status {
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    text-align: center;
    margin-top: 8px;
}

/* Контейнер голосового сообщения */
.voice-message {
    background: #eef2f3;
    border-radius: 16px;
    padding: 8px 12px;
    display: inline-block;
    max-width: 280px;
    border: 1px solid #dcdde1;
    margin-top: 4px;
}

.message.guest .voice-message {
    background: #eef2f3;
}

.message.admin .voice-message {
    background: #dff9fb;
    border-color: #c7ecee;
}

/* Аудиоплеер */
.voice-message audio {
    width: 240px;
    height: 36px;
    outline: none;
    border-radius: 20px;
}

@media (max-width: 768px) {
    .chat-container {
        top: 85px;
        bottom: 100px;
        width: 100%;
        border-radius: 0;
    }
    .name-email-row {
        flex-direction: column;
    }
    .message {
        max-width: 85%;
    }
}
/* ========== МОБИЛЬНЫЕ СТИЛИ ДЛЯ ГОЛОСОВЫХ СООБЩЕНИЙ ========== */

@media (max-width: 768px) {
    /* Кнопка микрофона на мобильных */
    .voice-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #2c3e50;
        color: white;
        border: none;
        cursor: pointer;
        transition: 0.2s;
    }
    
    .voice-btn.recording {
        background-color: #e74c3c !important;
        animation: pulseMobile 1.5s infinite;
    }
    
    @keyframes pulseMobile {
        0% {
            box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
            transform: scale(1);
        }
        70% {
            box-shadow: 0 0 0 8px rgba(231, 76, 60, 0);
            transform: scale(1.05);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
            transform: scale(1);
        }
    }
    
    /* Контейнер голосового сообщения на мобильных */
    .voice-message {
        max-width: 220px;
        padding: 6px 10px;
    }
    
    /* Аудиоплеер на мобильных — более компактный */
    .voice-message audio {
        width: 180px;
        height: 32px;
    }
    
    /* Статус записи на мобильных */
    .voice-status {
        font-size: 10px;
        padding: 4px 8px;
        margin-top: 6px;
    }
    
    /* Блок отправки на мобильных — кнопки в ряд */
    .send-area {
        padding: 8px 12px;
    }
    
    .send-area > div {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    
    /* Текстовая область на мобильных */
    .send-area textarea {
        font-size: 15px;
        padding: 8px;
        min-height: 40px;
    }
}

/* ========== ДЛЯ ОЧЕНЬ МАЛЕНЬКИХ ЭКРАНОВ (≤ 480px) ========== */

@media (max-width: 480px) {
    .voice-message {
        max-width: 180px;
    }
    
    .voice-message audio {
        width: 150px;
        height: 30px;
    }
    
    .voice-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .send-area button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ========== АЛЬТЕРНАТИВНЫЙ ВАРИАНТ: КАСТОМНЫЙ ПЛЕЕР ДЛЯ МОБИЛЬНЫХ ========== */
/* Опционально — чтобы плеер выглядел лучше на iOS/Android */

.voice-message audio::-webkit-media-controls-panel {
    background-color: #f0f0f0;
    border-radius: 20px;
}

.voice-message audio::-webkit-media-controls-play-button {
    background-color: #2c3e50;
    border-radius: 50%;
}

.voice-message audio::-webkit-media-controls-current-time-display,
.voice-message audio::-webkit-media-controls-time-remaining-display {
    font-size: 11px;
}

@media (min-width: 769px) {
    .chat-container {
        top: 110px;
        bottom: 90px;
    }
}

/* ========== ЧЕРНОВИК ЗАПИСИ ========== */

.voice-draft-container {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.3);
}

.draft-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: white;
    transition: 0.2s;
}

.draft-btn:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

#playDraftBtn { background: #3498db; }
#sendDraftBtn { background: #27ae60; }
#cancelDraftBtn { background: #e74c3c; }

@media (max-width: 768px) {
    .voice-draft-container > div {
        flex-direction: column;
    }
    .draft-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}