/* ─────────────────────────────────────────────────────────────────────────────
   NotebookLM WebApp — Black / Red-border / Blue-button design
   Fonts: Rajdhani (headers), Mulish (body), JetBrains Mono (code/status)
───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Mulish:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Backgrounds — pure black family */
    --bg:          #07070d;
    --bg-card:     #0c0c16;
    --bg-input:    #050509;
    --bg-hover:    #111122;

    /* Purple — borders for cards / windows / menus */
    --red:         #7c3aed;
    --red-bright:  #a78bfa;
    --red-dim:     #3b1a7a;
    --red-glow:    rgba(124, 58, 237, 0.18);
    --red-glow-lg: rgba(124, 58, 237, 0.38);

    /* Cream/beige — borders + text for buttons */
    --blue:        #a08060;
    --blue-bright: #c8a87a;
    --blue-dim:    #3a2a18;
    --blue-text:   #e0c89a;
    --blue-active: #4a3520;
    --blue-glow:   rgba(200, 168, 122, 0.22);

    /* Text */
    --text:        #e2e8ef;
    --muted:       #5a6478;
    --muted-mid:   #8892a4;

    /* State */
    --success:     #10b981;
    --error:       #ef4444;
    --warning:     #f59e0b;

    /* Geometry */
    --radius:      6px;
    --radius-lg:   10px;
    --radius-xl:   14px;

    /* Typography */
    --font-head:   'Rajdhani', sans-serif;
    --font-body:   'Mulish', sans-serif;
    --font-mono:   'JetBrains Mono', monospace;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 1rem 0.75rem 3rem;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
    max-width: 580px;
    margin: 0 auto 1.25rem;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0 0.75rem;
    border-bottom: 1px solid var(--red-dim);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-glyph {
    font-size: 2rem;
    line-height: 1;
    background: linear-gradient(135deg, var(--red-bright), var(--blue-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.4));
}

.logo-title {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(100deg, #f1f5f9 0%, var(--blue-text) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.logo-sub {
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1;
    margin-top: 0.15rem;
}

.settings-toggle {
    background: transparent;
    border: 1px solid var(--red-dim);
    border-radius: var(--radius);
    color: var(--muted);
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    transition: border-color 0.2s, color 0.2s;
}
.settings-toggle:hover {
    border-color: var(--red-bright);
    color: var(--text);
}

/* Settings Panel */
.settings-panel {
    padding: 0.9rem 0;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid var(--red-dim);
    margin-bottom: 0.25rem;
    animation: fadeInDown 0.2s ease;
}
.settings-panel.open { display: flex; }

.settings-label {
    font-family: var(--font-head);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.settings-row {
    display: flex;
    gap: 0.5rem;
}

.settings-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--red-dim);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.settings-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 2px var(--red-glow);
}
.settings-input::placeholder { color: var(--muted); }

.btn-save {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--blue);
    border-radius: var(--radius);
    color: var(--blue-text);
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}
.btn-save:hover {
    background: var(--blue-glow);
    border-color: var(--blue-bright);
    color: #fff;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
}

/* ── Main layout ──────────────────────────────────────────────────────────── */
.main {
    max-width: 580px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* ── Step Cards ───────────────────────────────────────────────────────────── */
.step-card {
    background: var(--bg-card);
    border: 1px solid var(--red);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem 1.25rem;
    box-shadow: 0 0 0 1px var(--red-dim), 0 4px 24px var(--red-glow);
    animation: fadeInUp 0.3s ease;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--red-dim);
}

.step-num {
    font-family: var(--font-head);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--red);
    line-height: 1;
    min-width: 2.5rem;
    text-align: right;
    letter-spacing: -0.02em;
    text-shadow: 0 0 20px var(--red-glow-lg);
}
.step-num.done {
    color: var(--success);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}

.step-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.step-title {
    font-family: var(--font-head);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted-mid);
}

.step-desc {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--muted);
    line-height: 1.3;
}

/* ── Source Tabs ──────────────────────────────────────────────────────────── */
.tab-row {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.85rem;
    background: transparent;
    border: 1px solid var(--blue-dim);
    border-radius: var(--radius);
    color: var(--muted-mid);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.tab:hover {
    border-color: var(--blue-bright);
    color: var(--blue-text);
    background: var(--blue-glow);
}
.tab.active {
    border-color: var(--blue-bright);
    background: var(--blue-active);
    color: #fff;
}
.tab-icon { font-style: normal; opacity: 0.8; }

/* ── Source Panels ────────────────────────────────────────────────────────── */
.source-panel { animation: fadeInUp 0.2s ease; }
.source-panel.hidden { display: none; }

#textInput,
#urlInput {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--red-dim);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#textInput:focus,
#urlInput:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 2px var(--red-glow);
}
#textInput::placeholder,
#urlInput::placeholder { color: var(--muted); }

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--red-dim);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--red-bright);
    background: var(--red-glow);
}
.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.drop-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}
.drop-text {
    font-size: 0.875rem;
    color: var(--muted-mid);
}
.drop-label {
    color: var(--blue-text);
    cursor: pointer;
    text-decoration: underline dotted;
}
.file-chosen {
    display: block;
    margin-top: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--success);
}

