/* === ПОЛНЫЕ СТИЛИ TTS APP === */

/* Сброс отступов */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

/* Шапка */
.app-header {
    background: white;
    border-bottom: 1px solid #e1e5e9;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo-section h1 {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.logo-section p {
    color: #718096;
    font-size: 0.9rem;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
}

.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.avatar-icon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
}

.user-greeting {
    color: #4a5568;
    font-weight: 500;
}

/* Основной контейнер */
.tts-container {
    display: flex;
    max-width: 1400px;
    height: calc(100vh - 80px);
    margin: 0 auto;
    background: white;
}

/* Боковая панель */
.sidebar {
    width: 250px;
    border-right: 1px solid #e1e5e9;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e1e5e9;
}

.section-title {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 1rem;
    font-weight: 600;
}

.voices-section {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.model-container {
    display: flex;
    width: 100%;
    background: white;
}

.storage-stats {
    display: flex;
    width: 100%;
    background: white;	
    font-size: 14px;
}

.stack-audio-text {
    font-size: 14px;
}

/* === КОМПАКТНЫЕ СТИЛИ АУДИО СТЭКА === */

/* Контейнер стэка */
.voices-section {
    padding: 10px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Элемент аудио в стэке */
.stack-audio-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.stack-audio-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Заголовок элемента - компактный */
.stack-audio-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.stack-audio-number {
    background: #4299e1;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.stack-audio-voice {
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
    flex: 1;
}

.local-badge {
    background: #ed8936;
    color: white;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
}

.remove-audio-btn {
    background: #fed7d7;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #e53e3e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remove-audio-btn:hover {
    background: #feb2b2;
    transform: scale(1.1);
}

/* Текст аудио */
.stack-audio-text {
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 8px;
    line-height: 1.3;
    padding: 4px 0;
}

/* Контролы аудио - компактные в одну строку */
.stack-audio-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stack-audio-player {
    flex: 1;
    height: 28px;
    border-radius: 6px;
    background: #f7fafc;
    min-width: 0;
}

.stack-audio-player::-webkit-media-controls-panel {
    background: #f7fafc;
    padding: 0 4px;
}

.stack-audio-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Кнопки действий - только иконки */
.action-btn {
    background: #e2e8f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
}

/* Цвета кнопок */
.save-to-db-btn {
    background: #ed8936;
    color: white;
}

.save-to-db-btn:hover {
    background: #dd6b20;
}

.saved-btn {
    background: #48bb78;
    color: white;
    cursor: default;
}

.saved-btn:hover {
    transform: none;
}

.edit-btn {
    background: #4299e1;
    color: white;
}

.edit-btn:hover {
    background: #3182ce;
}

.download-btn {
    background: #38b2ac;
    color: white;
}

.download-btn:hover {
    background: #319795;
}

.stack-audio-time {
    font-size: 10px;
    color: #a0aec0;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Кнопки управления стэком */
.stack-controls {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.control-btn-compact {
    flex: 1;
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.control-btn-compact:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.control-btn-compact.sync {
    background: #48bb78;
    flex: 0 0 auto;
    width: 36px;
}

.control-btn-compact.sync:hover {
    background: #38a169;
}

.control-btn-compact.clear {
    background: #e53e3e;
    flex: 0 0 auto;
    width: 36px;
}

.control-btn-compact.clear:hover {
    background: #c53030;
}

/* Секция скомпилированного аудио */
.compiled-audio-section {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.compiled-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.compiled-header h4 {
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compiled-info {
    font-size: 11px;
    opacity: 0.9;
}

.compiled-audio-player {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
}

.compiled-controls {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.compiled-controls .action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.compiled-controls .action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Сообщение о пустом стэке */
.empty-stack-message {
    text-align: center;
    padding: 30px 15px;
    color: #718096;
}

.empty-stack-message i {
    font-size: 36px;
    margin-bottom: 12px;
    color: #cbd5e0;
}

.empty-stack-message p {
    margin: 0 0 6px 0;
    font-size: 14px;
}

.empty-stack-message small {
    font-size: 11px;
}

/* Информация о хранилище */
.storage-info {
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    background: transparent !important;
}

.storage-info h4 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 6px;
}

.storage-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #718096;
}

.storage-stat {
    text-align: center;
    flex: 1;
}

.storage-stat .number {
    font-weight: bold;
    font-size: 13px;
    color: #2d3748;
    display: block;
}

.storage-stat .label {
    font-size: 11px;
    color: #718096;
    display: block;
    margin-top: 2px;
}

/* Убираем градиенты и фоны */
.storage-info {
    background: transparent !important;
    color: #4a5568 !important;
}

.storage-info h4 {
    color: #4a5568 !important;
}

.storage-stat .number {
    color: #2d3748 !important;
}

/* === СТИЛИ ДЛЯ ВЫБОРА ГОЛОСОВ === */
.voice-sample {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    margin-bottom: 8px;
    position: relative;
}

.voice-sample:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.voice-sample.active {
    border-color: #4299e1;
    background: #ebf8ff;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
}

.voice-name {
    font-weight: bold;
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 4px;
}

.voice-description {
    font-size: 12px;
    color: #718096;
    margin-bottom: 6px;
}

.voice-language {
    font-size: 11px;
    color: #2c5aa0;
    font-weight: bold;
    padding: 2px 6px;
    background: rgba(44, 90, 160, 0.1);
    border-radius: 10px;
    display: inline-block;
}

/* Основная рабочая область */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8fafc;
}

.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    color: #718096;
}

.welcome-message i {
    font-size: 3rem;
    color: #a0aec0;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    margin-bottom: 1rem;
    color: #4a5568;
}

.model-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(44, 90, 160, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.model-name {
    font-weight: bold;
    color: #333;
}

.model-language {
    color: #2c5aa0;
    font-weight: bold;
}

.current-model-info {
    margin-top: 15px;
}

/* Поле ввода */
.input-container {
    padding: 1rem;
    border-top: 1px solid #e1e5e9;
    background: white;
}

.input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 0.75rem;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#text-input {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.9rem;
    line-height: 1.4;
    font-family: inherit;
    background: transparent;
    min-height: 20px;
    max-height: 120px;
}

.input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.current-model {
    background: #2c5aa0;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.char-count {
    font-size: 0.7rem;
    color: #718096;
}

.send-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
    height: fit-content;
}

.send-button:hover {
    background: #0056b3;
}

.send-button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* Кнопки управления */
.controls-bottom {
    display: flex;
    gap: 0.1rem;
    margin: 1rem 0;
    padding: 0 1rem;
}

.control-btn {
    flex: 0.2;
    margin: 0 auto;
    padding: 0.6rem;
    background: #87CEFA;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.control-btn.settings {
    flex: 0 0 auto;
    width: 40px;
}

/* === НАСТРОЙКИ СИНТЕЗА РЕЧИ === */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.settings-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.settings-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.settings-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.close-settings-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-settings-btn:hover {
    background: #f7fafc;
}

.settings-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.settings-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Группы настроек */
.setting-group {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.setting-group h3 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-group h3 i {
    color: #4299e1;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
}

.setting-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    background: white;
    transition: border-color 0.2s;
    cursor: pointer;
}

.setting-select:focus {
    outline: none;
    border-color: #4299e1;
}

.setting-hint {
    display: block;
    font-size: 0.875rem;
    color: #718096;
    margin-top: 0.25rem;
}

/* Чекбоксы */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal;
    line-height: 1.4;
}

.checkbox-label input {
    margin-right: 0.75rem;
    transform: scale(1.2);
    margin-top: 0.2rem;
}

/* Текущие настройки */
.current-settings-panel {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.current-settings-panel h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.setting-display {
    font-size: 0.875rem;
}

.setting-display strong {
    display: block;
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.setting-display span {
    font-weight: 600;
}

/* Кнопки настроек */
.apply-settings-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.apply-settings-btn:hover {
    background: #3182ce;
}

.close-settings-btn {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.close-settings-btn:hover {
    background: #cbd5e0;
}

/* Примеры SSML */
.ssml-examples {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}

.ssml-examples h4 {
    margin: 0 0 0.75rem 0;
    color: #2d3748;
    font-size: 0.9rem;
}

.ssml-example {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ssml-sample-btn {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-align: left;
    color: #495057;
}

.ssml-sample-btn:hover {
    background: #dee2e6;
    border-color: #adb5bd;
}

/* Стили для сообщений */
.message {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.audio-message .message-header {
    justify-content: space-between;
}

.message-model {
    font-weight: bold;
    color: #2c5aa0;
}

.message-language {
    background: rgba(44, 90, 160, 0.1);
    color: #2c5aa0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.message-text {
    color: #333;
    line-height: 1.4;
    margin-bottom: 12px;
}

.audio-player-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-audio {
    flex: 1;
    height: 40px;
}

.download-audio-btn {
    background: #2c5aa0;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.download-audio-btn:hover {
    background: #1e3d6f;
}

/* Модальное окно выбора файлов для компиляции */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.compile-modal {
    background: white;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header p {
    margin: 5px 0 0 0;
    color: #718096;
    font-size: 14px;
}

.file-selection {
    margin-bottom: 20px;
}

.file-selection h4 {
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 14px;
}

#fileCheckboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    background: #f7fafc;
}

.file-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #f7fafc;
    transition: background-color 0.2s ease;
}

.file-checkbox-item:hover {
    background: #edf2f7;
    border-radius: 4px;
}

.file-checkbox-item:last-child {
    border-bottom: none;
}

.file-checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.1);
}

.file-checkbox-item label {
    flex: 1;
    cursor: pointer;
    font-size: 13px;
}

.order-selection {
    margin-bottom: 20px;
}

.order-selection h4 {
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 14px;
}

.order-selection small {
    color: #718096;
    font-weight: normal;
}

#sortableList {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    background: #f7fafc;
}

.sortable-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f7fafc;
    background: #f8fafc;
    margin: 2px;
    border-radius: 6px;
    cursor: move;
    transition: all 0.2s ease;
}

.sortable-item:hover {
    background: #edf2f7;
    transform: translateX(2px);
}

.sortable-item:last-child {
    border-bottom: none;
}

.sortable-item.dragging {
    opacity: 0.5;
    background: #e2e8f0;
}

.order-number {
    background: #4299e1;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

.preview-btn {
    background: none;
    border: none;
    color: #4299e1;
    cursor: pointer;
    margin-right: 10px;
    transition: color 0.2s ease;
}

.preview-btn:hover {
    color: #3182ce;
}

.selection-info {
    background: #edf2f7;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.selection-info > div {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#cancelCompile {
    padding: 10px 20px;
    border: 1px solid #cbd5e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.2s ease;
}

#cancelCompile:hover {
    background: #f7fafc;
    border-color: #a0aec0;
}

#confirmCompile {
    padding: 10px 20px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

#confirmCompile:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

/* Анимации */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stack-audio-item {
    animation: slideIn 0.3s ease;
}

/* Кастомный скроллбар */
.voices-section::-webkit-scrollbar,
.settings-body::-webkit-scrollbar,
.compile-modal::-webkit-scrollbar {
    width: 6px;
}

.voices-section::-webkit-scrollbar-track,
.settings-body::-webkit-scrollbar-track,
.compile-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.voices-section::-webkit-scrollbar-thumb,
.settings-body::-webkit-scrollbar-thumb,
.compile-modal::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.voices-section::-webkit-scrollbar-thumb:hover,
.settings-body::-webkit-scrollbar-thumb:hover,
.compile-modal::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Градиентные фоны для разных типов аудио */
.stack-audio-item[data-voice*="xenia"] {
    border-left: 3px solid #4299e1;
}

.stack-audio-item[data-voice*="aidar"] {
    border-left: 3px solid #ed8936;
}

.stack-audio-item[data-voice*="baya"] {
    border-left: 3px solid #48bb78;
}

.stack-audio-item[data-voice*="kseniya"] {
    border-left: 3px solid #9f7aea;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    z-index: 10001;
    animation: slideInRight 0.3s ease;
}

.notification-success {
    background: #48bb78;
}

.notification-error {
    background: #f56565;
}

.notification-warning {
    background: #ed8936;
}

.notification-info {
    background: #4299e1;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Индикатор загрузки */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптивность */
@media (max-width: 768px) {
    .stack-audio-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .stack-audio-buttons {
        justify-content: center;
        order: -1;
        margin-bottom: 6px;
    }
    
    .stack-audio-time {
        text-align: center;
        order: -2;
    }
    
    .stack-controls {
        flex-direction: column;
    }
    
    .compile-modal {
        width: 95%;
        margin: 10px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .stack-audio-player {
        order: 1;
    }
    
    .settings-content {
        width: 95%;
        max-height: 95vh;
        margin: 0;
    }
    
    .current-settings {
        grid-template-columns: 1fr;
    }
    
    .settings-footer {
        flex-direction: column;
    }
    
    .setting-group {
        padding: 1rem;
    }
}

/* Кнопка переключения боковой панели */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 100;
    display: none;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 99;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
}

/* === СТИЛИ ДЛЯ СКОМПИЛИРОВАННОГО АУДИО В СТЭКЕ === */

/* Специальный стиль для скомпилированных аудио */
.stack-audio-item.compiled-audio {
    border-left: 4px solid #9f7aea;
    background: linear-gradient(135deg, #f7fafc 0%, #f0fff4 100%);
    border: 2px solid #9f7aea;
}

.stack-audio-item.compiled-audio .stack-audio-header {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
    color: white;
    margin: -8px -8px 8px -8px;
    padding: 8px;
    border-radius: 6px 6px 0 0;
}

.stack-audio-item.compiled-audio .stack-audio-number {
    background: white;
    color: #9f7aea;
    font-weight: bold;
}

.stack-audio-item.compiled-audio .stack-audio-voice {
    color: white;
    font-weight: bold;
}

.stack-audio-item.compiled-audio .compiled-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #9f7aea;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
}

.stack-audio-item.compiled-audio .stack-audio-text {
    color: #2d3748;
    font-weight: 500;
    background: rgba(159, 122, 234, 0.1);
    padding: 6px 8px;
    border-radius: 4px;
    margin: 8px -4px;
}

/* Индикатор сегментов */
.segments-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
}

.segments-count {
    background: #4299e1;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: bold;
}

/* Лоадер при загрузке */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner-large {
    width: 60px;
    height: 60px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 16px;
    color: #4a5568;
    font-weight: 500;
}

.loading-details {
    font-size: 14px;
    color: #718096;
    text-align: center;
}

/* Анимация появления скомпилированного аудио */
@keyframes compileSuccess {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.stack-audio-item.compiled-audio.new-compiled {
    animation: compileSuccess 0.6s ease-out;
}

/* Статус базы данных для аудио */
.audio-source-badge {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
    margin-left: 4px;
}

.audio-source-local {
    background: #ed8936;
    color: white;
}

.audio-source-database {
    background: #48bb78;
    color: white;
}

.audio-source-compiled {
    background: #9f7aea;
    color: white;
}

/* Прогресс-бар для загрузки */
.progress-container {
    width: 200px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar {
    height: 8px;
    background: linear-gradient(90deg, #4299e1, #38b2ac);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 12px;
    color: #4a5568;
    margin-top: 5px;
}
/* === СТИЛИ ДЛЯ АУДИО ПЛЕЕРА В СТЭКЕ === */

.audio-player-section {
    margin: 8px 0;
    width: 100%;
}

.stack-audio-player {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
}

/* Кастомизация внешнего вида аудио плеера */
.stack-audio-player::-webkit-media-controls-panel {
    background: #f7fafc;
    border-radius: 8px;
}

.stack-audio-player::-webkit-media-controls-play-button {
    background-color: #4299e1;
    border-radius: 50%;
}

.stack-audio-player::-webkit-media-controls-current-time-display,
.stack-audio-player::-webkit-media-controls-time-remaining-display {
    color: #4a5568;
    font-size: 12px;
}

.stack-audio-player::-webkit-media-controls-timeline {
    background-color: #e2e8f0;
    border-radius: 2px;
    margin-left: 10px;
    margin-right: 10px;
}

.stack-audio-player::-webkit-media-controls-volume-slider {
    background-color: #e2e8f0;
    border-radius: 2px;
}

/* Для Firefox */
.stack-audio-player {
    background: #f7fafc;
}

/* Для скомпилированных аудио - особый стиль плеера */
.stack-audio-item.compiled-audio .stack-audio-player {
    background: rgba(159, 122, 234, 0.1);
    border-color: #9f7aea;
}

.stack-audio-item.compiled-audio .stack-audio-player::-webkit-media-controls-panel {
    background: rgba(159, 122, 234, 0.1);
}

/* Контролы под аудио плеером */
.stack-audio-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.stack-audio-buttons {
    display: flex;
    gap: 4px;
}

.stack-audio-time {
    font-size: 11px;
    color: #a0aec0;
    min-width: 45px;
    text-align: right;
}

/* Адаптивность */
@media (max-width: 768px) {
    .stack-audio-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .stack-audio-buttons {
        justify-content: center;
        order: 1;
    }
    
    .stack-audio-time {
        text-align: center;
        order: 2;
    }
    
    .audio-player-section {
        order: 0;
    }
}

/* Убедимся, что аудио элемент виден */
audio[controls] {
    display: block;
    width: 100%;
}

/* === СТИЛИ ДЛЯ ОБЫЧНЫХ АУДИО В СТЭКЕ === */

/* Базовый стиль для всех обычных аудио элементов */
.stack-audio-item:not(.compiled-audio) {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stack-audio-item:not(.compiled-audio):hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cbd5e0;
}

/* Поле снизу для разделения обычных аудио */
.stack-audio-item:not(.compiled-audio)::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 10%;
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

/* Убираем поле у последнего элемента */
.stack-audio-item:not(.compiled-audio):last-child::after {
    display: none;
}

/* Заголовок с легким фоном для обычных аудио */
.stack-audio-item:not(.compiled-audio) .stack-audio-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #f7fafc;
}

.stack-audio-item:not(.compiled-audio) .stack-audio-header:hover {
    background: #edf2f7;
}
/* tts-editor.css - Стили для аудио редактора */

.audio-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.audio-editor-modal {
    background: #2d3748;
    border-radius: 15px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #4a5568;
    display: flex;
    flex-direction: column;
}

.editor-header {
    background: #1a202c;
    padding: 20px;
    border-bottom: 1px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header h2 {
    margin: 0;
    color: #e2e8f0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-editor-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.close-editor-btn:hover {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
}

.editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    max-height: calc(90vh - 140px);
}

.editor-preview {
    flex: 1;
    padding: 20px;
    border-right: 1px solid #4a5568;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #2d3748;
}

.audio-waveform {
    background: #1a202c;
    border-radius: 10px;
    padding: 20px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #4a5568;
}

.waveform-placeholder {
    text-align: center;
    color: #718096;
}

.waveform-placeholder i {
    font-size: 3rem;
    margin-bottom: 10px;
    color: #4299e1;
}

.audio-player {
    background: #1a202c;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #4a5568;
}

.audio-player audio {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background: #4299e1;
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #4a5568;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#currentTime, #duration {
    color: #a0aec0;
    font-size: 0.9rem;
    min-width: 40px;
}

.editor-tools {
    width: 400px;
    padding: 20px;
    overflow-y: auto;
    background: #2d3748;
}

.tool-section {
    background: #1a202c;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #4a5568;
}

.tool-section h4 {
    margin: 0 0 15px 0;
    color: #e2e8f0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.effect-control {
    margin-bottom: 15px;
}

.effect-control label {
    display: block;
    margin-bottom: 5px;
    color: #a0aec0;
    font-size: 0.9rem;
}

.effect-slider {
    width: 100%;
    height: 6px;
    background: #4a5568;
    border-radius: 3px;
    outline: none;
    margin-bottom: 5px;
}

.effect-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.effect-slider::-webkit-slider-thumb:hover {
    background: #3182ce;
    transform: scale(1.1);
}

.effect-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.effect-slider::-moz-range-thumb:hover {
    background: #3182ce;
    transform: scale(1.1);
}

.effect-control span {
    color: #4299e1;
    font-weight: 600;
    font-size: 0.9rem;
}

.effect-checkbox {
    margin-bottom: 12px;
}

.effect-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #a0aec0;
    cursor: pointer;
    transition: color 0.3s ease;
}

.effect-checkbox label:hover {
    color: #e2e8f0;
}

.effect-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: #4a5568;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.effect-checkbox input[type="checkbox"]:checked + .checkmark {
    background: #4299e1;
}

.effect-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.music-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.music-select, .format-select {
    width: 100%;
    padding: 10px;
    background: #4a5568;
    border: 1px solid #718096;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.music-select:focus, .format-select:focus {
    outline: none;
    border-color: #4299e1;
}

.available-music-list {
    display: none;
}

.available-music-list label {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: block;
}

.music-volume {
    margin-top: 10px;
}

.music-preview-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.small-btn {
    background: #4a5568;
    border: none;
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.small-btn:hover {
    background: #5a6578;
    transform: translateY(-1px);
}

.export-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-controls label {
    color: #a0aec0;
    font-size: 0.9rem;
}

.editor-footer {
    background: #1a202c;
    padding: 20px;
    border-top: 1px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-status {
    color: #a0aec0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-success {
    color: #48bb78;
}

.status-error {
    color: #e53e3e;
}

.status-processing {
    color: #4299e1;
}

.status-info {
    color: #a0aec0;
}

.editor-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-btn.primary {
    background: #4299e1;
    color: white;
}

.editor-btn.primary:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.editor-btn.success {
    background: #48bb78;
    color: white;
}

.editor-btn.success:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.editor-btn.secondary {
    background: #4a5568;
    color: #e2e8f0;
}

.editor-btn.secondary:hover {
    background: #5a6578;
    transform: translateY(-2px);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.audio-editor-modal {
    animation: fadeIn 0.3s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .editor-body {
        flex-direction: column;
        max-height: none;
    }
    
    .editor-tools {
        width: 100%;
        max-height: 300px;
    }
    
    .editor-preview {
        border-right: none;
        border-bottom: 1px solid #4a5568;
    }
    
    .audio-editor-modal {
        width: 98%;
        height: 95vh;
    }
}

/* Специальные эффекты для слайдеров */
.effect-slider.volume::-webkit-slider-thumb {
    background: #48bb78;
}

.effect-slider.speed::-webkit-slider-thumb {
    background: #ed8936;
}

.effect-slider.bass::-webkit-slider-thumb {
    background: #9f7aea;
}

.effect-slider.treble::-webkit-slider-thumb {
    background: #f56565;
}

.effect-slider.pitch::-webkit-slider-thumb {
    background: #4299e1;
}

/* Индикаторы состояния */
.loading-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #4a5568;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Улучшенные тултипы */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a202c;
    color: #e2e8f0;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    border: 1px solid #4a5568;
}