/* WritingBooster.net v0.1 — Dark Theme (based on TextMeter) */
:root {
    --bg: #0a0f1a; --surface: #111827; --surface2: #1a2235; --border: #1e293b;
    --text: #e2e8f0; --text-sec: #94a3b8; --text-muted: #64748b;
    --accent: #3b82f6; --accent2: #8b5cf6;
    --green: #10b981; --yellow: #f59e0b; --orange: #f97316; --red: #ef4444;
    --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --sans: 'Inter', -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.6; margin: 0; }
a { color: var(--accent); text-decoration: none; }

.app-wrapper { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.top-bar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.logo-text { font-size: 1.4rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.logo-dot { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-sec); font-size: 0.85rem; font-weight: 500; }
.nav-links a.active { color: var(--accent); }

/* Sub-nav bar (role-specific links below header) */
.sub-nav { display: flex; align-items: center; gap: 2px; padding: 6px 0; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav a { font-size: 0.82rem; font-weight: 500; color: var(--text-sec); padding: 6px 14px; border-radius: 6px; white-space: nowrap; transition: color 0.15s, background 0.15s; }
.sub-nav a:hover { color: var(--text); }
.sub-nav a.active { background: var(--surface2); color: var(--accent); }
.sub-nav .sn-divider { width: 1px; height: 16px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

/* User info in top-bar (when sub-nav is used) */
.user-info { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 0.8rem; color: var(--text-sec); }
.user-role-badge { font-size: 0.68rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; color: var(--accent); font-weight: 600; }

/* Footer */
.app-footer { text-align: center; padding: 2rem 0; color: var(--text-muted); font-size: 0.75rem; border-top: 1px solid var(--border); margin-top: 3rem; }

/* Buttons */
.btn { display: inline-block; padding: 0.5rem 1.2rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; font-family: var(--sans); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.75rem; }
.btn-lg { padding: 0.7rem 1.8rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-signout { background: none; border: none; color: var(--text-muted); font-size: 0.78rem; cursor: pointer; }
.btn-signout:hover { color: var(--red); }

/* Hero */
.hero { text-align: center; padding: 4rem 0 2rem; }
.hero h1 { font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.hero-accent { color: var(--accent); }
.subtitle { color: var(--text-sec); font-size: 1.05rem; margin-top: 0.8rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }

/* Features */
.features { padding: 3rem 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; transition: border-color 0.2s; }
.feature-card:hover { border-color: var(--accent); }
.feature-icon { font-size: 1.8rem; margin-bottom: 0.8rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.feature-card p { color: var(--text-sec); font-size: 0.85rem; }

/* How It Works */
.how-it-works { padding: 3rem 0; text-align: center; }
.how-it-works h2 { font-size: 2rem; margin-bottom: 2rem; }
.steps { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; width: 180px; text-align: center; }
.step-num { width: 36px; height: 36px; background: var(--accent); color: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 0.8rem; }
.step h4 { font-size: 0.85rem; margin-bottom: 0.4rem; }
.step p { color: var(--text-sec); font-size: 0.75rem; }

/* CTA */
.cta-section { text-align: center; padding: 3rem 0; }
.cta-section h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.cta-section p { color: var(--text-sec); margin-bottom: 1.5rem; }

/* Forms */
.input-group { margin-bottom: 1rem; }
.input-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text-sec); }
.input-group input, .input-group textarea, .input-group select {
    width: 100%; padding: 0.6rem 0.8rem; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.9rem; font-family: var(--sans);
}
.input-group input:focus, .input-group textarea:focus { border-color: var(--accent); outline: none; }
.input-group small { color: var(--text-muted); font-size: 0.72rem; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface2); font-weight: 600; font-size: 0.9rem; }
.panel-body { padding: 1rem; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; text-align: center; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-sec); margin-top: 0.3rem; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; font-size: 0.7rem; border-radius: 4px; background: var(--surface2); color: var(--text-sec); margin-left: 0.5rem; }
.badge-green { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }

/* Status Messages */
.status-msg { padding: 0.6rem 1rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1rem; }
.status-msg.info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: var(--accent); }
.status-msg.success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.status-msg.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--red); }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.modal-body { padding: 1rem; }

/* School rows */
.school-row { padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.school-row:last-child { border-bottom: none; }
.school-info { margin-bottom: 0.3rem; }
.school-meta { font-size: 0.78rem; color: var(--text-muted); }
.school-actions { margin-top: 0.5rem; display: flex; gap: 0.5rem; }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.input-disabled { opacity: 0.5; cursor: not-allowed; }

/* Join / Login */
.join-section, .login-section { max-width: 480px; margin: 3rem auto; text-align: center; }
.join-form-wrap, .login-form-wrap { margin-top: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; }
.login-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 1.5rem; }
.google-login-wrap { display: flex; justify-content: center; }

