/* Ai Media Prompt Builder Premium Style System */

:root {
    /* Color Palette */
    --bg-main: #0b0f19;
    --bg-sidebar: rgba(13, 20, 35, 0.7);
    --bg-card: rgba(22, 30, 49, 0.5);
    --bg-card-hover: rgba(26, 36, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-blue: #00d4ff;
    --accent-violet: #8a2be2;
    --accent-glow: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
    
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    
    /* Tooltip & Modal Theme Variables (Dark Mode Default) */
    --tooltip-bg: rgba(18, 18, 28, 0.95);
    --tooltip-text: #f3f4f6;
    --tooltip-border: rgba(255, 255, 255, 0.15);
    --tooltip-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);

    --modal-bg: rgba(18, 18, 28, 0.85);
    --modal-border: rgba(255, 255, 255, 0.08);
    --modal-header-border: rgba(255, 255, 255, 0.08);
    
    /* Layout Sizes */
    --sidebar-width: 320px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradients */
.glow-bg-1, .glow-bg-2 {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
}

.glow-bg-1 {
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
}

.glow-bg-2 {
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    background-color: var(--bg-main);
}

@media (min-width: 1601px) {
    .app-container {
        border-left: 1px solid var(--border-color);
        border-right: 1px solid var(--border-color);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.35);
    }
}

/* Mobile Sidebar Drawer Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 1.25rem;
    background: var(--accent-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.empty-history {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 0.9rem;
}

.history-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    position: relative;
    transition: all var(--transition-fast);
}

.history-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.history-tag.tag-image {
    background: rgba(138, 43, 226, 0.15);
    color: #c084fc;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.history-tag.tag-video {
    background: rgba(0, 212, 255, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.history-lang-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.history-card-actions {
    display: flex;
    gap: 8px;
}

.history-card-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-all;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.main-content-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* App Header */
.app-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.open-sidebar-btn {
    display: inline-flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    background: rgba(13, 20, 35, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--accent-blue);
    border-radius: 30px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.open-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.close-sidebar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.close-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.logo {
    display: flex;
    gap: 4px;
}

.logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.logo-dot.blue { background-color: #4285F4; }
.logo-dot.red { background-color: #EA4335; }
.logo-dot.yellow { background-color: #FBBC05; }
.logo-dot.green { background-color: #34A853; }

.app-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: var(--accent-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
}

/* Tabs */
.mode-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: var(--radius-lg);
    width: fit-content;
    margin-top: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: calc(var(--radius-lg) - 4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-glow);
    color: #fff;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

/* Configuration Panels */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mode-configs {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mode-configs.hidden {
    display: none;
}

.config-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.config-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* --- Beginner Quick Routine Focus & Dimming (Dynamic Activation) --- */
.narrative-active-routine .mode-configs .config-card:not(.beginner-focus-card) {
    opacity: 0.65;
    transition: opacity 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.narrative-active-routine .mode-configs .config-card:not(.beginner-focus-card):hover,
.narrative-active-routine .mode-configs .config-card:not(.beginner-focus-card):focus-within {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.config-card.beginner-focus-card {
    opacity: 1 !important;
    border: 2px solid var(--accent-blue) !important;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.25), inset 0 0 10px rgba(0, 212, 255, 0.05) !important;
    position: relative;
}

.config-card.beginner-focus-card:hover {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 28px rgba(0, 212, 255, 0.35) !important;
    transform: translateY(-2px);
}

.header-badge-quick {
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    padding: 3px 10px !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    letter-spacing: -0.01em !important;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.22), rgba(168, 85, 247, 0.22)) !important;
    border: 1px solid rgba(0, 212, 255, 0.5) !important;
    color: #00d4ff !important;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2) !important;
    animation: pulseQuickBadge 3s infinite alternate;
}

.btn-jump-to-style {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-jump-to-style:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.45);
    background: linear-gradient(135deg, #0284c7, #7c3aed);
}

.btn-jump-to-canvas {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-jump-to-canvas:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
    background: linear-gradient(135deg, #059669, #0284c7);
}

@keyframes pulseQuickBadge {
    0% {
        box-shadow: 0 0 8px rgba(0, 212, 255, 0.2);
        border-color: rgba(0, 212, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 16px rgba(0, 212, 255, 0.45);
        border-color: rgba(0, 212, 255, 0.8);
    }
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    position: relative;
    padding-right: 36px;
    cursor: pointer;
    user-select: none;
    transition: margin-bottom var(--transition-normal);
}

.card-header::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: transform var(--transition-normal), color var(--transition-fast);
}

.card-header:hover::after {
    color: var(--accent-blue);
}

/* Collapsed State */
.config-card.collapsed .card-header {
    margin-bottom: 0;
}

.config-card.collapsed .card-body {
    display: none;
}

.config-card.collapsed .card-header::after {
    transform: translateY(-50%) rotate(-90deg);
}

.step-num {
    background: var(--accent-glow);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.4);
}

.card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Subject Card Details */
.subject-card textarea {
    width: 100%;
    min-height: 100px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 16px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.subject-card textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.input-tip {
    display: block;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.input-tip i {
    margin-right: 4px;
}

.input-tip.safety-notice {
    color: rgba(234, 179, 8, 0.7);
    background: rgba(234, 179, 8, 0.05);
    border: 1px solid rgba(234, 179, 8, 0.12);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    line-height: 1.4;
}

.input-tip.safety-notice i {
    color: rgba(234, 179, 8, 0.8);
}

/* Style Grid */
.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.style-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
}

.style-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.style-card.selected {
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.04);
}

.style-card.disabled,
.config-card.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
    cursor: not-allowed;
}


.style-thumbnail {
    width: 100%;
    height: 110px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: rgba(255, 255, 255, 0.05);
    transition: transform var(--transition-normal);
}

.style-card:hover .style-thumbnail {
    transform: scale(1.05);
}

.style-card.selected .style-thumbnail::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0b0f19;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f00c";
    font-size: 0.75rem;
}

.style-name {
    padding: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-secondary);
}

.style-card.selected .style-name {
    color: var(--accent-blue);
}

/* Chip Groups */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
    color: var(--text-primary);
    transform: scale(1.03);
}

.chip.selected {
    background: var(--accent-glow);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 10px rgba(138, 43, 226, 0.25);
}

.chip.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}


