/* Основные переменные для модального окна озвучки */
.voice-modal-overlay {
    --voice-primary: #D63384;
    --voice-primary-light: #E91E63;
    --voice-primary-dark: #9C27B0;
    --voice-primary-gradient: linear-gradient(135deg, #D63384 0%, #E91E63 50%, #9C27B0 100%);
    --voice-success: #10B981;
    --voice-text-dark: #1F2937;
    --voice-text-light: #6B7280;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.voice-modal-body-override {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.voice-modal-container {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.voice-modal-h1 {
    color: var(--voice-text-dark);
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.voice-modal-p {
    color: var(--voice-text-light);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.voice-modal-btn {
    background: var(--voice-primary-gradient);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(214, 51, 132, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.voice-modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(214, 51, 132, 0.6);
}

.voice-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    padding: 20px;
    animation: voice-modal-fadeIn 0.4s ease;
}

@keyframes voice-modal-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.voice-modal-overlay.active {
    display: flex;
}

.voice-modal {
    background: linear-gradient(165deg, #ffffff 0%, #fdf2f8 100%);
    border-radius: 8px;
    padding: 0;
    width: 95%;
    max-width: 800px;
    box-shadow:
        0 32px 64px rgba(214, 51, 132, 0.25),
        0 16px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    animation: voice-modal-slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.voice-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--voice-primary-gradient);
}

@keyframes voice-modal-slideIn {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.voice-modal-header {
    background: var(--voice-primary-gradient);
    padding: 30px 40px 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.voice-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Q50,80 0,100 Z" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: cover;
}

.voice-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--voice-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.voice-modal-close:hover {
    background: white;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.voice-modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.voice-modal-subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.voice-modal-body {
    padding: 30px 40px;
    flex: 1;
    overflow-y: auto;
}

.voice-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.voice-setting-group {
    margin-bottom: 20px;
}

.voice-setting-title {
    font-weight: 700;
    color: var(--voice-text-dark);
    margin-bottom: 12px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-setting-title i {
    color: var(--voice-primary);
    font-size: 1.1rem;
}

.voice-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.voice-option-horizontal {
    background: white;
    border: 2px solid #f1f5f9;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-option-horizontal:hover {
    border-color: var(--voice-primary-light);
    transform: translateY(-1px);
}

.voice-option-horizontal.selected {
    border-color: var(--voice-primary);
    background: linear-gradient(135deg, #fff, #fdf2f8);
    box-shadow: 0 2px 8px rgba(214, 51, 132, 0.15);
}

.voice-option-horizontal.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.voice-option-horizontal.disabled:hover {
    transform: none;
    border-color: #f1f5f9;
}

.voice-option-icon {
    width: 32px;
    height: 32px;
    background: var(--voice-primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.voice-option-horizontal.disabled .voice-option-icon {
    background: #e2e8f0;
}

.voice-option-name {
    font-weight: 600;
    color: var(--voice-text-dark);
    font-size: 0.9rem;
}

.voice-option-horizontal.disabled .voice-option-name {
    color: var(--voice-text-light);
}

.voice-custom-select {
    position: relative;
    width: 100%;
}

.voice-select-selected {
    background: white;
    border: 2px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-select-selected:after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--voice-text-light);
    transition: transform 0.3s ease;
}

.voice-select-selected.voice-select-arrow-active:after {
    transform: translateY(-50%) rotate(180deg);
}

.voice-select-selected:hover {
    border-color: var(--voice-primary-light);
}

.voice-select-items {
    position: absolute;
    background: white;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    border: 2px solid #f1f5f9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: none;
}

.voice-select-items.active {
    display: block;
}

.voice-select-search-container {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.voice-select-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.voice-select-search:focus {
    border-color: var(--voice-primary);
}

.voice-select-search::placeholder {
    color: var(--voice-text-light);
}

.voice-select-items div {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.voice-select-items div:last-child {
    border-bottom: none;
}

.voice-select-items div:hover {
    background: rgba(214, 51, 132, 0.05);
}

.voice-select-items div.selected {
    background: rgba(214, 51, 132, 0.1);
}

.voice-no-results {
    padding: 15px;
    text-align: center;
    color: var(--voice-text-light);
    font-size: 0.9rem;
}

.voice-flag-icon {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.voice-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.voice-filter {
    background: white;
    border: 2px solid #f1f5f9;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--voice-text-light);
    white-space: nowrap;
}

.voice-filter:hover {
    border-color: var(--voice-primary-light);
}

.voice-filter.selected {
    background: var(--voice-primary);
    color: white;
    border-color: var(--voice-primary);
}

.voice-voices-list {
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    background: white;
    scrollbar-width: thin;
    scrollbar-color: var(--voice-primary) #f1f5f9;
}

.voice-voices-list::-webkit-scrollbar {
    width: 8px;
}

.voice-voices-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.voice-voices-list::-webkit-scrollbar-thumb {
    background: var(--voice-primary);
    border-radius: 4px;
}

.voice-voices-list::-webkit-scrollbar-thumb:hover {
    background: var(--voice-primary-dark);
}

.voice-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    position: relative;
}

.voice-item:last-child {
    border-bottom: none;
}

.voice-item:hover {
    background: rgba(214, 51, 132, 0.05);
}

.voice-item.selected {
    background: rgba(214, 51, 132, 0.1);
    border-left: 3px solid var(--voice-primary);
}

.voice-item-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.voice-item-name {
    font-weight: 600;
    color: var(--voice-text-dark);
    margin-bottom: 2px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.voice-item-desc {
    color: var(--voice-text-light);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-item-preview {
    background: var(--voice-primary-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.voice-item-preview:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(214, 51, 132, 0.3);
}

.voice-item-preview.playing {
    background: var(--voice-success);
}

.voice-pro-badge {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #8B4513;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.voice-emotion-icon {
    color: var(--voice-primary);
    font-size: 0.8rem;
    margin-left: 5px;
}

.voice-slider-container {
    margin-top: 8px;
}

.voice-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

.voice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--voice-primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.voice-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--voice-primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.voice-slider-value {
    text-align: center;
    font-weight: 600;
    color: var(--voice-primary);
    margin-top: 4px;
    font-size: 0.85rem;
}

.voice-cost-info {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--voice-text-dark);
}

.voice-cost-info p {
    margin: 5px 0;
    color: var(--voice-text-dark);
    font-size: 0.85rem;
}

.voice-cost-info strong {
    color: var(--voice-primary);
}

.voice-modal-footer {
    text-align: center;
    padding: 15px 40px;
    border-top: 1px solid #f1f5f9;
    background: white;
    flex-shrink: 0;
}

.voice-modal-action-btn {
    background: var(--voice-primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.voice-modal-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(214, 51, 132, 0.5);
}

.voice-loading {
    text-align: center;
    padding: 20px;
    color: var(--voice-text-light);
}

@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-close {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .voice-modal-body {
        padding: 20px;
        overflow-y: auto;
        flex: 1;
    }

    .voice-settings-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .voice-modal-title {
        font-size: 1.5rem;
    }

    .voice-modal-subtitle {
        font-size: 0.9rem;
    }

    .voice-modal-footer {
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .voice-modal-header {
        padding: 15px 15px 12px;
    }

    .voice-modal-body {
        padding: 15px;
    }

    .voice-modal-title {
        font-size: 1.3rem;
    }

    .voice-options-grid {
        grid-template-columns: 1fr 1fr;
    }

    .voice-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .voice-item-preview {
        align-self: flex-end;
    }
}


    .notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
}

.notification {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 400px;
}

.notification.success {
    background: #4CAF50;
    color: white;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    margin-left: auto;
}