/* ADA Panel */
.ada-tabs { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin: 1.5rem 0; }
.ada-tab { flex: 1; background: transparent; border: none; color: var(--text-muted); font-family: var(--sans); font-size: 0.82rem; font-weight: 600; padding: 0.55rem; border-radius: 8px; cursor: pointer; }
.ada-tab.active { background: var(--accent); color: #fff; }
.ada-tab:hover:not(.active) { color: var(--text-sec); }

.ada-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.ada-table thead { background: var(--surface2); }
.ada-table th { text-align: left; padding: 6px 8px; font-size: 0.72rem; font-weight: 600; color: var(--text-sec); border-bottom: 1px solid var(--border); }
.ada-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.ada-table tr:hover { background: rgba(255,255,255,0.02); }

/* Guard entries handled inline in ada.html */

/* Dashboard section */
.dashboard-section, .admin-section { padding: 2rem 0; }
.admin-section h1 { margin-bottom: 0.3rem; }

/* Role Switcher */
#role-switcher select { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--accent); font-size: 0.72rem; font-weight: 600; padding: 3px 8px; cursor: pointer; }
#role-switcher select:hover { border-color: var(--accent); }

/* Impersonate Banner */
#impersonate-bar { z-index: 2000; position: sticky; top: 0; }

/* Landing Page Tabs */
.lp-tab { padding: 10px 24px; font-size: 0.88rem; font-weight: 600; background: transparent; border: 1px solid var(--border); color: var(--text-sec); border-radius: 8px; cursor: pointer; transition: all 0.2s; min-width: 180px; text-align: center; }
.lp-tab:hover { border-color: var(--accent); color: var(--text); }
.lp-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.lp-panel { max-width: 960px; margin: 0 auto; }

.lp-features { display: flex; flex-direction: column; gap: 1rem; }
.lp-feat { display: flex; gap: 12px; align-items: flex-start; }
.lp-feat-icon { font-size: 1.4rem; flex-shrink: 0; width: 32px; text-align: center; }
.lp-feat strong { font-size: 0.88rem; color: var(--text); }
.lp-feat span { font-size: 0.78rem; color: var(--text-sec); line-height: 1.5; }

.lp-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; }
.lp-stat-num { font-size: 2.2rem; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 0.3rem; }
.lp-stat-label { font-size: 0.76rem; color: var(--text-sec); line-height: 1.5; }

.lp-steps-mini { display: flex; flex-direction: column; gap: 8px; }
.lp-step-mini { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-sec); }
.lp-step-mini span { width: 24px; height: 24px; background: var(--accent); color: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.72rem; flex-shrink: 0; }