/* Aspect Ratio Custom Group */
.ratio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.ratio-btn {
    cursor: pointer;
    flex: 1;
    min-width: 120px;
    position: relative;
}

.ratio-btn input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.ratio-box {
    display: block;
    height: 60px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    position: relative;
    transition: all var(--transition-fast);
}

.ratio-box::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: all var(--transition-fast);
}

/* Aspect Ratio Box Proportions */
.ratio-1-1::before { width: 30px; height: 30px; }
.ratio-16-9::before { width: 44px; height: 25px; }
.ratio-9-16::before { width: 25px; height: 44px; }
.ratio-4-3::before { width: 36px; height: 27px; }
.ratio-3-2::before { width: 39px; height: 26px; }

.ratio-btn:hover .ratio-box {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

.ratio-btn input:checked + .ratio-box {
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.ratio-btn input:checked + .ratio-box::before {
    background: var(--accent-blue);
    border-color: transparent;
}

.ratio-label {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.ratio-btn input:checked ~ .ratio-label {
    color: var(--accent-blue);
    font-weight: 600;
}

/* Selected Options Summary Section */
.selected-summary-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.summary-header h3 i {
    color: var(--accent-blue);
}

.selected-summary-card {
    background: linear-gradient(135deg, rgba(26, 36, 59, 0.4) 0%, rgba(13, 20, 35, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    min-height: 60px;
}

.selected-badges-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Badge Styling */
.selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    transition: all var(--transition-fast) ease;
    cursor: default;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.selected-badge:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Color codes/variations depending on category */
.selected-badge[data-category="style"] {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.08);
}
.selected-badge[data-category="equipment"] {
    border-color: rgba(168, 85, 247, 0.3);
    background: rgba(168, 85, 247, 0.08);
}
.selected-badge[data-category="camera"] {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.08);
}
.selected-badge[data-category="lighting"] {
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.08);
}
.selected-badge[data-category="physics"] {
    border-color: rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.08);
}
.selected-badge[data-category="custom"] {
    border-color: rgba(14, 165, 233, 0.3);
    background: rgba(14, 165, 233, 0.08);
}
.selected-badge[data-category="color"] {
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(249, 115, 22, 0.08);
}
.selected-badge[data-category="audio"] {
    border-color: rgba(20, 184, 166, 0.3);
    background: rgba(20, 184, 166, 0.08);
}
.selected-badge[data-category="ratio"] {
    border-color: rgba(100, 116, 139, 0.3);
    background: rgba(100, 116, 139, 0.08);
}

.badge-weight-ctrl {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-left: 6px;
    padding: 2px 4px;
}

.weight-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
    font-size: 0.85rem;
    line-height: 1;
    transition: color 0.2s;
    outline: none;
}

.weight-btn:hover {
    color: var(--accent-blue);
}

