/* ===== TOKENS ===== */
:root {
    --navy: #105090;
    --navy-hover: #0c3d70;
    --sky: #60b0e0;
    --sky-hover: #4a9dd0;
    --bg: #f0f6ff;
    --card: #ffffff;
    --border: #dbeafe;
    --text: #1e293b;
    --muted: #64748b;
    --sidebar-bg: #105090;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-heading: #ffffff;
    --sidebar-dot: rgba(255, 255, 255, 0.18);
    --sidebar-border: rgba(255, 255, 255, 0.12);
    --tag-bg: #e6f2fb;
    --tag-border: #bdd5f0;
    --tag-active-bg: rgba(16, 80, 144, 0.07);
    --input-bg: #ffffff;
    --input-border: #bdd5f0;
    --strength-track: #dbeafe;
    --output-color: #105090;
}

html.dark {
    --bg: #0d1117;
    --card: #111827;
    --border: #1e293b;
    --text: #e2e8f0;
    --sidebar-bg: #0a2d52;
    --sidebar-dot: rgba(96, 176, 224, 0.18);
    --sidebar-border: rgba(96, 176, 224, 0.12);
    --tag-bg: rgba(16, 80, 144, 0.25);
    --tag-border: rgba(16, 80, 144, 0.5);
    --tag-active-bg: rgba(16, 80, 144, 0.2);
    --input-bg: #1e293b;
    --input-border: #2d4a6e;
    --strength-track: #1e293b;
    --output-color: #60b0e0;
}

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

/* ===== BASE ===== */
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

/* ===== NAV ===== */
nav {
    background: var(--navy);
    padding: 0 32px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

nav::after {
    content: '';
    position: absolute;
    right: -28px;
    top: -28px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(96, 176, 224, 0.08);
    pointer-events: none;
}

.nav-brand {
    font-family: 'Sora', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.nav-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sky);
}

.nav-dot:nth-child(2) { opacity: 0.55; }
.nav-dot:nth-child(3) { opacity: 0.25; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.theme-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

/* Toggle pill */
.toggle-pill {
    display: inline-block;
    cursor: pointer;
}

.toggle-pill input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    display: block;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}

.toggle-track::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.25s;
}

.toggle-pill input:checked + .toggle-track { background: var(--sky); }
.toggle-pill input:checked + .toggle-track::before { transform: translateX(16px); }

/* ===== LAYOUT ===== */
main {
    flex: 1;
    display: flex;
    align-items: stretch;
    max-width: 940px;
    width: 100%;
    margin: 40px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
    overflow: hidden;
    transition: background 0.2s;
}

/* Dot-grid texture */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--sidebar-dot) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
    pointer-events: none;
}

.sidebar-brand {
    position: relative;
    z-index: 1;
}

.sidebar-name {
    font-family: 'Sora', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sidebar-heading);
    margin-bottom: 6px;
}

.sidebar-tagline {
    font-size: 0.78rem;
    color: var(--sidebar-text);
    line-height: 1.5;
}

/* Stats */
.sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.stat-num {
    font-family: 'Sora', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--sky);
    line-height: 1;
}

.stat-label {
    font-size: 0.74rem;
    color: var(--sidebar-text);
    margin-top: 3px;
    font-family: 'JetBrains Mono', monospace;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--sidebar-border);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

/* FAQ */
.faq-section {
    position: relative;
    z-index: 1;
    flex: 1;
}

.faq-title {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sky);
    margin-bottom: 10px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.faq-q {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 9px 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background 0.15s, color 0.15s;
}

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

.faq-q.open {
    color: #fff;
    background: rgba(96, 176, 224, 0.15);
}

.chev {
    flex-shrink: 0;
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s;
}

.faq-q.open .chev { transform: rotate(180deg); }

.faq-a {
    display: none;
    padding: 6px 10px 12px;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
}

.faq-q.open + .faq-a { display: block; }

/* ===== GENERATOR ===== */
.generator {
    flex: 1;
    background: var(--card);
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    transition: background 0.2s;
}

.gen-title {
    font-family: 'Sora', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.gen-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
}

/* Field groups */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/* Mode tabs */
.mode-tabs {
    display: flex;
    gap: 6px;
}

.mode-tab {
    flex: 1;
    padding: 9px 12px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1.5px solid var(--input-border);
    color: var(--muted);
    background: var(--input-bg);
    cursor: pointer;
    transition: all 0.15s;
}

.mode-tab.active {
    border-color: var(--navy);
    color: var(--navy);
    background: var(--tag-active-bg);
    font-weight: 600;
}

/* Word count */
.word-count-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.range-input {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    border: none;
    background: var(--strength-track);
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--navy);
    border: 2.5px solid var(--card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.range-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--navy);
    border: 2.5px solid var(--card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.count-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 500;
    color: var(--navy);
    min-width: 20px;
    text-align: center;
}

/* Option chips */
.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.opt-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1.5px solid var(--tag-border);
    color: var(--muted);
    background: var(--input-bg);
    cursor: pointer;
    transition: all 0.15s;
}

.opt-chip.on {
    border-color: var(--navy);
    color: var(--navy);
    background: var(--tag-active-bg);
    font-weight: 600;
}

/* Separator row */
.sep-row {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.sep-row.visible { display: flex; }

.sep-label {
    font-size: 0.78rem;
    color: var(--muted);
}

.sep-select {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1.5px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
}

/* Generate button */
.gen-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--navy) 0%, #1a70c8 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Sora', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(16, 80, 144, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.gen-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 80, 144, 0.4);
}

.gen-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 80, 144, 0.25);
}

/* Output */
.output-row {
    display: flex;
    gap: 8px;
}

.output-field {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    color: var(--output-color);
    background: var(--input-bg);
    outline: none;
    min-width: 0;
    transition: border-color 0.15s, background 0.2s, color 0.2s;
}

.output-field::placeholder {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    color: var(--muted);
}

.output-field:focus { border-color: var(--sky); }

.copy-btn {
    flex-shrink: 0;
    width: 46px;
    background: var(--sky);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.copy-btn:hover { background: var(--sky-hover); }

/* Strength */
.strength-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.strength-track {
    height: 5px;
    background: var(--strength-track);
    border-radius: 5px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 5px;
    transition: width 0.4s ease, background 0.4s ease;
}

.strength-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted);
    min-height: 1.2em;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 20px;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
    main {
        flex-direction: column;
        margin: 16px;
        border-radius: 12px;
    }

    .sidebar {
        width: 100%;
        padding: 24px 20px;
    }

    .generator {
        padding: 24px 20px;
    }

    nav {
        padding: 0 16px;
    }

    .nav-brand {
        font-size: 0.85rem;
    }
}
