/* ═══════════════════════════════════════════════════════════════════════════
   SEO Keyword Intelligence Tool — style.css
   Dark, minimal — consistent with fahadbinzafar.com/tools/ aesthetic
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS variables ─────────────────────────────────────────────────────────── */
:root {
    --bg:       #0f1117;
    --surface:  #1a1d27;
    --surface2: #212533;
    --border:   #2a2d3e;
    --border2:  #353852;
    --text:     #e2e4ef;
    --muted:    #7b8098;
    --muted2:   #555870;
    --accent:   #6366f1;        /* indigo */
    --accent-h: #818cf8;
    --success:  #22c55e;
    --warning:  #eab308;
    --danger:   #ef4444;
    --info:     #38bdf8;
    --radius:   8px;
    --radius-lg: 12px;
    --shadow:   0 4px 24px rgba(0,0,0,.4);
    --font:     'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent-h); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
input, textarea, select, button { font-family: inherit; }
code, pre { font-family: var(--mono); }

/* ── Typography ────────────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem;  font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.2rem;  font-weight: 600; line-height: 1.35; }
h3 { font-size: 1rem;    font-weight: 600; }
h4 { font-size: .9rem;   font-weight: 600; }
p  { color: var(--muted); font-size: .9rem; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 56px;
    display: flex;
    align-items: center;
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: .95rem;
}
.topbar-brand:hover { text-decoration: none; color: var(--accent-h); }
.brand-icon {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
}
.brand-icon svg { width: 16px; height: 16px; }
.topbar-nav { display: flex; align-items: center; gap: 1.5rem; font-size: .85rem; }
.topbar-nav a { color: var(--muted); }
.topbar-nav a:hover { color: var(--text); text-decoration: none; }
.topbar-nav a.active { color: var(--accent-h); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}
.page-header h1 { margin-bottom: .25rem; }
.page-header p { margin: 0; }
.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.card-title { font-size: 1rem; font-weight: 600; }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs-nav {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.75rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent-h); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--border2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }
.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }
.btn-icon {
    width: 32px; height: 32px; padding: 0;
    justify-content: center;
    border-radius: var(--radius);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
    display: block;
    font-size: .82rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.form-control {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    padding: .55rem .75rem;
    font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.form-control::placeholder { color: var(--muted2); }
.form-hint { font-size: .78rem; color: var(--muted2); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .85rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-error   { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(234,179,8,.08); border-color: rgba(234,179,8,.3);  color: #fde047; }
.alert-info    { background: rgba(56,189,248,.08); border-color: rgba(56,189,248,.3); color: #7dd3fc; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-accent  { background: rgba(99,102,241,.15); color: var(--accent-h); }
.badge-success { background: rgba(34,197,94,.12);  color: #86efac; }
.badge-warning { background: rgba(234,179,8,.12);  color: #fde047; }
.badge-danger  { background: rgba(239,68,68,.12);  color: #fca5a5; }
.badge-muted   { background: var(--surface2); color: var(--muted); }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
    text-align: left;
    padding: .6rem .9rem;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── Project grid ──────────────────────────────────────────────────────────── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: border-color .15s;
    text-decoration: none;
    color: var(--text);
    display: block;
}
.project-card:hover {
    border-color: var(--accent);
    text-decoration: none;
    color: var(--text);
}
.project-card-url { font-size: .78rem; color: var(--muted); margin: .25rem 0 .75rem; }
.project-card-meta {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* ── Stat boxes ────────────────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
}
.stat-label { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; }
.stat-value.accent  { color: var(--accent-h); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.progress { height: 4px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin: .75rem 0; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }

/* ── Loading spinner ───────────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Step indicator ────────────────────────────────────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}
.step { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted2); }
.step-num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700;
}
.step.done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.active { color: var(--text); }
.step-sep { color: var(--border2); font-size: .7rem; }

/* ── API key row (admin) ───────────────────────────────────────────────────── */
.api-key-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .75rem;
    align-items: flex-end;
}
.key-status {
    font-size: .78rem;
    padding: .15rem .5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.key-status.configured   { color: var(--success); background: rgba(34,197,94,.1); }
.key-status.unconfigured { color: var(--muted);   background: var(--surface2); }

/* ── Feedback buttons ──────────────────────────────────────────────────────── */
.feedback-btns { display: flex; gap: .4rem; }
.fb-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border2);
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem;
    transition: background .15s, border-color .15s;
}
.fb-btn:hover { background: var(--surface2); }
.fb-btn.up.active   { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.4); }
.fb-btn.down.active { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3); }

/* ── Opportunity card ──────────────────────────────────────────────────────── */
.opp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: .75rem;
}
.opp-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.opp-title { font-weight: 600; font-size: .95rem; }
.opp-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin: .5rem 0; }
.opp-tag {
    font-size: .72rem; padding: .15rem .45rem;
    border-radius: 4px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    color: var(--muted);
}
.opp-reason { font-size: .82rem; color: var(--muted); line-height: 1.55; }

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 1.15rem; margin-top: .75rem; }
.login-logo p { font-size: .82rem; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}
.empty-state svg { margin: 0 auto 1rem; width: 48px; height: 48px; opacity: .35; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: .35rem; }
.empty-state p { font-size: .85rem; max-width: 320px; margin: 0 auto .75rem; }

/* ── Section divider ───────────────────────────────────────────────────────── */
.section-divider {
    display: flex; align-items: center; gap: 1rem;
    color: var(--muted2); font-size: .78rem;
    margin: 1.5rem 0;
}
.section-divider::before, .section-divider::after {
    content: ''; flex: 1;
    height: 1px; background: var(--border);
}

/* ── Code blocks ───────────────────────────────────────────────────────────── */
code {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .1em .35em;
    font-size: .82em;
    color: var(--accent-h);
}
pre {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    font-size: .82rem;
    line-height: 1.6;
    color: var(--text);
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-accent  { color: var(--accent-h); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-sm  { font-size: .82rem; }
.text-xs  { font-size: .75rem; }
.text-mono { font-family: var(--mono); }
.fw-600 { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .topbar-nav { display: none; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .page-header-row { flex-direction: column; }
}