.weight-val {
    font-size: 0.8rem;
    min-width: 20px;
    text-align: center;
    font-family: 'Inter', monospace;
    color: rgba(255, 255, 255, 0.9);
}

.selected-badge .badge-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    margin-left: 2px;
}

.selected-badge .badge-remove-btn:hover {
    background: rgba(239, 68, 68, 0.8);
    color: #fff;
    transform: rotate(90deg);
}

.selected-badge-empty {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 6px 0;
}

/* Prompt Canvas Section */
.prompt-canvas-section {
    background: linear-gradient(135deg, rgba(26, 36, 59, 0.6) 0%, rgba(13, 20, 35, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.prompt-canvas-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-glow);
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.canvas-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.canvas-header h3 i {
    color: var(--accent-blue);
}

.canvas-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.canvas-container.dual-canvas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .canvas-container.dual-canvas {
        grid-template-columns: 1fr;
    }
}

.canvas-half {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.canvas-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.canvas-textarea-wrapper {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.canvas-textarea-wrapper::after {
    content: '';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    animation: pulse 2s infinite;
    pointer-events: none;
    z-index: 5;
}

.negative-half .canvas-textarea-wrapper::after {
    top: 18px;
    right: 85px;
    background: radial-gradient(circle, var(--color-danger) 0%, transparent 70%);
}

#promptOutput, #negativePromptOutput {
    width: 100%;
    flex-grow: 1;
    min-height: 60px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 16px 36px 16px 20px;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all var(--transition-fast);
}

#negativePromptOutput {
    border: 1px solid rgba(239, 68, 68, 0.15);
    padding: 16px 85px 16px 20px;
}

#promptOutput::placeholder, #negativePromptOutput::placeholder {
    color: var(--text-muted);
}

.canvas-buttons {
    display: flex;
    gap: 14px;
}

/* General Buttons */
.btn {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
    flex: 1;
}

.btn-primary {
    background: var(--accent-glow);
    color: #fff;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(138, 43, 226, 0.45);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: var(--color-success);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* History Card Utility */
.btn-trash {
    color: var(--text-muted);
}
.btn-trash:hover {
    color: var(--color-danger);
}
.btn-copy-history {
    color: var(--text-muted);
}
.btn-copy-history:hover {
    color: var(--accent-blue);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(13, 20, 35, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent-blue);
    color: #fff;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 999;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Keyframes */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0.5; }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .app-container {
        /* sidebar is fixed, so main-content naturally spans full width */
    }
    
    .history-list {
        max-height: none;
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        white-space: normal;
    }
    
    .history-card {
        display: block;
        width: 100%;
        flex-shrink: initial;
    }
    

    .main-content {
        padding: 24px;
        width: 100%;
    }
}


@media (max-width: 768px) {
    .translation-settings-row {
        flex-direction: column;
        align-items: stretch;
    }
    .translation-engine-select {
        justify-content: space-between;
    }
}

/* Language Selector Dropdown */
.language-dropdown-wrapper {
    position: relative;
    z-index: 1000;
    margin-top: 12px;
}

.language-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.language-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.language-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 140px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.15s ease-out;
}

.language-dropdown-menu.show {
    display: flex;
}

.lang-option {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.lang-option.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    font-weight: 600;
}

@media (max-width: 768px) {
    .brand {
        flex-direction: column;
        gap: 16px;
    }
    .language-dropdown-wrapper {
        margin-top: 8px;
    }
}

@media (max-width: 640px) {
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ratio-group {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .canvas-buttons {
        flex-direction: column;
    }
}

/* --- 8-Part Framework New Styles --- */
.form-control-text {
    width: 100%;
    min-height: 42px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    outline: none;
    resize: none;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    box-sizing: border-box;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), height 0.1s ease;
}

.form-control-text:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.color-presets-wrapper {
    display: flex;
    flex-direction: column;
}

.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.color-swatch-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    outline: none;
}

.color-swatch-btn:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.color-swatch-btn.selected {
    transform: scale(1.15);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px var(--accent-blue);
}

.color-swatch-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    background-color: #0b0f19;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.color-swatch-btn.selected::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Margin utilities */
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }

/* Template buttons layout */
.template-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.template-btn {
    border: 1px solid rgba(0, 212, 255, 0.15) !important;
    background: rgba(0, 212, 255, 0.03) !important;
    color: var(--text-primary) !important;
    transition: all var(--transition-normal) !important;
    padding: 12px 18px !important;
    font-size: 0.9rem !important;
    text-align: left;
}

