/* ==========================================================================
   affmain — token system
   Bối cảnh: dashboard thẩm định offer affiliate trên Uppromote Marketplace,
   dành cho người dùng kỹ thuật, quen làm việc với dữ liệu/spreadsheet.
   Định hướng: "terminal thẩm định" — tối, mono, tín hiệu rõ ràng (đạt/rủi ro),
   khác hẳn tông xanh-trắng kiểu SimilarWeb kinh điển.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --ink: #0B0E14;
    --panel: #12161F;
    --panel-2: #171C27;
    --line: #232937;
    --signal: #4FD1C5;
    --signal-dim: #2B6E68;
    --alert: #F2795A;
    --mid: #E8B84B;
    --paper: #E7ECF2;
    --muted: #7C8798;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --sans: 'Inter', system-ui, sans-serif;
    --radius: 3px;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--sans);
    line-height: 1.5;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
}

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

::selection { background: var(--signal-dim); color: var(--paper); }

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

.mono { font-family: var(--mono); }

.eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Topbar (dùng ở cả 2 trang) ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid var(--line);
}
.brand {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--paper);
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 8px var(--signal); }
.brand small { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- Landing / search ---------- */
.landing {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.terminal {
    width: 100%;
    max-width: 640px;
}
.terminal-window {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
}
.terminal-titlebar span {
    width: 10px; height: 10px; border-radius: 50%; background: var(--line);
}
.terminal-titlebar .path {
    margin-left: 8px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}
.terminal-body { padding: 28px 26px 30px; }
.terminal-body h1 {
    font-family: var(--mono);
    font-size: 20px;
    margin: 0 0 6px;
    color: var(--paper);
}
.terminal-body p.desc {
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 22px;
    max-width: 46ch;
}
.prompt-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--signal);
    margin-bottom: 12px;
}
.search-form {
    display: flex;
    gap: 10px;
}
.search-form input[type="text"] {
    flex: 1;
    background: var(--ink);
    border: 1px solid var(--line);
    color: var(--paper);
    font-family: var(--mono);
    font-size: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
}
.search-form input[type="text"]::placeholder { color: var(--muted); }
.search-form button {
    background: var(--signal);
    color: #062421;
    border: none;
    font-family: var(--mono);
    font-weight: 600;
    font-size: 13px;
    padding: 0 20px;
    border-radius: var(--radius);
    cursor: pointer;
}
.search-form button:hover { background: #63e3d6; }

.hint-row {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.hint-chip {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 4px 8px;
    border-radius: 999px;
}
.hint-chip:hover { border-color: var(--signal); color: var(--signal); cursor: pointer; }

.scope-note {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
    font-size: 12.5px;
    color: var(--muted);
}
.scope-note b { color: var(--paper); }

.footnote {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 18px;
    font-family: var(--mono);
}

/* ---------- Result dashboard ---------- */
.dash {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.breadcrumb {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}
.breadcrumb .cur { color: var(--paper); }
.new-lookup {
    font-family: var(--mono);
    font-size: 12px;
    border: 1px solid var(--line);
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--muted);
}
.new-lookup:hover { color: var(--signal); border-color: var(--signal); text-decoration: none; }

.grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 860px) {
    .grid { grid-template-columns: 1fr; }
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

/* Identity + score card (cột trái) */
.identity-card { padding: 22px; position: sticky; top: 20px; }
.identity-logo {
    width: 100%;
    aspect-ratio: 3/1.4;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 16px;
}
.identity-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.identity-logo .ph { font-family: var(--mono); color: var(--muted); font-size: 11px; }

.identity-name { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.identity-domain { font-family: var(--mono); font-size: 12px; color: var(--signal); word-break: break-all; }
.identity-slogan { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.gauge-wrap { display: flex; flex-direction: column; align-items: center; margin: 22px 0 6px; }
.gauge-num { font-family: var(--mono); font-size: 30px; font-weight: 700; }
.gauge-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }
.tone-good { color: var(--signal); }
.tone-mid { color: var(--mid); }
.tone-risk { color: var(--alert); }
.tone-neutral { color: var(--muted); }

.score-breakdown { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.score-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 7px; font-family: var(--mono); color: var(--muted); }
.score-row b { color: var(--paper); font-weight: 500; }

.identity-meta { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 12.5px; color: var(--muted); display: grid; gap: 6px; }
.identity-meta span.k { color: var(--muted); }
.identity-meta span.v { color: var(--paper); float: right; text-align: right; }

/* Sections cột phải */
.sections { display: flex; flex-direction: column; gap: 18px; }
.section { padding: 22px 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 6px; }
.section-head h2 { font-size: 13px; margin: 0; }
.section-sub { font-size: 12px; color: var(--muted); max-width: 60ch; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kv { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; background: var(--panel-2); }
.kv .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.kv .v { font-size: 15px; font-weight: 600; color: var(--paper); }
.kv .v.small { font-size: 13px; font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-family: var(--mono); font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); color: var(--paper); padding: 4px 9px; border-radius: 999px; }

.prose { font-size: 14px; color: var(--paper); }
.prose.muted { color: var(--muted); }

.divider-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--alert);
    border: 1px solid rgba(242,121,90,0.35);
    background: rgba(242,121,90,0.08);
    padding: 4px 9px;
    border-radius: 4px;
    margin-bottom: 14px;
}

details.raw { margin-top: 6px; }
details.raw summary {
    cursor: pointer;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    padding: 4px 0;
}
details.raw summary:hover { color: var(--signal); }
.raw-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-family: var(--mono); font-size: 12px; }
.raw-table tr { border-bottom: 1px solid var(--line); }
.raw-table td { padding: 7px 6px; vertical-align: top; }
.raw-table td.rk { color: var(--muted); width: 240px; white-space: nowrap; }
.raw-table td.rv { color: var(--paper); word-break: break-word; }

.empty-state, .setup-state {
    max-width: 640px;
    margin: 60px auto;
    padding: 30px;
    text-align: center;
}
.empty-state .glyph, .setup-state .glyph { font-family: var(--mono); font-size: 34px; color: var(--muted); margin-bottom: 10px; }
.empty-state h2, .setup-state h2 { font-size: 17px; margin: 6px 0; }
.empty-state p, .setup-state p { color: var(--muted); font-size: 13.5px; }
.setup-state pre {
    text-align: left;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 12px;
    overflow-x: auto;
    margin-top: 16px;
}

.product-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.product-card { flex: 0 0 150px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 10px; }
.product-card img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; margin-bottom: 8px; background: var(--ink); }
.product-card .pname { font-size: 12px; color: var(--paper); line-height: 1.3; }
.product-card .pprice { font-family: var(--mono); font-size: 11.5px; color: var(--signal); margin-top: 4px; }

@media (prefers-reduced-motion: no-preference) {
    .gauge-ring circle.fg { transition: stroke-dashoffset 900ms cubic-bezier(.2,.8,.2,1); }
}
