/* --- Core Eye-Care Design System --- */
:root {
    --bg-page: #F5F0E8;           /* Warm Sand (eye-care background) */
    --bg-card: #FFF8F0;           /* Soft Ivory (card background) */
    --bg-sidebar: #EDE6DA;        /* Warm Beige (sidebar background) */
    --text-main: #3D3929;         /* Dark Bronze (readable, non-harsh text) */
    --text-muted: #6B6456;        /* Medium Taupe (secondary text) */
    --border-color: #D6CFC0;      /* Gentle Clay (subtle borders) */
    
    --primary-color: #B8860B;     /* Dark Goldenrod */
    --primary-light: #E8C170;
    --primary-hover: #9B700A;
    --primary-gradient: linear-gradient(135deg, #B8860B, #D4A574);
    
    --bg-ai-tag: #E8D5B7;         /* Warm Gold for AI shots */
    --text-ai-tag: #785A28;
    --bg-narr-tag: #D5E8D4;       /* Soft Sage for Narration */
    --text-narr-tag: #274E13;
    
    --shadow-soft: 0 4px 12px rgba(139, 119, 90, 0.08);
    --shadow-hover: 0 8px 24px rgba(139, 119, 90, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

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

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: 'Inter', 'Noto Serif SC', serif;
    font-size: 16px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Layout Elements --- */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 8px;
}

.app-logo .logo-icon {
    font-size: 24px;
}

.app-logo .logo-text {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--text-main);
}

.app-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 24px auto;
    padding: 0 24px;
}

.app-footer {
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* --- UI Cards & Utilities --- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.section-title {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
    display: inline-block;
}

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

.mt-4 {
    margin-top: 16px;
}

.text-muted {
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.2);
}

.btn-secondary {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #E2DACF;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: rgba(184, 134, 11, 0.08);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-main);
}

.btn-ghost:hover {
    background-color: rgba(61, 57, 41, 0.05);
}

.btn-tiny {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* --- Form Fields --- */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

input[type="text"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #FCF9F5;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}

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

textarea {
    resize: vertical;
    line-height: 1.8;
}

.read-only-textarea {
    background-color: #EFEBE4;
    cursor: default;
}

/* --- Slider & Info Tags --- */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

input[type="range"] {
    accent-color: var(--primary-color);
    cursor: pointer;
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.tip, .sub-tip {
    font-style: italic;
}

.sub-tip {
    font-size: 12px;
    color: var(--text-muted);
}

.badge {
    background-color: var(--bg-sidebar);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* --- Index Page Layout --- */
.index-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 580px;
    overflow-y: auto;
    padding-right: 4px;
}

.project-item {
    background-color: #FFFDFB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.project-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.project-item-title {
    font-family: 'Noto Serif SC', serif;
    font-weight: 600;
    margin-bottom: 6px;
}

.project-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    align-items: center;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 0;
}

/* --- Workspace Layout --- */
.workspace-layout {
    display: grid;
    grid-template-columns: 280px 1fr 380px;
    gap: 20px;
    height: calc(100vh - 170px);
    overflow: hidden;
    margin-bottom: 60px;
}

.sidebar {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-card);
}

.sidebar-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.sidebar-header h3 {
    font-family: 'Noto Serif SC', serif;
}

.sidebar-header .sub-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* Character sidebar cards */
.character-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.character-card {
    background-color: #FFFDFB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.character-card:hover, .character-card.active {
    border-color: var(--primary-color);
    background-color: #FCF7EE;
}

.char-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 4px;
}

.char-en-name {
    font-size: 13px;
    color: var(--text-muted);
}

.char-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.char-description-excerpt {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Middle Timeline view */
.timeline-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.timeline-header h3 {
    font-family: 'Noto Serif SC', serif;
}

.stat-tag {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.ai-tag {
    background-color: var(--bg-ai-tag);
    color: var(--text-ai-tag);
}

.narration-tag {
    background-color: var(--bg-narr-tag);
    color: var(--text-narr-tag);
}

.timeline-visual-container {
    margin-bottom: 20px;
}

.timeline-track {
    display: flex;
    height: 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
}

.timeline-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.timeline-segment.ai-segment {
    background-color: var(--primary-light);
    color: var(--text-ai-tag);
}

.timeline-segment.narration-segment {
    background-color: #A3CFB4;
    color: var(--text-narr-tag);
}

.shots-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.shot-card {
    background-color: #FFFDFB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    border-left: 6px solid var(--border-color);
}

.shot-card:hover, .shot-card.active {
    transform: translateX(2px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-soft);
}

.shot-card.shot-ai {
    border-left-color: var(--primary-light);
}

.shot-card.shot-narration {
    border-left-color: #A3CFB4;
}

.shot-card-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.shot-num {
    font-weight: 700;
    color: var(--text-main);
}

.shot-type-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.shot-duration-badge {
    margin-left: auto;
    font-size: 12px;
    background-color: var(--bg-page);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.shot-source-text {
    font-style: italic;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-family: 'Noto Serif SC', serif;
}

.shot-visual-desc {
    font-size: 15px;
    font-weight: 500;
}

/* Detail Editor Column */
.editor-sidebar {
    position: relative;
}

.editor-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 32px;
}

.editor-empty-state .icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.editor-form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

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

.editor-header h3 {
    font-family: 'Noto Serif SC', serif;
}

.shot-type-label {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--bg-sidebar);
}

.appearance-locks-group {
    background-color: #FAF4EB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.appearance-locks-group h4 {
    font-size: 14px;
    font-family: 'Noto Serif SC', serif;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 6px;
}

.prompt-box-wrapper {
    background-color: #FFFDFB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 6px;
}

.prompt-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.prompt-box {
    font-family: 'Inter', monospace;
    font-size: 13px;
    background-color: #FAF6F0;
    padding: 10px;
    border-radius: 4px;
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid #EAE3D4;
    word-break: break-word;
    line-height: 1.5;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.action-buttons button {
    flex: 1;
}

/* Workspace Footer */
.workspace-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 52px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 90;
    font-size: 14px;
}

.footer-stats {
    display: flex;
    gap: 16px;
    color: var(--text-main);
}

.export-actions {
    display: flex;
    gap: 12px;
}

.hidden {
    display: none !important;
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(61, 57, 41, 0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
}

.modal-title {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 8px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* Export options grid */
.export-options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-option-card {
    background-color: #FFFDFB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-option-card:hover {
    border-color: var(--primary-color);
    background-color: #FCF7EE;
}

.export-option-card .icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.export-option-card h4 {
    font-family: 'Noto Serif SC', serif;
    font-weight: 600;
}

.export-option-card p {
    font-size: 12px;
    color: var(--text-muted);
}