.template-btn:hover {
    border-color: var(--accent-blue) !important;
    background: rgba(0, 212, 255, 0.08) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

/* Audio Preset Chips customization */
.chip-audio {
    border-color: rgba(16, 185, 129, 0.15) !important;
    background: rgba(16, 185, 129, 0.02) !important;
}

.chip-audio:hover {
    border-color: var(--color-success) !important;
    background: rgba(16, 185, 129, 0.06) !important;
    color: var(--color-success) !important;
}

.chip-audio.selected {
    background: linear-gradient(135deg, var(--color-success), #059669) !important;
    border-color: transparent !important;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.25) !important;
    color: #fff !important;
}

/* Realism Guard Switch styles */
.realism-guard-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.checkbox-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.checkbox-toggle input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 11px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.checkbox-toggle input:checked + .toggle-slider {
    background: var(--accent-glow);
    border-color: transparent;
}

.checkbox-toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background-color: #fff;
}

.toggle-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content.glassmorphic {
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateY(20px);
    transition: transform 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
    color: var(--text-primary);
}

.modal.show .modal-content.glassmorphic {
    transform: translateY(0);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--modal-header-border);
    padding-top: 16px;
}

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

.macro-form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.macro-form-group label span {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: normal;
}

/* Premium Glassmorphic Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--tooltip-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--tooltip-border);
    color: var(--tooltip-text);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    white-space: normal;
    min-width: 180px;
    max-width: 290px;
    opacity: 0;
    pointer-events: none;
    box-shadow: var(--tooltip-shadow);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    z-index: 9999;
}

/* Tooltip Arrow */
[data-tooltip]::before {
    content: "";
    position: absolute;
    bottom: 118%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--tooltip-bg) transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
    z-index: 9999;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Adjust tooltip position for style-card elements to prevent clipping */
.style-card[data-tooltip]::after {
    bottom: auto;
    top: 105%;
    transform: translateX(-50%) translateY(-8px);
}
.style-card[data-tooltip]::before {
    bottom: auto;
    top: 98%;
    transform: translateX(-50%) translateY(-8px);
    border-width: 0 6px 6px;
    border-color: transparent transparent var(--tooltip-bg);
}
.style-card[data-tooltip]:hover::after,
.style-card[data-tooltip]:hover::before {
    transform: translateX(-50%) translateY(0);
}

/* Adjust tooltip position for resetBtn to prevent clipping by overflow: hidden on prompt-canvas-section */
#resetBtn[data-tooltip]::after {
    bottom: auto;
    top: 130%;
    left: auto;
    right: 0;
    transform: translateY(-8px);
    min-width: auto;
    white-space: nowrap;
}
#resetBtn[data-tooltip]::before {
    bottom: auto;
    top: 118%;
    left: auto;
    right: 12px;
    transform: translateY(-8px);
    border-width: 0 6px 6px;
    border-color: transparent transparent var(--tooltip-bg);
}
#resetBtn[data-tooltip]:hover::after,
#resetBtn[data-tooltip]:hover::before {
    transform: translateY(0);
}

/* --- 5W1H Narrative Guide & Subject Detail Styles --- */

/* Narrative Guide Card */
.narrative-guide-card {
    position: relative;
    border: 1px solid rgba(0, 212, 255, 0.12);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.03), rgba(138, 43, 226, 0.03));
}

.narrative-guide-card:hover {
    border-color: rgba(0, 212, 255, 0.2);
}

.narrative-guide-card .card-header {
    margin-bottom: 0;
}

.narrative-guide-card .card-header h3 {
    flex: 1;
}


/* Narrative Grid (6 fields in 2x3) */
.narrative-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Individual Narrative Field */
.narrative-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.narrative-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.narrative-field label .field-icon {
    font-size: 1rem;
}

.narrative-field label .field-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
}

.narrative-field input.form-control-text {
    padding: 10px 14px;
    font-size: 0.9rem;
}

/* Auto-distribute button row */
.narrative-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.narrative-auto-btn {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(138, 43, 226, 0.1));
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: var(--accent-blue);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.narrative-auto-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(138, 43, 226, 0.2));
    border-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
    transform: translateY(-1px);
}

.narrative-auto-btn:active {
    transform: translateY(0);
}

.narrative-clear-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.narrative-clear-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

/* Subject Detail Sub-fields Grid (2x2) */
.subject-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.subject-detail-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subject-detail-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.subject-detail-field label .field-icon {
    font-size: 0.95rem;
}

.subject-detail-field input.form-control-text {
    padding: 10px 14px;
    font-size: 0.88rem;
}

/* Narrative step badge */
.narrative-step-badge {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.03em;
}

