/* OmniScript - The Writer's Room Stylesheet */
:root {
    --bg-dark: #0a0d14;
    --bg-card: #121722;
    --bg-card-hover: #171e2c;
    --bg-input: #0e121a;
    --border: #232b40;
    --border-highlight: #3b82f6;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --gold: #f59e0b;
    --gold-glow: rgba(245, 158, 11, 0.2);
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --purple: #a855f7;
    --emerald: #10b981;
    --rose: #f43f5e;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.app-header {
    background: rgba(18, 23, 34, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--gold-glow));
}

.logo-title {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--gold);
    letter-spacing: 0.5px;
    display: block;
    text-transform: uppercase;
}

.project-selector-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.project-dropdown {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

.btn-primary {
    background: #2563eb;
    color: white;
}
.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #1e293b;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: #334155;
    color: var(--text-primary);
}

.btn-doctor {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}
.btn-doctor:hover {
    background: #047857;
    transform: translateY(-1px);
}

.btn-omnistudio {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}
.btn-omnistudio:hover {
    background: #d97706;
    color: white;
    transform: translateY(-1px);
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-icon:hover {
    background: #1e293b;
    color: var(--text-primary);
}

.export-group {
    display: flex;
    gap: 0.4rem;
}

/* MAIN NAVIGATION */
.main-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
    flex: 1;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    color: var(--text-secondary);
}

.nav-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* TAB CONTENTS */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* STORY GRID */
.story-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.col-span-2 {
    grid-column: span 2;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

textarea, input[type="text"], input[type="number"], select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus, input[type="text"]:focus, input[type="number"]:focus, select:focus {
    border-color: var(--border-highlight);
}

.card-footer {
    display: flex;
    justify-content: flex-end;
    font-size: 0.75rem;
}
.card-footer-right {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* BADGES */
.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-gold { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* CHARACTERS */
.section-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.character-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    transition: transform 0.2s, border-color 0.2s;
}

.character-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.char-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.char-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #f8fafc;
}

.char-role {
    font-size: 0.8rem;
    color: var(--gold);
}

.char-voice-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    background: #1e293b;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #38bdf8;
}

.char-field {
    font-size: 0.82rem;
    line-height: 1.4;
}

.char-field-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.char-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* SCENE MASASI */
.act-filters {
    display: flex;
    gap: 0.4rem;
}

.act-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    font-weight: 500;
}

.act-btn.active {
    background: #1e293b;
    border-color: var(--gold);
    color: var(--gold);
}

.scene-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scene-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s;
}

.scene-card:hover {
    border-color: #475569;
}

.scene-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.6rem;
}

.scene-order-pill {
    background: #1e293b;
    color: var(--gold);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.scene-beat-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.scene-slugline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #38bdf8;
}

.scene-duration-badge {
    background: #0f172a;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--text-muted);
}

.emotion-shift-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #0c1017;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

.emotion-arrow {
    color: var(--gold);
    font-weight: 700;
}

.scene-dialogue-block {
    background: #090c12;
    border-left: 3px solid #3b82f6;
    padding: 0.6rem 0.9rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dialogue-speaker {
    font-weight: 700;
    color: #e2e8f0;
}
.dialogue-emotion {
    font-style: italic;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.dialogue-text {
    color: #cbd5e1;
    line-height: 1.4;
}

.scene-footer-hints {
    display: flex;
    gap: 1.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
}

/* MODAL */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-lg {
    max-width: 820px;
}

.doctor-modal-card {
    max-width: 720px;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.modal-close:hover { color: white; }

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-footer {
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.w-80 { width: 80px; }
.mt-3 { margin-top: 0.75rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* DIALOGUE LINES EDITOR */
.dialogue-lines-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.dialogue-line-row {
    display: grid;
    grid-template-columns: 140px 120px 1fr 36px;
    gap: 0.5rem;
    align-items: center;
}

/* SCRIPT DOCTOR STYLES */
.score-summary-box {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: #0d121c;
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 10px;
}

.gauge-wrap {
    text-align: center;
    min-width: 120px;
}

.score-number {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.score-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.score-bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
}

.score-bar-label {
    width: 130px;
    color: var(--text-secondary);
}

.score-bar-track {
    flex: 1;
    height: 8px;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background: #10b981;
    border-radius: 4px;
}

.issues-list, .recs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.issue-item {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    padding: 0.6rem 0.8rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
}

.rec-item {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid #10b981;
    padding: 0.6rem 0.8rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e293b;
    color: white;
    border: 1px solid #3b82f6;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 2000;
    transition: opacity 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    .header-left, .header-right {
        justify-content: space-between;
    }
    .story-grid {
        grid-template-columns: 1fr;
    }
    .col-span-2 {
        grid-column: span 1;
    }
    .character-grid {
        grid-template-columns: 1fr;
    }
    .score-summary-box {
        flex-direction: column;
    }
    .dialogue-line-row {
        grid-template-columns: 1fr;
    }
}
