/* ============================================================
   OneData Lead Intelligence — Full-width SaaS Dashboard
   Brand primary: #121A8C
   Light glassmorphism + optional dark mode
   ============================================================ */

:root {
    --brand: #121A8C;
    --brand-600: #1b25b0;
    --brand-500: #2a35c7;
    --brand-300: #6d76e6;
    --brand-tint: #eef0ff;

    --bg: #f4f6fb;
    --bg-grad-1: #eaeefc;

    --surface: rgba(255, 255, 255, 0.72);
    --surface-solid: #ffffff;
    --card-border: rgba(18, 26, 140, 0.08);
    --shadow: 0 10px 30px rgba(18, 26, 140, 0.08);
    --shadow-lg: 0 20px 50px rgba(18, 26, 140, 0.16);

    --text: #1a1f36;
    --text-soft: #5a627a;
    --text-faint: #8890a6;

    --ok: #12996b;
    --warn: #d98a00;
    --danger: #d64550;

    --radius: 18px;
    --radius-sm: 12px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

    /* Wordmark ink for the OneData logo (adapts in dark mode) */
    --logo-ink: #2b3142;
}

[data-theme="dark"] {
    --bg: #0c0f1f;
    --bg-grad-1: #10142b;
    --surface: rgba(24, 29, 54, 0.72);
    --surface-solid: #161b32;
    --card-border: rgba(120, 130, 220, 0.14);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --text: #eef0f8;
    --text-soft: #aeb4cc;
    --text-faint: #7b83a1;
    --brand-tint: rgba(42, 53, 199, 0.18);
    --logo-ink: #eef0f8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 100% -10%, var(--bg-grad-1), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, var(--brand-tint), transparent 55%),
        var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1600px; margin: 0 auto; padding: 0 24px; }

/* ---------------- Top bar ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: var(--surface);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--card-border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .brand-logo { height: 30px; width: auto; display: block; }
/* The official wordmark is dark; keep it legible on the dark theme with a chip. */
[data-theme="dark"] .brand .brand-logo {
    background: #fff; padding: 5px 10px; border-radius: 9px;
}
.brand .brand-divider { width: 1px; height: 26px; background: var(--card-border); }
.brand .brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: .5px; text-transform: uppercase; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 11px;
    border: 1px solid var(--card-border); background: var(--surface-solid);
    color: var(--text-soft); cursor: pointer; display: grid; place-items: center;
    font-size: 16px; transition: all .15s ease;
}
.icon-btn:hover { color: var(--brand-500); transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---------------- Hero ---------------- */
.hero { padding: 26px 0 10px; }
.hero h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.6px; margin: 0 0 4px; font-weight: 800; }
.hero h1 .grad {
    background: linear-gradient(90deg, var(--brand), var(--brand-500));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-soft); margin: 0; font-size: 14.5px; }

/* ---------------- Filter bar ---------------- */
.filter-bar {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.4fr auto auto;
    gap: 12px; align-items: end;
    background: var(--surface);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin: 14px 0 22px;
    transition: padding .2s ease, box-shadow .2s ease;
}
.filter-bar.pinned {
    position: sticky; top: 64px; z-index: 40;
    box-shadow: var(--shadow-lg);
}
.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-field label { font-size: 11.5px; font-weight: 600; color: var(--text-soft); letter-spacing: .2px; }
.filter-field input {
    width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
    border: 1px solid var(--card-border); background: var(--surface-solid);
    color: var(--text); font-size: 14px; outline: none;
    transition: border .15s ease, box-shadow .15s ease;
}
.filter-field input:focus { border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-tint); }

.primary-btn {
    padding: 12px 18px; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand), var(--brand-500));
    color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
    box-shadow: 0 8px 20px rgba(18, 26, 140, 0.3); white-space: nowrap;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.primary-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }
.clear-btn {
    padding: 12px 18px; border-radius: var(--radius-sm);
    border: 1px solid var(--card-border); background: var(--surface-solid);
    color: var(--text-soft); font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: all .12s ease;
}
.clear-btn:hover { color: var(--brand-500); border-color: var(--brand-300); }