/* Responsive: 1-column for mobile */
@media (max-width: 640px) {
    .narrative-grid {
        grid-template-columns: 1fr;
    }
    .subject-detail-grid {
        grid-template-columns: 1fr;
    }
    .narrative-actions {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }
    .narrative-actions button,
    .narrative-actions .narrative-auto-btn,
    .narrative-actions .narrative-translate-btn,
    .narrative-actions .narrative-clear-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        font-size: 0.8rem !important;
        padding: 8px 12px !important;
    }
}

/* Margin utility */
.mt-1 { margin-top: 4px; }

/* VeoPT v2.0 Premium Additions */

/* Option Conflict Warning Badge & Pulse Animation */
.conflict-badge {
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* Recipe Title Input in History Card */
.recipe-title-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 4px;
    margin-bottom: 6px;
    outline: none;
    transition: border-bottom-color var(--transition-fast);
}
.recipe-title-input:focus {
    border-bottom: 1px solid var(--accent-blue);
}

/* Reverse Prompt Button styling */
.reverse-btn {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(0, 212, 255, 0.15));
    border: 1px solid rgba(0, 212, 255, 0.35) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
    transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.reverse-btn:hover {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.35), rgba(0, 212, 255, 0.35));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.25);
    border-color: var(--accent-blue) !important;
}

/* ====================================
   VeoPT v3.0 - Mode Tabs + Engine Controls
   ==================================== */

/* Mode Tabs Container */
.mode-tabs-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.mode-tabs-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Engine Controls Row (Weight Mode + Reverse Button) */
.engine-controls-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
}

/* Weight Mode Control */
.weight-mode-control {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.weight-mode-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.weight-mode-label i {
    color: var(--accent-blue);
}

.weight-mode-toggles {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.weight-toggle-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    position: relative;
}

.weight-toggle-card i {
    font-size: 0.9rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.weight-toggle-card:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.weight-toggle-card:hover i {
    opacity: 1;
}

.weight-toggle-card.active {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(0, 212, 255, 0.15));
    border-color: rgba(0, 212, 255, 0.4);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 212, 255, 0.15);
}

.weight-toggle-card.active i {
    color: var(--accent-blue);
    opacity: 1;
}

/* Weight Badge ("권장" tag) */
.weight-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--accent-glow);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0.03em;
}

/* Reverse Toggle Button (header level) */
.reverse-toggle-btn {
    flex: none !important;
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
    border-radius: 24px !important;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.12), rgba(0, 212, 255, 0.12)) !important;
    border: 1px solid rgba(0, 212, 255, 0.3) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--transition-fast) !important;
}

.reverse-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.3), rgba(0, 212, 255, 0.3)) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 3px 12px rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

.reverse-toggle-btn i {
    color: var(--accent-blue);
}

/* Inline Macro Wrapper (inside Step 1 cards) */
.inline-macro-wrapper {
    background: rgba(138, 43, 226, 0.04);
    border: 1px dashed rgba(138, 43, 226, 0.2);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.inline-macro-wrapper .template-buttons-grid {
    margin-top: 8px;
}

.inline-macro-wrapper .template-btn {
    font-size: 0.85rem;
    padding: 8px 14px;
}

/* ====================================
   VeoPT v3.0 - Mobile Responsive
   ==================================== */

@media (max-width: 1024px) {
    .engine-controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .weight-mode-control {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .weight-mode-toggles {
        width: 100%;
    }

    .weight-toggle-card {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }

    .reverse-toggle-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .weight-toggle-card {
        font-size: 0.78rem;
        padding: 8px 10px;
    }

    .weight-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .reverse-toggle-btn {
        font-size: 0.78rem !important;
        padding: 8px 12px !important;
    }
}

/* ====================================
   VeoPT v3.0 - Auto-Translation Styles
   ==================================== */

.translation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.translation-card:hover {
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.05);
}

.translation-settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.translation-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.translation-desc i {
    color: var(--accent-blue);
}

.translation-engine-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.translation-engine-select label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.form-control-select {
    background: rgba(13, 20, 35, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    outline: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.form-control-select:focus {
    border-color: var(--accent-blue);
}

.api-key-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.api-key-input-row {
    display: flex;
    gap: 10px;
}

.api-key-input-row input {
    flex: 1;
    font-size: 0.85rem;
    padding: 8px 12px;
    height: 36px;
}

.api-key-input-row button {
    padding: 0 16px;
    font-size: 0.85rem;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.api-key-input-row button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Inline translate wrapper */
.translate-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.translate-input-wrapper textarea,
.translate-input-wrapper input {
    width: 100%;
    padding-right: 75px !important; /* Make room for the floating buttons */
    transition: background var(--transition-normal), border-color var(--transition-fast);
}

/* Actions Overlay inside inputs */
.translate-actions-overlay {
    position: absolute;
    right: 12px;
    top: 10px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

/* Textarea vs Input alignment */
.translate-input-wrapper textarea + .translate-actions-overlay {
    top: 10px;
    bottom: auto;
}

.translate-input-wrapper input + .translate-actions-overlay {
    top: 50%;
    transform: translateY(-50%);
}

.btn-inline-translate,
.btn-translate-undo {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.btn-inline-translate:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--accent-blue);
    transform: scale(1.1);
}

.btn-translate-undo {
    color: var(--color-success);
}

.btn-translate-undo:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
    transform: scale(1.1);
}

.btn-inline-translate.loading {
    pointer-events: none;
    color: var(--accent-blue);
    background: rgba(0, 212, 255, 0.05);
}

/* Shimmer Loading State on inputs */
.shimmer-loading {
    background: linear-gradient(
        90deg, 
        rgba(22, 30, 49, 0.5) 25%, 
        rgba(0, 212, 255, 0.08) 50%, 
        rgba(22, 30, 49, 0.5) 75%
    ) !important;
    background-size: 200% 100% !important;
    animation: shimmer 1.5s infinite linear !important;
    border-color: rgba(0, 212, 255, 0.3) !important;
}

/* Success Flash Effect */
.translation-success-flash {
    animation: success-flash 0.6s ease-out;
}

/* 5W1H narrative translate button */
.narrative-translate-btn {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(138, 43, 226, 0.12));
    border: 1px solid rgba(0, 212, 255, 0.25);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.narrative-translate-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(138, 43, 226, 0.25));
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0, 212, 255, 0.15);
}

