/* Story Brain — Global Styles (Dark Theme) */
:root {
    --bg: #000;
    --surface: #0a0a0a;
    --surface-raised: #1a1a1a;
    --surface-hover: #222;
    --accent: #4ade80;
    --accent-muted: rgba(74,222,128,0.1);
    --accent-border: rgba(74,222,128,0.3);
    --text: #e5e5e5;
    --text-light: #888;
    --text-muted: #555;
    --border: #222;
    --border-light: #333;
    --white: #ffffff;
    --error: #ef4444;
    --error-light: rgba(239,68,68,0.1);
    --success: #4ade80;
    --success-light: rgba(74,222,128,0.1);
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #86efac;
}

/* Navigation */
.nav {
    background: var(--bg);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
}

.nav-brand span {
    color: var(--accent);
}

.accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex: 1;
    margin-left: 2rem;
}

.nav-links a {
    color: var(--text-light);
    font-size: 0.9rem;
    transition: color var(--transition);
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-right {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-left: auto;
    padding-left: 2rem;
    flex-shrink: 0;
}

.nav-right a {
    color: var(--text-light);
    font-size: 0.9rem;
    transition: color var(--transition);
}

.nav-right a:hover {
    color: var(--accent);
}

.nav-user {
    color: var(--text-light);
    font-size: 0.85rem;
}

.nav-user a {
    color: var(--text-light);
    transition: color var(--transition);
}

.nav-user a:hover {
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--white);
    color: #000;
}

.btn-primary:hover {
    background: #e5e5e5;
    color: #000;
}

.btn-secondary {
    background: var(--surface-raised);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-light);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.btn-accent {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

.btn-accent:hover {
    background: #86efac;
    color: #000;
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover {
    background: #dc2626;
    color: var(--white);
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

/* Cards */
.card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border);
}

/* Profile Page */
.profile-page {
    display: flex;
    justify-content: center;
    padding: 3rem 2rem;
}

.profile-card {
    width: 100%;
    max-width: 520px;
}

.profile-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.profile-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.profile-card textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.profile-card .form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Auth Layout */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.auth-card .form-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.alert-error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid rgba(239,68,68,0.3);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--accent-border);
}

.alert.show {
    display: block;
}

/* Hero */
.hero {
    background: var(--bg);
    color: var(--text);
    padding: 5rem 2rem;
    text-align: center;
}

.hero-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.hero h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 640px;
    margin: 0 auto 2rem;
    color: var(--text-light);
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Sections */
.section {
    padding: 4rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.section .section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 3rem;
    font-size: 1.05rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Tool Headlines (How It Works row) */
.tool-headline {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    cursor: pointer;
    transition: all var(--transition);
}

.tool-headline:hover,
.tool-headline.active {
    border-color: var(--accent-border);
    background: var(--surface-hover);
}

.tool-headline h3 {
    font-size: 1.15rem;
    margin-top: 0.25rem;
}

.tool-headline .tool-badge.writer {
    background: rgba(168,85,247,0.1);
    color: #a855f7;
}

.tool-headline .tool-badge.analyst {
    background: rgba(96,165,250,0.1);
    color: #60a5fa;
}

/* Tool Detail Sections */
.tool-detail {
    margin-bottom: 3rem;
}

.tool-detail-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Phases Grid */
.phases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.phases-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Writer Flow (arrow pipeline) */
.writer-flow {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 1rem;
}

.writer-flow-step {
    flex: 1;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.writer-flow-step .flow-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.4rem;
}

.writer-flow-step.human-step .flow-label {
    color: #a855f7;
}

.writer-flow-step.human-step {
    border-color: rgba(168,85,247,0.3);
    background: rgba(168,85,247,0.05);
}

.writer-flow-step h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.writer-flow-step p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

.writer-flow-arrow {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Analyst Pitch (legacy) */
.analyst-pitch {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.analyst-pitch p {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* Pull-Quote Lines */
.pull-quotes {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pull-quotes p {
    font-size: 1.05rem;
    color: var(--text-light);
    line-height: 1.7;
    padding-left: 1.25rem;
    border-left: 3px solid var(--accent);
}

.pull-quotes p strong {
    color: var(--white);
    font-weight: 600;
}

.phase-card {
    background: var(--surface-raised);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.phase-card .phase-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.phase-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}

.phase-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.tool-card:hover {
    border-color: var(--accent-border);
}

.tool-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.tool-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.tool-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-muted);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

/* Dashboard */
.dashboard {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.75rem;
}

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

.session-card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
}

.session-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
    color: inherit;
}

.session-progress {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    flex-shrink: 0;
}

.session-info {
    flex: 1;
}

.session-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.session-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    gap: 1rem;
}

.session-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.session-badge.builder {
    background: var(--accent-muted);
    color: var(--accent);
}

.session-badge.writer {
    background: rgba(168,85,247,0.1);
    color: #a855f7;
}

.session-badge.analyst {
    background: rgba(96,165,250,0.1);
    color: #60a5fa;
}

.session-badge.completed {
    background: var(--success-light);
    color: var(--success);
}

.session-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state h3 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.modal h2 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

/* Tool Selector (in modal) */
.tool-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.tool-option {
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
    background: var(--surface);
}

.tool-option:hover {
    border-color: var(--accent-border);
}

.tool-option.selected {
    border-color: var(--accent);
    background: var(--accent-muted);
}

.tool-option h4 {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.tool-option p {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Footer */
.footer {
    background: var(--bg);
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .phases-grid,
    .phases-grid-3 {
        grid-template-columns: 1fr;
    }

    .writer-flow {
        flex-direction: column;
    }

    .writer-flow-arrow {
        justify-content: center;
        padding: 0.5rem 0;
        transform: rotate(90deg);
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .session-card {
        flex-direction: column;
        text-align: center;
    }

    .session-meta {
        justify-content: center;
    }

    .session-actions {
        justify-content: center;
    }
}

/* Tool Badge Color Variants */
.tool-badge.writer {
    background: rgba(168,85,247,0.1);
    color: #a855f7;
}

.tool-badge.analyst {
    background: rgba(96,165,250,0.1);
    color: #60a5fa;
}

/* Dashboard Launcher */
.dashboard-launcher {
    max-width: 900px;
    margin: 4rem auto 2rem;
    padding: 0 2rem;
    text-align: center;
}

.dashboard-launcher h1 {
    font-size: 2.25rem;
    color: var(--white);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: var(--text-light);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}

/* Clickable Tool Card Links */
.tool-card-link {
    cursor: pointer;
    transition: all var(--transition);
}

.tool-card-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-border);
}

/* Vault Tabs */
.vault-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.vault-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

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

.vault-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

@media (max-width: 768px) {
    .vault-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-launcher h1 {
        font-size: 1.75rem;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Voice Input — Mic Button (shared across session + analyst) */
.mic-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: transparent;
    border: 2px solid var(--border-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
    color: var(--accent);
}

.mic-btn:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
}

.mic-btn svg {
    width: 20px;
    height: 20px;
}

.mic-btn.listening {
    background: var(--error);
    border-color: var(--error);
    color: var(--white);
    animation: pulse-red 1.5s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
