/* MegaDigital Director AI - Dark Theme */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-input: #1e1e1e;
    --bg-hover: #252525;
    --bg-active: #2a2a2a;
    --border-color: #2d2d2d;
    --border-light: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 72px;
    --sidebar-expanded: 220px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s ease;
}

.sidebar:hover { width: var(--sidebar-expanded); }

.sidebar-logo {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
    margin-bottom: 24px; flex-shrink: 0;
    color: white;
}

.sidebar-nav {
    flex: 1; width: 100%;
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 8px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all 0.2s; white-space: nowrap; overflow: hidden;
    cursor: pointer; border: none; background: none;
    width: 100%; text-align: left; font-size: 14px;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-primary); }
.nav-item i { font-size: 20px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-label { opacity: 0; transition: opacity 0.2s; }
.sidebar:hover .nav-label { opacity: 1; }
.sidebar-footer { padding: 8px; width: 100%; }
.credit-sidebar-badge { color: #fbbf24 !important; font-weight: 600; }
.credit-sidebar-badge:hover { background: rgba(251, 191, 36, 0.12); }

.credit-badge-header {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-input); padding: 6px 14px; border-radius: 20px;
    font-size: 13px; color: #fbbf24; font-weight: 600;
}
.dashboard-billing-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
}

.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    min-height: 100vh; display: flex; flex-direction: column;
}

.page-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-secondary);
}

.page-body { flex: 1; padding: 32px; max-width: 1400px; margin: 0 auto; width: 100%; }

.hero-section { text-align: center; padding: 48px 0 32px; }

.hero-title {
    font-size: 2rem; font-weight: 700; margin-bottom: 32px;
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prompt-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px; max-width: 900px; margin: 0 auto;
    transition: border-color 0.2s;
}

.prompt-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.prompt-textarea {
    width: 100%; background: transparent; border: none;
    color: var(--text-primary); font-size: 15px;
    resize: none; min-height: 100px; outline: none; font-family: inherit;
}

.prompt-textarea::placeholder { color: var(--text-muted); }

.prompt-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap; gap: 12px;
}

.prompt-options { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.toggle-pills { display: flex; background: var(--bg-input); border-radius: 8px; padding: 4px; }

.toggle-pill {
    padding: 6px 16px; border-radius: 6px; border: none;
    background: transparent; color: var(--text-secondary);
    font-size: 13px; cursor: pointer; transition: all 0.2s;
}

.toggle-pill.active { background: var(--bg-active); color: var(--text-primary); }

.btn-director {
    background: var(--accent); color: white; border: none;
    border-radius: 8px; padding: 10px 20px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    display: inline-flex; align-items: center; gap: 8px;
}

.btn-director:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); }
.btn-director-circle { width: 40px; height: 40px; border-radius: 50%; padding: 0; justify-content: center; }

.btn-outline-director {
    background: transparent; border: 1px solid var(--border-light);
    color: var(--text-secondary); border-radius: 8px;
    padding: 8px 16px; cursor: pointer; transition: all 0.2s;
    display: inline-flex; align-items: center; gap: 8px; font-size: 13px;
}

.btn-outline-director:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.projects-section { margin-top: 48px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); overflow: hidden;
    cursor: pointer; transition: all 0.25s; text-decoration: none; color: inherit;
}

.project-card:hover { border-color: var(--border-light); transform: translateY(-4px); box-shadow: var(--shadow); }

.project-card-thumb {
    aspect-ratio: 16/10; background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}

.project-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-card-new { border-style: dashed; border-color: var(--border-light); }
.project-card-new .project-card-thumb { color: var(--text-muted); font-size: 2.5rem; }
.project-card-body { padding: 14px 16px; }
.project-card-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card-meta { font-size: 12px; color: var(--text-muted); }

.card-director { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.card-director-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.card-director-body { padding: 20px; }

.form-control-director, .form-select-director {
    background: var(--bg-input); border: 1px solid var(--border-color);
    color: var(--text-primary); border-radius: 8px;
    padding: 10px 14px; width: 100%; font-size: 14px;
}

.form-control-director:focus, .form-select-director:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-label-director { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.workspace-tabs {
    display: flex; gap: 4px; padding: 0 32px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.workspace-tab {
    padding: 14px 18px; color: var(--text-secondary);
    border: none; background: none; cursor: pointer; font-size: 13px;
    white-space: nowrap; border-bottom: 2px solid transparent;
    transition: all 0.2s; display: flex; align-items: center; gap: 8px;
}

.workspace-tab:hover { color: var(--text-primary); }
.workspace-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.consistency-ring {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; border: 3px solid var(--success);
}

.consistency-ring.warning { border-color: var(--warning); }
.consistency-ring.fail { border-color: var(--danger); }

.timeline-editor { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.timeline-preview { aspect-ratio: 16/9; background: #000; display: flex; align-items: center; justify-content: center; }
.timeline-tracks { border-top: 1px solid var(--border-color); max-height: 300px; overflow-y: auto; }
.timeline-track { display: flex; border-bottom: 1px solid var(--border-color); min-height: 48px; }
.track-label { width: 140px; padding: 8px 12px; background: var(--bg-secondary); border-right: 1px solid var(--border-color); font-size: 12px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.track-content { flex: 1; position: relative; min-height: 48px; }
.timeline-clip { position: absolute; height: 36px; top: 6px; border-radius: 4px; padding: 4px 8px; font-size: 11px; overflow: hidden; cursor: grab; }
.timeline-clip.video { background: #6366f1; }
.timeline-clip.audio_dubbing { background: #22c55e; }
.timeline-clip.audio_music { background: #f59e0b; }
.timeline-clip.audio_sfx { background: #ec4899; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.asset-card { background: var(--bg-input); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-color); }
.asset-card-img { aspect-ratio: 3/4; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.asset-card-img img { width: 100%; height: 100%; object-fit: cover; }
.asset-card-body { padding: 12px; }

.stat-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg-input); border-radius: 20px; font-size: 12px; color: var(--text-secondary); }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at top, #1a1a2e 0%, var(--bg-primary) 70%); }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 40px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 { font-size: 1.5rem; margin: 12px 0 4px; }
.auth-logo p { color: var(--text-muted); font-size: 13px; }

.swal2-popup { background: var(--bg-card) !important; color: var(--text-primary) !important; border: 1px solid var(--border-color) !important; }
.swal2-title, .swal2-html-container { color: var(--text-primary) !important; }

.badge-type { font-size: 10px; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; font-weight: 600; }
.badge-series { background: #312e81; color: #a5b4fc; }
.badge-film { background: #713f12; color: #fcd34d; }
.badge-commercial { background: #134e4a; color: #5eead4; }

.pipeline-steps { display: flex; gap: 0; margin-bottom: 24px; overflow-x: auto; }
.pipeline-step { flex: 1; min-width: 100px; text-align: center; padding: 12px 8px; font-size: 11px; color: var(--text-muted); }
.pipeline-step.active { color: var(--accent); }
.pipeline-step.done { color: var(--success); }
.pipeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border-color); margin: 0 auto 8px; }
.pipeline-step.active .pipeline-dot { background: var(--accent); }
.pipeline-step.done .pipeline-dot { background: var(--success); }

.upload-zone { border: 2px dashed var(--border-light); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-zone:hover { border-color: var(--accent); background: rgba(99, 102, 241, 0.05); }

@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .main-content { margin-left: 0; }
    .page-body { padding: 16px; }
    .hero-title { font-size: 1.5rem; }
}