.narrative-translate-btn.active-undo {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(52, 211, 153, 0.12));
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.narrative-translate-btn.active-undo:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(52, 211, 153, 0.25));
    border-color: #34d399;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.15);
}

/* Keyframes */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes success-flash {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    100% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
}

.spin {
    animation: spin 1s infinite linear;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .translation-settings-row {
        flex-direction: column;
        align-items: stretch;
    }
    .translation-engine-select {
        justify-content: space-between;
    }
}

/* Workspace Layout with Quick Navigation */
.workspace-layout {
    display: flex;
    gap: 32px;
    position: relative;
    width: 100%;
}

.workspace-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Quick Nav Container */
.quick-nav-container {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    position: sticky;
    top: 30px;
    z-index: 90;
    background: rgba(20, 20, 28, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.quick-nav-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quick-nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.quick-nav-item a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding-left: 15px;
}

.quick-nav-item.active a {
    background: rgba(138, 43, 226, 0.15);
    border-left-color: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 10px rgba(138, 43, 226, 0.1);
}

/* Quick Nav - Mobile styling */
@media (max-width: 1199px) {
    .workspace-layout {
        flex-direction: column;
        gap: 0;
    }
    
    .quick-nav-container {
        order: -1;
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(13, 13, 17, 0.9);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border: none;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        padding: 8px 16px;
        margin: -32px -40px 24px -40px; /* pull out of main-content padding */
        width: calc(100% + 80px); /* fill space */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }
    
    .quick-nav-title {
        display: none; /* Hide title on mobile */
    }
    
    .quick-nav-list {
        flex-direction: row;
        overflow-x: auto;
        scroll-behavior: smooth;
        scrollbar-width: none; /* Hide default scrollbar on Firefox */
        -ms-overflow-style: none; /* Hide default scrollbar on IE/Edge */
        padding: 4px 0;
        gap: 8px;
    }
    
    .quick-nav-list::-webkit-scrollbar {
        display: none; /* Hide scrollbar on Chrome/Safari */
    }
    
    .quick-nav-item {
        flex-shrink: 0;
    }
    
    .quick-nav-item a {
        padding: 6px 12px;
        border-radius: 20px;
        border-left: none;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.03);
    }
    
    .quick-nav-item a:hover {
        padding-left: 12px; /* disable padding stretch on mobile */
    }
    
    .quick-nav-item.active a {
        background: var(--accent-glow);
        border-color: var(--accent-blue);
        box-shadow: 0 2px 10px rgba(138, 43, 226, 0.25);
    }
}

@media (max-width: 1024px) {
    .quick-nav-container {
        margin: -32px -24px 24px -24px;
        width: calc(100% + 48px);
    }
}

@media (max-width: 640px) {
    .quick-nav-container {
        margin: -32px -20px 20px -20px;
        width: calc(100% + 40px);
    }
}

