/* ===== Модальное окно озвучки (улучшенный адаптив) ===== */
.voice-modal-overlay {
    --accent: #D63384;
    --accent-hover: #C12A74;
    --bg-card: #ffffff;
    --text-primary: #2D3748;
    --text-secondary: #5A5A5A;
    --border-light: #f0dce4;
    --shadow-heavy: rgba(214, 51, 132, 0.15);
}

body.dark-theme .voice-modal-overlay {
    --accent: #D63384;
    --accent-hover: #E91E63;
    --bg-card: #1c1c1f;
    --text-primary: #e0e0e0;
    --text-secondary: #9a9a9f;
    --border-light: #2a2a2e;
    --shadow-heavy: rgba(214, 51, 132, 0.3);
}

.voice-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    padding: 20px;
}
.voice-modal-overlay.active {
    display: flex;
}

.voice-modal {
    background: var(--bg-card);
    border-radius: 24px;
    width: 95%;
    max-width: 800px;
    /* убраны тень и обводка */
    box-shadow: none;
    border: none;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Шапка */
.voice-modal-header {
    background: linear-gradient(135deg, #D63384 0%, #E91E63 50%, #9C27B0 100%);
    padding: 24px 30px;
    text-align: center;
    color: white;
    position: relative;
}
.voice-modal-close {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(255,255,255,0.2);
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 1.6rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}
.voice-modal-close:hover {
    background: rgba(255,255,255,0.4);
    transform: rotate(90deg);
}
.voice-modal-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.voice-modal-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

/* Тело */
.voice-modal-body {
    padding: 24px 30px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.voice-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    min-width: 0;
}
.voice-settings-left,
.voice-settings-right {
    min-width: 0;
}
.voice-setting-group {
    margin-bottom: 20px;
}
.voice-setting-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.voice-setting-title i {
    color: var(--accent);
    width: 18px;
}

/* Сетка опций (эмоции, формат) */
.voice-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.voice-option-horizontal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.voice-option-horizontal:hover {
    border-color: var(--accent);
    background: rgba(214, 51, 132, 0.04);
}
.voice-option-horizontal.selected {
    border-color: var(--accent);
    background: rgba(214, 51, 132, 0.08);
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.1);
}
.voice-option-horizontal.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
.voice-option-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #D63384, #E91E63);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}
.voice-option-horizontal.disabled .voice-option-icon {
    background: #e2e8f0;
}
.voice-option-name {
    font-weight: 500;
    font-size: 0.85rem;
}

/* Кастомный селект языка */
.voice-custom-select {
    position: relative;
    width: 100%;
}
.voice-select-selected {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.voice-select-selected::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 14px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.voice-select-selected.voice-select-arrow-active::after {
    transform: rotate(180deg);
}
.voice-select-items {
    position: absolute;
    background: var(--bg-card);
    top: calc(100% + 4px);
    left: 0; right: 0;
    z-index: 99;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(214, 51, 132, 0.1);
    display: none;
}
.voice-select-items.active {
    display: block;
}
.voice-select-search-container {
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}
.voice-select-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    color: var(--text-primary);
}
.voice-select-items div {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.voice-select-items div:hover {
    background: rgba(214, 51, 132, 0.05);
}
.voice-flag-icon {
    width: 20px; height: 15px;
    border-radius: 2px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

/* Фильтры голосов */
.voice-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.voice-filter {
    background: rgba(214, 51, 132, 0.06);
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
}
.voice-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.voice-filter.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Список голосов */
.voice-voices-list {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 12px;
}
.voice-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}
.voice-item:last-child { border-bottom: none; }
.voice-item:hover { background: rgba(214, 51, 132, 0.03); }
.voice-item.selected { background: rgba(214, 51, 132, 0.08); }
.voice-item-info { flex: 1; min-width: 0; }
.voice-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.voice-item-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.voice-item-preview {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    margin-left: 10px;
}
.voice-item-preview:hover { background: var(--accent-hover); }
.voice-pro-badge {
    background: #FFD700;
    color: #1a1a1a;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Слайдер */
.voice-slider-container { margin-top: 8px; }
.voice-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    outline: none;
    -webkit-appearance: none;
}
.voice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.voice-slider-value {
    text-align: center;
    font-weight: 600;
    color: var(--accent);
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Стоимость и кнопка */
.voice-modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 16px 30px;
    background: var(--bg-card);
}
.voice-cost-info {
    background: rgba(214, 51, 132, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.voice-cost-info strong { color: var(--accent); }
.voice-modal-action-btn {
    width: 100%;
    background: linear-gradient(135deg, #D63384, #E91E63);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.3);
}

/* ===== АДАПТИВ ===== */
/* Планшеты */
@media (max-width: 1140px) {
    .voice-modal-overlay {
        padding: 0;
        align-items: stretch;
    }
    .voice-modal {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        max-height: none;
    }
    .voice-modal-header { padding: 20px 20px 15px; }
    .voice-modal-body { padding: 20px; }
    .voice-settings-grid { grid-template-columns: 1fr; gap: 20px; }
    .voice-modal-footer { padding: 12px 20px; }
}

/* Мобильные */
@media (max-width: 768px) {
    .voice-modal-close {
        width: 44px; height: 44px;
        font-size: 1.8rem;
        top: 10px; right: 10px;
    }
    .voice-modal-header { padding: 20px 20px 15px; }
    .voice-modal-body { padding: 20px; }
    .voice-modal-title { font-size: 1.5rem; }
    .voice-setting-title { font-size: 1rem; margin-bottom: 12px; }
    .voice-option-horizontal { padding: 14px; border-radius: 14px; }
    .voice-option-icon { width: 36px; height: 36px; font-size: 1rem; }
    .voice-option-name { font-size: 1rem; }
    .voice-select-selected { padding: 14px; font-size: 1rem; }
    .voice-filter { padding: 8px 14px; font-size: 0.9rem; }
    .voice-item { padding: 14px; }
    .voice-item-name { font-size: 1rem; }
    .voice-item-desc { font-size: 0.85rem; }
    .voice-item-preview { padding: 8px 14px; font-size: 0.85rem; }
    .voice-slider-value { font-size: 1rem; }
    .voice-cost-info { font-size: 0.9rem; padding: 14px; }
    .voice-modal-action-btn { padding: 16px; font-size: 1.05rem; }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .voice-modal-close {
        width: 46px; height: 46px;
        font-size: 2rem;
    }
    .voice-modal-header { padding: 16px 16px 12px; }
    .voice-modal-body { padding: 14px; }
    .voice-modal-title { font-size: 1.3rem; }
    .voice-options-grid {
        grid-template-columns: 1fr 1fr;
    }
    .voice-item {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .voice-item-preview {
        align-self: center;
        margin-left: auto;
    }
}