.field-error {
    grid-column: 1 / -1;
    padding: 10px 12px; background: rgba(214,69,80,.1);
    border: 1px solid rgba(214,69,80,.25); color: var(--danger);
    border-radius: var(--radius-sm); font-size: 13px;
}

/* ---------------- Stats ---------------- */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--surface); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 16px 18px; display: flex; align-items: center; gap: 14px;
}
.stat .stat-ico {
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    display: grid; place-items: center; font-size: 18px;
    background: var(--brand-tint); color: var(--brand-500);
}
.stat .stat-label { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat .stat-value { font-size: 24px; font-weight: 800; margin-top: 3px; letter-spacing: -0.5px; }
.stat .stat-value.brand { color: var(--brand-500); }

/* ---------------- Cards ---------------- */
.card {
    background: var(--surface); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 22px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-header h3 { margin: 0; font-size: 16px; font-weight: 700; }

.status-pill { font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.idle { background: rgba(136,144,166,.14); color: var(--text-faint); }
.status-pill.running { background: rgba(42,53,199,.12); color: var(--brand-500); }
.status-pill.running::before { animation: pulse 1.1s infinite; }
.status-pill.completed { background: rgba(18,153,107,.12); color: var(--ok); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ---------------- 8-step tracker ---------------- */
.tracker-message { font-size: 14px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.tracker-message .dot-spin {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--brand-tint); border-top-color: var(--brand-500);
    animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.steps8 { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.step8 { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.step8 .node {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; font-size: 14px; font-weight: 700;
    background: var(--brand-tint); color: var(--brand-300);
    border: 2px solid transparent; transition: all .3s ease; z-index: 2;
}
.step8 .connector { position: absolute; top: 17px; left: 50%; width: 100%; height: 3px; background: var(--brand-tint); z-index: 1; }
.step8:last-child .connector { display: none; }
.step8 .step8-label { font-size: 10.5px; color: var(--text-faint); text-align: center; font-weight: 600; line-height: 1.25; }
.step8.done .node { background: var(--ok); color: #fff; }
.step8.done .connector { background: var(--ok); }
.step8.current .node {
    background: linear-gradient(135deg, var(--brand), var(--brand-500)); color: #fff;
    border-color: var(--brand-300); box-shadow: 0 0 0 4px var(--brand-tint);
    animation: bob 1.1s ease-in-out infinite;
}
.step8.current .step8-label, .step8.done .step8-label { color: var(--text); }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-3px)} }

.empty-state { text-align: center; padding: 40px 10px; color: var(--text-faint); }
.empty-state .big { font-size: 40px; margin-bottom: 8px; }
.empty-state strong { display: block; color: var(--text-soft); font-size: 15px; margin-bottom: 4px; }

.alert.success {
    padding: 12px 14px; border-radius: var(--radius-sm);
    background: rgba(18,153,107,.1); border: 1px solid rgba(18,153,107,.25);
    color: var(--ok); font-weight: 600; font-size: 13.5px; margin-bottom: 14px;
}

/* ---------------- Results toolbar ---------------- */
.results-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box input {
    width: 100%; padding: 10px 12px 10px 36px; border-radius: var(--radius-sm);
    border: 1px solid var(--card-border); background: var(--surface-solid);
    color: var(--text); font-size: 13.5px; outline: none;
}
.search-box input:focus { border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-tint); }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 14px; }
.toolbar-select {
    padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--card-border);
    background: var(--surface-solid); color: var(--text); font-size: 13.5px; cursor: pointer; outline: none;
}
.export-btn {
    padding: 10px 14px; border-radius: var(--radius-sm); border: none;
    font-weight: 700; font-size: 13px; cursor: pointer; color: #fff;
    display: inline-flex; align-items: center; gap: 7px;
    transition: transform .12s ease, box-shadow .12s ease;
}
.export-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.export-btn.csv { background: linear-gradient(135deg, var(--brand), var(--brand-500)); }
.export-btn.excel { background: linear-gradient(135deg, #12996b, #0f7d58); }
.export-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------------- Table ---------------- */
.table-wrap {
    border: 1px solid var(--card-border); border-radius: var(--radius-sm);
    overflow: auto; max-height: 66vh; background: var(--surface-solid);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    position: sticky; top: 0; z-index: 5; background: var(--brand); color: #fff;
    text-align: left; padding: 13px 16px; font-weight: 600; white-space: nowrap;
    font-size: 12.5px; letter-spacing: .3px; cursor: pointer; user-select: none;
}
thead th.no-sort { cursor: default; }
thead th .sort-ind { opacity: .7; font-size: 10px; margin-left: 4px; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--card-border); color: var(--text); vertical-align: middle; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--brand-tint); }
tbody tr:last-child td { border-bottom: none; }

.cell-name { font-weight: 700; }
.cell-name .cell-sub { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.rating-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(217,138,0,.12); color: var(--warn);
    padding: 3px 9px; border-radius: 999px; font-weight: 700; font-size: 12px;
}
.pill-link { display: inline-block; padding: 4px 11px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-500); font-weight: 600; font-size: 12px; }
.pill-link:hover { background: var(--brand-500); color: #fff; text-decoration: none; }
.muted { color: var(--text-faint); }
.addr-cell { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.action-btn {
    padding: 6px 12px; border-radius: 9px; border: 1px solid var(--brand-300);
    background: transparent; color: var(--brand-500); font-weight: 700; font-size: 12px; cursor: pointer;
    transition: all .12s ease;
}
.action-btn:hover { background: var(--brand-500); color: #fff; }

.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--brand-tint), rgba(0,0,0,.04), var(--brand-tint)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: 200% 0; } }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.pagination .page-info { font-size: 13px; color: var(--text-soft); }
.pagination .page-controls { display: flex; gap: 6px; align-items: center; }
.page-btn { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--card-border); background: var(--surface-solid); color: var(--text-soft); font-weight: 600; cursor: pointer; font-size: 13px; }
.page-btn:hover:not(:disabled) { color: var(--brand-500); border-color: var(--brand-300); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- Detail drawer ---------------- */
.drawer-overlay {
    position: fixed; inset: 0; background: rgba(10,13,26,.45);
    opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 90;
    backdrop-filter: blur(2px);
}
.drawer-overlay.open { opacity: 1; visibility: visible; }
.drawer {
    position: fixed; top: 0; right: 0; height: 100%; width: 440px; max-width: 92vw;
    background: var(--surface-solid); box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 100; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
    padding: 22px 22px 18px; border-bottom: 1px solid var(--card-border);
    background: linear-gradient(135deg, var(--brand), var(--brand-500)); color: #fff;
    position: relative;
}
.drawer-head h2 { margin: 0 40px 6px 0; font-size: 19px; font-weight: 800; line-height: 1.2; }
.drawer-head .drawer-cat { font-size: 13px; opacity: .9; }
.drawer-close {
    position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 9px;
    border: none; background: rgba(255,255,255,.2); color: #fff; font-size: 18px; cursor: pointer;
}
.drawer-close:hover { background: rgba(255,255,255,.35); }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.detail-group { margin-bottom: 20px; }
.detail-group h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--card-border); font-size: 13.5px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .dk { color: var(--text-soft); font-weight: 600; flex: none; }
.detail-row .dv { text-align: right; word-break: break-word; }
.social-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.social-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px;
    background: var(--brand-tint); color: var(--brand-500); font-weight: 700; font-size: 12.5px; text-decoration: none;
}
.social-chip:hover { background: var(--brand-500); color: #fff; text-decoration: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1200px) {
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar .fb-actions { grid-column: 1 / -1; display: flex; gap: 10px; }
    .filter-bar .fb-actions .primary-btn, .filter-bar .fb-actions .clear-btn { flex: 1; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .steps8 { grid-template-columns: repeat(4, 1fr); row-gap: 18px; }
    .step8 .connector { display: none; }
    .col-reviews, .col-address { display: none; }
}
@media (max-width: 720px) {
    .filter-bar { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .hero h1 { font-size: 22px; }
    .wrap { padding: 0 14px; }
    .brand .brand-sub, .brand .brand-divider { display: none; }
    .brand .brand-logo { height: 26px; }
    .col-rating, .col-website { display: none; }
    .drawer { width: 100%; }
}

/* actions column always visible */
.fb-actions { display: flex; flex-direction: column; gap: 8px; }
.fb-actions.inline { flex-direction: row; align-items: end; }