/* Ensure negative prompt textarea expands to fill canvas-textarea-wrapper */
.canvas-textarea-wrapper .translate-input-wrapper {
    height: 100%;
    align-items: stretch;
}

/* ============================================
   Scene Mode Tabs & Timeline UI
   ============================================ */

.scene-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 3px;
}

.scene-mode-tab {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scene-mode-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.scene-mode-tab.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.scene-basic-mode,
.scene-timeline-mode {
    transition: opacity 0.2s ease;
}

/* Timeline container */
.scene-timeline-mode {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scene-timeline-mode.hidden {
    display: none;
}

.scene-basic-mode.hidden {
    display: none;
}

#timelineContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.timeline-row:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.timeline-row:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.timeline-time {
    width: 64px;
    min-width: 64px;
    padding: 8px 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color var(--transition-fast);
}

.timeline-time:focus {
    border-color: var(--accent-cyan);
}

.timeline-text {
    flex: 1;
    min-height: 44px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    overflow: hidden;
    outline: none;
    transition: border-color var(--transition-fast);
}

.timeline-text:focus {
    border-color: var(--accent-blue);
}

.timeline-content-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-audio-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.timeline-audio-wrapper:focus-within {
    border-style: solid;
    border-color: var(--accent-purple);
    background: rgba(0, 0, 0, 0.35);
}

.timeline-audio-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--accent-purple);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-audio {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
}

.timeline-audio::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.timeline-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.timeline-interval-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

#timelineInterval {
    width: 48px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--accent-cyan);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    padding: 2px 0;
    outline: none;
    transition: border-color var(--transition-fast);
    -moz-appearance: textfield;
}

#timelineInterval::-webkit-outer-spin-button,
#timelineInterval::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#timelineInterval:focus {
    border-color: var(--accent-cyan);
}

.btn-timeline-add,
.btn-timeline-remove {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-timeline-add {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.25);
}

.btn-timeline-add:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--accent-blue);
}

.btn-timeline-remove {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-timeline-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--color-danger);
}

/* ============================================
   Auto-Expanding Textareas
   ============================================ */

/* All input textareas should auto-expand with content */
textarea.form-control-text,
textarea.auto-expand-input,
.subject-card textarea,
.config-card textarea:not(#promptOutput):not(#negativePromptOutput) {
    overflow: hidden;
    resize: none;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    box-sizing: border-box;
}

/* Prompt output textarea also auto-expands */
#promptOutput {
    overflow: hidden;
    height: auto;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* ============================================
   Responsive: Timeline on small screens
   ============================================ */

@media (max-width: 600px) {
    .timeline-row {
        flex-direction: column;
        gap: 6px;
    }

    .timeline-time {
        width: 100%;
        min-width: unset;
    }

    .timeline-range-container {
        width: 100%;
        min-width: unset;
        justify-content: center;
    }

    .scene-mode-tab {
        font-size: 0.78rem;
        padding: 6px 10px;
    }
}

/* Top Timeline Header Control Bar */
.timeline-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    flex-wrap: wrap;
}

.timeline-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-mode-selector .control-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.timeline-type-toggles {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.timeline-type-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-type-btn.active {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.35);
}

.timeline-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-interval-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-interval-box input {
    width: 44px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.82rem;
    text-align: center;
    outline: none;
}

.btn-apply-timeline-header {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(2, 132, 199, 0.35));
    border: 1px solid var(--accent-cyan);
    color: #fff;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-apply-timeline-header:hover {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.45);
}

.timeline-range-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    width: 130px;
    min-width: 130px;
}

.timeline-time-start,
.timeline-time-end {
    width: 50px;
    background: transparent;
    border: none;
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    padding: 6px 2px;
}

.timeline-time-separator {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    user-select: none;
}

.timeline-row.active-row {
    border-left: 4px solid var(--accent-cyan) !important;
    background: rgba(14, 118, 110, 0.15) !important;
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.1) inset;
}

/* ==========================================================================
   Light Theme (Pastel Blue) Overrides
   ========================================================================== */
[data-theme="light"] {
    --bg-main: #f0f6fc;
    --bg-sidebar: rgba(230, 240, 250, 0.8);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --border-color: rgba(0, 120, 215, 0.15);
    --border-hover: rgba(0, 120, 215, 0.3);
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-blue: #0284c7;
    --accent-violet: #7c3aed;
    --accent-glow: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));

    --tooltip-bg: #ffffff;
    --tooltip-text: #0f172a;
    --tooltip-border: rgba(2, 132, 199, 0.25);
    --tooltip-shadow: 0 10px 25px rgba(0, 40, 80, 0.15);

    --modal-bg: rgba(255, 255, 255, 0.96);
    --modal-border: rgba(2, 132, 199, 0.2);
    --modal-header-border: rgba(2, 132, 199, 0.15);
}