/* ── Language / Generic Button Groups ────────────────────────────────────── */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.choice-btn {
    padding: 0.5rem 1.1rem;
    background: transparent;
    border: 1px solid var(--blue-dim);
    border-radius: var(--radius);
    color: var(--muted-mid);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s, box-shadow 0.18s;
}
.choice-btn:hover {
    border-color: var(--blue-bright);
    color: var(--blue-text);
    background: var(--blue-glow);
}
.choice-btn.active {
    border-color: var(--blue-bright);
    background: var(--blue-active);
    color: #fff;
    box-shadow: 0 0 12px var(--blue-glow);
}

/* ── Format Grid ──────────────────────────────────────────────────────────── */
.format-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

@media (max-width: 440px) {
    .format-grid { grid-template-columns: repeat(2, 1fr); }
}

.format-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 0.4rem;
    background: transparent;
    border: 1px solid var(--blue-dim);
    border-radius: var(--radius);
    color: var(--muted-mid);
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.15s;
}
.format-btn:hover {
    border-color: var(--blue-bright);
    color: var(--blue-text);
    background: var(--bg-hover);
    transform: translateY(-1px);
}
.format-btn.active {
    border-color: var(--blue-bright);
    background: var(--blue-active);
    color: #fff;
    box-shadow: 0 0 14px var(--blue-glow);
}
.fmt-icon {
    font-size: 1.35rem;
    line-height: 1;
}
.fmt-name {
    font-family: var(--font-head);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Generate Area ────────────────────────────────────────────────────────── */
.generate-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

.btn-generate {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, var(--blue-active), var(--blue));
    border: 1px solid var(--blue-bright);
    border-radius: var(--radius-xl);
    color: #fff;
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: opacity 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 0 20px var(--blue-glow), 0 2px 8px rgba(0,0,0,0.5);
}
.btn-generate:hover:not(:disabled) {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.45), 0 2px 12px rgba(0,0,0,0.5);
    transform: translateY(-1px);
}
.btn-generate:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
.btn-generate.running {
    background: linear-gradient(135deg, #1a1a3a, #1e2d5a);
    animation: pulseBorder 1.5s ease-in-out infinite;
}

/* Spinner */
.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.btn-spinner.hidden { display: none; }

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar.hidden { display: none; }
.progress-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--blue), var(--blue-bright), var(--blue));
    background-size: 200% 100%;
    border-radius: 2px;
    animation: shimmer 1.6s linear infinite;
}

/* Status */
.status-message {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    min-height: 1.2em;
    text-align: center;
    letter-spacing: 0.02em;
}
.status-message.error   { color: var(--error); }
.status-message.success { color: var(--success); }
.status-message.info    { color: var(--blue-text); }

/* ── Result Card ──────────────────────────────────────────────────────────── */
.result-card {
    border-color: var(--success);
    box-shadow: 0 0 0 1px #065f46, 0 4px 24px rgba(16, 185, 129, 0.15);
}
.result-card.hidden { display: none; }

.result-text {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 360px;
    overflow-y: auto;
    color: var(--text);
    scrollbar-width: thin;
    scrollbar-color: var(--red-dim) transparent;
}
.result-text::-webkit-scrollbar { width: 4px; }
.result-text::-webkit-scrollbar-track { background: transparent; }
.result-text::-webkit-scrollbar-thumb { background: var(--red-dim); border-radius: 2px; }

.btn-download {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.6rem 1.4rem;
    background: transparent;
    border: 1px solid var(--blue-bright);
    border-radius: var(--radius-lg);
    color: var(--blue-text);
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 12px var(--blue-glow);
}
.btn-download:hover {
    background: var(--blue-active);
    color: #fff;
    box-shadow: 0 0 20px var(--blue-glow);
}
.btn-download.hidden { display: none; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
    max-width: 580px;
    margin: 2.5rem auto 0;
    text-align: center;
    font-size: 0.72rem;
    color: var(--muted);
    border-top: 1px solid var(--red-dim);
    padding-top: 1rem;
}
.footer a {
    color: var(--muted-mid);
    text-decoration: none;
}
.footer a:hover { color: var(--blue-text); }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

@keyframes pulseBorder {
    0%, 100% { box-shadow: 0 0 14px var(--blue-glow), 0 2px 8px rgba(0,0,0,0.5); }
    50%       { box-shadow: 0 0 28px rgba(59, 130, 246, 0.5), 0 2px 8px rgba(0,0,0,0.5); }
}
