:root {
    --bg-base: #090d16;
    --bg-surface: #111726;
    --bg-surface-elevated: #182238;
    --border-color: #232f48;
    --border-highlight: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-orange: #f97316;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-purple: #a855f7;
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 36px;
    background: #0d1322;
    border-bottom: 1px solid var(--border-color);
}

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

.agent-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 16px rgba(249, 115, 22, 0.4);
}

.top-nav h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.tagline {
    font-size: 13px;
    color: var(--text-secondary);
}

.student-badge {
    background: #151e33;
    border: 1px solid #2b3956;
    padding: 8px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.badge-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.prn-tag {
    background: #1e293b;
    color: #38bdf8;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Main Container Grid */
.main-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    padding: 24px 36px;
    flex: 1;
}

/* Control Panel (Left) */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
}

.panel-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.section-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Niche Selector Grid */
.niche-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.niche-card {
    background: #0f1628;
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.niche-card:hover {
    background: #172138;
    border-color: var(--border-highlight);
    transform: translateX(3px);
}

.niche-card.active {
    background: #1b2640;
    border-color: var(--accent-orange);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.2);
}

.niche-icon {
    font-size: 22px;
}

.niche-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.niche-info p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Custom Topic Box */
.custom-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#customTopicInput {
    background: #0c111e;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
}

#customTopicInput:focus {
    border-color: var(--accent-orange);
}

.tone-select-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

#toneSelect {
    background: #0c111e;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}

.btn-run-agent {
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
    color: white;
    border: none;
    padding: 11px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-run-agent:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* Architecture info box */
.agent-info-box h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agent-list-desc {
    list-style: none;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-list-desc li strong {
    color: #f1f5f9;
}

/* Results Stage (Right) */
.results-stage {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Agent Terminal */
.agent-terminal {
    background: #080c16;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1a2336;
    padding-bottom: 10px;
}

.term-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.agent-status-badge {
    background: #1e293b;
    color: #94a3b8;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.agent-status-badge.running {
    background: #082f49;
    color: #38bdf8;
    border: 1px solid #0284c7;
    animation: pulse 1s infinite alternate;
}

.agent-status-badge.completed {
    background: #064e3b;
    color: #34d399;
    border: 1px solid #059669;
}

@keyframes pulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

/* Visual Stepper */
.pipeline-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0d1424;
    border-radius: 8px;
    border: 1px solid #1e293b;
}

.step-node {
    display: flex;
    align-items: center;
    gap: 8px;
}

.node-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #1e293b;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.node-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.step-node.active .node-circle {
    background: var(--accent-orange);
    color: white;
    box-shadow: 0 0 10px var(--accent-orange);
}

.step-node.done .node-circle {
    background: var(--accent-green);
    color: white;
}

.step-node.done .node-label {
    color: #fff;
}

.step-line {
    flex: 1;
    height: 2px;
    background: #1e293b;
    margin: 0 10px;
    transition: background 0.3s;
}

.step-line.active {
    background: var(--accent-orange);
}

.step-line.done {
    background: var(--accent-green);
}

/* Log Console */
.log-console {
    background: #050810;
    border: 1px solid #182238;
    border-radius: 6px;
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-line {
    line-height: 1.4;
    animation: fadeIn 0.2s ease;
}

.log-agent {
    color: #38bdf8;
    font-weight: 600;
}

.log-tool {
    color: #fbbf24;
}

.log-ms {
    color: var(--text-muted);
    font-size: 10px;
}

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

/* Output Tabs */
.output-tabs-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.tabs-nav {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #fff;
    background: #182238;
}

.tab-btn.active {
    background: #1e2b47;
    color: #fff;
    border-bottom: 2px solid var(--accent-orange);
}

/* Reels Layout */
.reels-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
}

.topic-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-card {
    background: #0c1220;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.topic-card:hover {
    border-color: var(--border-highlight);
    background: #131b2e;
}

.topic-card.active {
    border-color: var(--accent-orange);
    background: #162035;
}

.topic-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.topic-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.virality-badge {
    color: var(--accent-green);
    font-weight: 700;
}

/* Script Display / Teleprompter */
.script-display {
    background: #090e1a;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.script-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #1a2336;
    padding-bottom: 14px;
}

.script-header h3 {
    font-size: 16px;
    color: #fff;
}

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

.btn-action-sm {
    background: #1e293b;
    color: #fff;
    border: 1px solid #334155;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action-sm:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.script-block {
    background: #0e1628;
    border-left: 3px solid var(--accent-orange);
    padding: 12px 16px;
    border-radius: 6px;
}

.script-block.body-block {
    border-left-color: var(--accent-cyan);
}

.script-block.cta-block {
    border-left-color: var(--accent-green);
}

.block-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.spoken-dialogue {
    font-size: 14px;
    color: #f1f5f9;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 8px;
}

.director-cue {
    font-size: 12px;
    color: #94a3b8;
    background: #070b14;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.on-screen-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.metadata-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid #1a2336;
    padding-top: 12px;
}

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

.influencer-card {
    background: #0d1424;
    border: 1px solid var(--border-color);
    padding: 18px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.inf-name h4 {
    font-size: 15px;
    color: #fff;
    font-weight: 700;
}

.inf-handle {
    font-size: 12px;
    color: #38bdf8;
    font-family: var(--font-mono);
}

.match-pill {
    background: #064e3b;
    color: #34d399;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid #059669;
}

.inf-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: #070b14;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.stat-item .val {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.stat-item .lbl {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.inf-audience {
    font-size: 12px;
    color: var(--text-secondary);
}

.inf-collab {
    font-size: 12px;
    background: #111a2f;
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 2px solid var(--accent-orange);
    color: #e2e8f0;
}

/* Hooks List */
.hooks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hook-card {
    background: #0d1424;
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hook-icon {
    font-size: 18px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #065f46;
    color: #d1fae5;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
    z-index: 999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .reels-layout {
        grid-template-columns: 1fr;
    }
}

/* Nav Right & API Badge */
.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.api-status-badge {
    background: #082f49;
    color: #38bdf8;
    border: 1px solid #0284c7;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
}

/* API Key Drawer */
.api-key-drawer {
    font-size: 12px;
    color: var(--text-secondary);
}

.api-key-drawer details summary {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    color: #38bdf8;
}

.api-key-drawer input {
    width: 100%;
    background: #090e1a;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    margin-top: 6px;
    outline: none;
    font-family: var(--font-mono);
}

/* Sub-desc in architecture */
.sub-desc {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Live Trends Card (Step 1 Output) */
.live-trends-card {
    background: #0c1424;
    border: 1px solid #1e3a8a;
    border-radius: 10px;
    padding: 16px 20px;
    animation: fadeIn 0.3s ease;
}

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

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.trends-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.trends-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.trend-item {
    background: #080d19;
    border: 1px solid #1d283f;
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.trend-headline {
    font-size: 12px;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.35;
}

.trend-source {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