[data-theme="light"] .glow-bg-1,
[data-theme="light"] .glow-bg-2 {
    opacity: 0.15;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] select,
[data-theme="light"] textarea,
[data-theme="light"] .subject-card textarea,
[data-theme="light"] .translate-input-wrapper textarea {
    background: rgba(255, 255, 255, 0.6) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] input[type="number"]:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] .subject-card textarea:focus,
[data-theme="light"] .translate-input-wrapper textarea:focus {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .custom-select-trigger {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .custom-options {
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .custom-option {
    color: var(--text-primary);
}

[data-theme="light"] .custom-option:hover {
    background: rgba(2, 132, 199, 0.1);
}

[data-theme="light"] .custom-option.selected {
    background: rgba(2, 132, 199, 0.15);
    color: var(--accent-blue);
}

/* ==========================================================================
   Theme Toggle Button Styles
   ========================================================================== */
.theme-toggle-wrapper {
    position: relative;
    z-index: 100;
}

.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0 16px;
    height: 55px;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn i {
    transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.theme-toggle-btn:hover i {
    transform: rotate(15deg) scale(1.1);
}

/* ==========================================================================
   Quick Nav Light Theme Overrides
   ========================================================================== */
[data-theme="light"] .quick-nav-container {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 20px rgba(0, 100, 200, 0.08) !important;
}

[data-theme="light"] .quick-nav-title {
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="light"] .quick-nav-item a {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
    background: rgba(255, 255, 255, 0.5) !important;
}

[data-theme="light"] .quick-nav-item a:hover {
    color: var(--accent-blue) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: var(--accent-blue) !important;
}

[data-theme="light"] .quick-nav-item.active a {
    background: var(--accent-glow) !important;
    color: #ffffff !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.25) !important;
}

/* ==========================================================================
   Header Badges Light Theme Overrides (Optional / Easy Config)
   ========================================================================== */
[data-theme="light"] .header-badge-optional {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--text-secondary) !important;
}

[data-theme="light"] .header-badge-easy {
    background: rgba(2, 132, 199, 0.08) !important;
    border-color: rgba(2, 132, 199, 0.25) !important;
    color: var(--accent-blue) !important;
}

/* ==========================================================================
   Timeline Integration Custom Styling
   ========================================================================== */
.timeline-indicator-badge {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.02em;
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
    vertical-align: middle;
}
.timeline-indicator-badge.hidden,
.hidden {
    display: none !important;
}
.video-mode-select-card {
    border: 1px solid var(--border-color) !important;
    background: rgba(255, 255, 255, 0.015) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}
[data-theme="light"] .video-mode-select-card {
    background: rgba(255, 255, 255, 0.4) !important;
    border-color: rgba(2, 132, 199, 0.15) !important;
}
.timeline-interval-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
}
[data-theme="light"] .timeline-interval-wrapper {
    background: rgba(2, 132, 199, 0.03) !important;
    border: 1px solid rgba(2, 132, 199, 0.1) !important;
}
#timelineInterval {
    width: 70px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    font-family: inherit;
    font-size: inherit;
}
[data-theme="light"] #timelineInterval {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(2, 132, 199, 0.2) !important;
    color: var(--text-primary) !important;
}
.mode-guide-tip {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.mode-guide-tip .tip-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
[data-theme="light"] .mode-guide-tip {
    background: rgba(2, 132, 199, 0.03) !important;
    border: 1px solid rgba(2, 132, 199, 0.1) !important;
    color: var(--text-secondary) !important;
}

/* Light Theme Beginner Focus Overrides */
[data-theme="light"] .config-card.beginner-focus-card {
    background: #ffffff !important;
    border: 2px solid #0284c7 !important;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.15) !important;
}

[data-theme="light"] .header-badge-quick {
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    border: 1px solid #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25) !important;
}

[data-theme="light"] .btn-jump-to-style {
    background: linear-gradient(135deg, #0284c7, #6366f1) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25) !important;
}

[data-theme="light"] .btn-jump-to-style:hover {
    background: linear-gradient(135deg, #0369a1, #4f46e5) !important;
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4) !important;
}

[data-theme="light"] .btn-jump-to-canvas {
    background: linear-gradient(135deg, #059669, #0284c7) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25) !important;
}

[data-theme="light"] .btn-jump-to-canvas:hover {
    background: linear-gradient(135deg, #047857, #0369a1) !important;
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4) !important;
}
