/* =====================================================
   AI STUDIO - STYLES
   Вынесено из ai-studio.html
   ===================================================== */

/* Встроенные стили для быстрого старта */
:root {
    --bg-dark: #0f0f1a;
    --bg-card: rgba(255,255,255,0.05);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #ffffff;
    --text-muted: #9ca3af;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 50%, #16213e 100%);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.studio-header {
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139,92,246,0.2);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}
.back-btn:hover { background: var(--bg-card); color: var(--text); }

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    font-size: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo-text {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo-badge {
    background: var(--primary);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* НОВЫЕ КНОПКИ - Правила и Настройки API */
.header-buttons {
    display: flex;
    gap: 10px;
}
.btn-rules {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-rules:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(239,68,68,0.4);
}
.btn-settings-api {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-settings-api:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(59,130,246,0.4);
}

/* Limits Display */
.limits-display {
    display: flex;
    gap: 16px;
}
.limit-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 14px;
}
.limit-item.limit-warning { border: 1px solid var(--warning); }

/* Header Right */
.header-right { display: flex; align-items: center; gap: 16px; }

.credits-display {
    background: linear-gradient(135deg, #10b981, #059669);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: help;
}

.lang-switcher { display: flex; gap: 4px; }
.lang-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-btn:hover, .lang-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.wallet-info {
    text-align: right;
    font-size: 12px;
}
.wallet-address { color: var(--text-muted); }
.user-level { color: var(--warning); font-weight: 600; }

/* Trial Banner */
.trial-banner {
    background: linear-gradient(90deg, var(--warning), #f97316);
    color: white;
    padding: 12px 24px;
    text-align: center;
    font-size: 14px;
}
.trial-banner a { color: white; font-weight: 600; margin-left: 16px; }

/* Content Tabs */
.content-tabs {
    display: flex;
    gap: 8px;
    padding: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
    min-width: 100px;
}
.tab-btn:hover { transform: translateY(-2px); border-color: var(--primary); }
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    border-color: transparent;
}
.tab-btn.disabled { opacity: 0.5; cursor: not-allowed; }
.tab-icon { font-size: 28px; }
.tab-name { font-weight: 600; }
.coming-soon {
    font-size: 10px;
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Main Content */
.studio-main {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    gap: 24px;
    padding: 0 24px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .studio-main { grid-template-columns: 1fr; }
    .templates-panel, .right-panel { display: none; }
}

/* Panels */
.templates-panel, .archive-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.templates-panel h3, .archive-panel h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.template-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.template-item:hover { background: rgba(139,92,246,0.2); }
.template-icon { font-size: 20px; }

/* Music Categories */
.music-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.category-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.category-btn:hover { background: rgba(139,92,246,0.3); color: var(--text); }
.category-btn.active { background: var(--primary); color: white; }

.music-item {
    position: relative;
}
.music-item .play-icon {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-muted);
}
.music-item.playing {
    background: rgba(139,92,246,0.3);
    border: 1px solid var(--primary);
}
.music-item.playing .play-icon {
    color: var(--primary);
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Project Panel */
.project-panel {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 16px;
}
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.project-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.project-counter {
    background: var(--primary);
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.btn-icon:hover { opacity: 1; }

.project-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.project-empty {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}
.project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 14px;
}
.project-icon { font-size: 16px; }
.project-name { flex: 1; }
.project-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
}
.project-remove:hover { opacity: 1; }

.btn-full {
    width: 100%;
}
.template-name { font-size: 13px; }

/* Generation Area */
.generation-area { min-height: 500px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.generation-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
}

.generation-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.description {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-select, .form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-textarea { resize: vertical; min-height: 120px; }

.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    color: white;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(139,92,246,0.4); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover { border-color: var(--primary); }

.btn-generate {
    width: 100%;
    padding: 18px;
    font-size: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results */
.result-area {
    margin-top: 24px;
    padding: 24px;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
}

.result-area h3 { margin-bottom: 16px; }

.result-content {
    white-space: pre-wrap;
    line-height: 1.8;
    padding: 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.image-preview img {
    max-width: 100%;
    border-radius: 12px;
}

.audio-player {
    width: 100%;
}
.audio-player audio { width: 100%; }

/* Archive */
.archive-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.filter-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

.archive-item {
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}
.archive-item:hover { background: rgba(139,92,246,0.2); }
.archive-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.archive-item-date { font-size: 11px; color: var(--text-muted); }
.archive-item-preview { font-size: 12px; color: var(--text-muted); }

.archive-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
}

/* Coming Soon */
.coming-soon-card {
    text-align: center;
    padding: 64px;
}
.coming-soon-icon { font-size: 64px; margin-bottom: 24px; }

/* Loading Modal */
.loading-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content { text-align: center; }

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(139,92,246,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.studio-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
}
.footer-links { margin-bottom: 8px; }
.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 12px;
}
.footer-links a:hover { color: var(--primary); }
.highlight { color: var(--primary); }

/* ====== МОДАЛЬНЫЕ ОКНА - НОВОЕ ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    display: block;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(139,92,246,0.3);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Rules List */
.rules-list {
    list-style: none;
}
.rules-list li {
    padding: 12px 16px;
    background: rgba(239,68,68,0.1);
    border-left: 3px solid #ef4444;
    margin-bottom: 8px;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
}
.rules-list li span {
    font-weight: 600;
    color: #ef4444;
}

/* API Settings */
.api-setting {
    background: rgba(255,255,255,0.05);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.api-setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.api-setting-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.api-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
}
.api-status.connected {
    background: rgba(16,185,129,0.2);
    color: #10b981;
}
.api-status.not-connected {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
}
.api-setting input {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}
.api-setting input:focus {
    outline: none;
    border-color: var(--primary);
}
.api-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}
.api-hint a {
    color: var(--primary);
}

/* Range слайдеры */
.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    outline: none;
    -webkit-appearance: none;
    margin-top: 8px;
}
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.2s;
}
.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

/* API Input Row с кнопкой очистки */
.api-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.api-input-row input {
    flex: 1;
}
.btn-clear-key {
    background: rgba(239,68,68,0.2);
    border: 1px solid rgba(239,68,68,0.3);
    color: #ef4444;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: none;
}
.btn-clear-key:hover {
    background: rgba(239,68,68,0.3);
    border-color: #ef4444;
}
.btn-clear-key.visible {
    display: block;
}

/* Кнопка тестирования голоса */
.btn-voice-test {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
}
.btn-voice-test:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(16,185,129,0.4);
}
.btn-voice-test:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-voice-test.loading {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* Музыкальная библиотека */
.music-category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}
.music-category:hover {
    background: rgba(139,92,246,0.2);
}
.music-category.active {
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
}
.music-track {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.music-track:hover {
    background: rgba(139,92,246,0.2);
    transform: translateX(4px);
}
.music-track.active {
    background: rgba(16,185,129,0.3);
    border: 1px solid #10b981;
}
.track-play {
    font-size: 16px;
}
.track-info {
    flex: 1;
    min-width: 0;
}
.track-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-duration {
    font-size: 11px;
    color: var(--text-muted);
}