/* Landing Page Mock-up Editor */
.mock-editor { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mock-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.mock-text { padding: 16px; font-size: 0.88rem; line-height: 1.8; color: var(--text); }
.mock-err { background: rgba(239, 68, 68, 0.12); padding: 1px 4px; border-radius: 3px; border-bottom: 2px solid #ef4444; cursor: help; }
.mock-err-tag { font-size: 0.6rem; font-weight: 700; background: rgba(0,0,0,0.15); padding: 0 4px; border-radius: 3px; margin-right: 3px; vertical-align: middle; }
.mock-stats { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 0.7rem; color: var(--text-muted); }

/* Landing Page Mock-up Corrections */
.mock-corrections { display: flex; flex-direction: column; gap: 8px; }
.mock-corr-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.mock-corr-head { font-size: 0.78rem; font-weight: 600; margin-bottom: 6px; }
.mock-corr-badge { font-size: 0.64rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-right: 6px; }
.mock-corr-body { font-size: 0.8rem; line-height: 1.6; }
.mock-wrong { color: #ef4444; text-decoration: line-through; }
.mock-right { color: #10b981; font-weight: 600; }
.mock-explain { font-size: 0.74rem; color: var(--text-sec); font-style: italic; }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .feature-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .steps { flex-direction: column; align-items: center; }
    .hero-actions { flex-direction: column; align-items: center; }
    .lp-panel > div { grid-template-columns: 1fr !important; }
    .lp-tab { padding: 8px 16px; font-size: 0.78rem; }
    .ob-cards { flex-direction: column; }
    .ob-plans { flex-direction: column; }
}

/* ═══ Onboarding Steps (login.html) ═══ */
#onboard-container { max-width: 560px; margin: 0 auto; }
.ob-step { display: none; animation: obFadeIn 0.3s ease; }
.ob-step.active { display: block; }
@keyframes obFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.ob-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.3rem; text-align: center; }
.ob-sub { color: var(--text-sec); font-size: 0.88rem; text-align: center; margin-bottom: 1.2rem; }
.ob-hint { color: var(--text-muted); font-size: 0.78rem; text-align: center; }
.ob-back { background: none; border: none; color: var(--text-sec); font-size: 0.82rem; cursor: pointer; margin-bottom: 1rem; padding: 0; }
.ob-back:hover { color: var(--accent); }

/* Progress dots */
.ob-progress { display: flex; justify-content: center; gap: 8px; margin-bottom: 1.5rem; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.ob-dot.active { background: var(--accent); }
.ob-dot.done { background: var(--green); }

/* Role cards */
.ob-cards { display: flex; gap: 1rem; justify-content: center; }
.ob-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; width: 220px; text-align: center; cursor: pointer; transition: border-color 0.2s, transform 0.15s; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.ob-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.ob-card-icon { font-size: 1.6rem; }
.ob-card-label { font-size: 1rem; font-weight: 600; color: var(--text); }
.ob-card-desc { font-size: 0.78rem; color: var(--text-sec); }

/* Plan comparison */
.ob-plans { display: flex; gap: 1rem; justify-content: center; }
.ob-plan { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; width: 240px; position: relative; }
.ob-plan-premium { border-color: var(--accent2); }
.ob-plan-badge { position: absolute; top: -10px; right: 16px; background: var(--accent2); color: #fff; font-size: 0.68rem; font-weight: 600; padding: 2px 10px; border-radius: 10px; }
.ob-plan-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; text-align: center; }
.ob-plan-features { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.ob-plan-features li { font-size: 0.82rem; padding: 0.3rem 0; color: var(--text-sec); }
.ob-plan-features li.yes::before { content: "\2713 "; color: var(--green); font-weight: 600; margin-right: 0.3rem; }
.ob-plan-features li.no::before { content: "\2717 "; color: var(--text-muted); margin-right: 0.3rem; }

/* Join form */
.ob-input { width: 100%; padding: 0.7rem 1rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 1rem; margin-bottom: 0.8rem; font-family: var(--mono); letter-spacing: 0.05em; text-align: center; }
.ob-input:focus { outline: none; border-color: var(--accent); }
.ob-success-card { text-align: center; padding: 1.5rem; background: rgba(16,185,129,0.06); border: 1px solid rgba(16,185,129,0.2); border-radius: 12px; }
.ob-success-card h3 { font-size: 1.1rem; margin: 0.5rem 0; color: var(--green); }

/* Placement page */
.placement-prompt { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; margin-bottom: 1rem; }
.placement-prompt h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.placement-prompt p { font-size: 0.85rem; color: var(--text-sec); }
.placement-editor { width: 100%; min-height: 200px; padding: 1rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.9rem; line-height: 1.6; resize: vertical; font-family: var(--sans); }
.placement-editor:focus { outline: none; border-color: var(--accent); }
.placement-wc { font-size: 0.78rem; color: var(--text-muted); text-align: right; margin-top: 0.3rem; }
.placement-wc.warn { color: var(--yellow); }
.placement-wc.over { color: var(--red); }
.placement-wc.ok { color: var(--green); }

/* Placement result */
.placement-result { text-align: center; }
.cefr-badge { display: inline-block; font-size: 2rem; font-weight: 800; color: var(--accent); background: rgba(59,130,246,0.08); border: 2px solid var(--accent); border-radius: 16px; padding: 0.5rem 2rem; margin: 1rem 0; }
.error-symbols { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 1rem 0; }
.error-sym { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.8rem; font-size: 0.82rem; font-family: var(--mono); }
.error-sym .sym-count { color: var(--yellow); font-weight: 600; margin-left: 0.3rem; }
.locked-banner { background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.2); border-radius: 10px; padding: 1rem; margin: 1.5rem 0; }
.locked-banner p { font-size: 0.85rem; color: var(--text-sec); }

/* Trial student sample activities */
.sample-activity { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 0.6rem; opacity: 0.7; position: relative; }
.sample-activity .sa-lock { position: absolute; top: 0.8rem; right: 0.8rem; font-size: 1rem; }
.sample-activity .sa-type { font-size: 0.68rem; font-weight: 600; color: var(--accent2); text-transform: uppercase; margin-bottom: 0.2rem; }
.sample-activity .sa-title { font-size: 0.92rem; font-weight: 600; }
.sample-activity .sa-desc { font-size: 0.78rem; color: var(--text-sec); margin-top: 0.2rem; }

/* Trial student feature cards (PenFriend, Hot News) */
.trial-feature-card { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; text-align: center; color: var(--text); transition: border-color 0.2s; }
.trial-feature-card:hover { border-color: var(--accent); }

/* Diary */
.diary-tab { flex: 1; padding: 6px 12px; font-size: 0.82rem; font-weight: 500; border: none; background: none; color: var(--text-sec); cursor: pointer; border-radius: 6px; transition: background 0.15s, color 0.15s; }
.diary-tab:hover { color: var(--text); }
.diary-tab.active { background: var(--surface2); color: var(--accent); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; text-align: center; }
.stat-val { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.rpt-section { margin-bottom: 1.4rem; }
.rpt-title { font-size: 0.84rem; font-weight: 600; margin-bottom: 0.6rem; color: var(--text); }

/* Vocabulary Notebook */
.vocab-card { display: flex; gap: 0.8rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.5rem; transition: border-color 0.2s; }
.vocab-card.learned { opacity: 0.7; }
.vocab-card:hover { border-color: var(--accent); }
.vocab-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.vocab-body { flex: 1; min-width: 0; }
.vocab-word { font-size: 0.95rem; font-weight: 600; }
.vocab-meaning { font-size: 0.82rem; color: var(--text-sec); margin-top: 0.1rem; }
.vocab-example { font-size: 0.76rem; color: var(--text-muted); font-style: italic; margin-top: 0.2rem; }
.vocab-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.img-pick { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; }
.img-pick:hover { border-color: var(--accent); }
.img-pick.selected { border-color: var(--accent); }
