/* ============ Painel Gate — design v2 ============ */
:root {
    --bg: #0a0e14;
    --bg-card: rgba(22, 27, 34, .75);
    --bg-solid: #161b22;
    --bg-hover: #1c232d;
    --border: #2d333b;
    --text: #e6edf3;
    --text-dim: #8b949e;
    --accent: #2ea043;
    --accent2: #3fb950;
    --accent-glow: rgba(46, 160, 67, .25);
    --warn: #d29922;
    --danger: #f85149;
    --info: #58a6ff;
    --purple: #bc8cff;
    --radius: 14px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* glows de fundo */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(600px 300px at 20% -5%, rgba(46,160,67,.10), transparent 60%),
        radial-gradient(500px 280px at 85% 0%, rgba(88,166,255,.07), transparent 60%),
        radial-gradient(700px 400px at 50% 110%, rgba(188,140,255,.05), transparent 60%);
    pointer-events: none;
    z-index: 0;
}
.container, .topbar, .footer { position: relative; z-index: 1; }

.hidden { display: none !important; }

/* ---------- topo ---------- */
.topbar {
    padding: 40px 24px 30px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(46,160,67,.06) 0%, transparent 100%);
}
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.logo-icon {
    width: 46px; height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #1f6f33, #2ea043);
    box-shadow: 0 4px 22px rgba(46,160,67,.4), inset 0 1px 0 rgba(255,255,255,.2);
    color: #fff;
}
.logo h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(90deg, #fff 30%, #3fb950 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    color: var(--text-dim);
    margin-top: 8px;
    font-size: .95rem;
}
.subtitle b { color: var(--accent2); font-weight: 600; }

/* ---------- container ---------- */
.container {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 30px 20px 70px;
    flex: 1;
}

/* ---------- formulário ---------- */
.scan-box {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,.4), 0 0 0 1px rgba(46,160,67,.06);
}
.input-group { display: flex; gap: 10px; flex-wrap: wrap; }

#urlInput {
    flex: 1;
    min-width: 220px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border .15s, box-shadow .15s;
}
#urlInput:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }

#maxPages {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-dim);
    padding: 0 12px;
    font-size: .88rem;
    cursor: pointer;
}

#scanBtn {
    background: linear-gradient(135deg, #238636, #2ea043);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    padding: 14px 30px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(46,160,67,.35);
}
#scanBtn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(46,160,67,.5); }
#scanBtn:active:not(:disabled) { transform: scale(.98); }
#scanBtn:disabled { opacity: .6; cursor: wait; }

.btn-loading { display: inline-flex; align-items: center; gap: 8px; }
.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* toggle modo profundo */
.deep-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 16px;
    font-size: .85rem;
    cursor: pointer;
    user-select: none;
}
.deep-toggle input {
    width: 17px; height: 17px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}
.deep-toggle em { color: var(--text-dim); font-style: normal; font-size: .78rem; }

.hint { margin-top: 14px; font-size: .8rem; color: var(--text-dim); line-height: 1.5; }

/* ---------- progresso ---------- */
.progress {
    margin-top: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.progress-step {
    color: var(--text-dim);
    font-size: .92rem;
    opacity: .35;
    transition: opacity .25s, color .25s;
}
.progress-step.active { opacity: 1; color: var(--text); }
.progress-step.active::after {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    margin-left: 8px;
    vertical-align: -2px;
    border: 2px solid var(--accent-glow);
    border-top-color: var(--accent2);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.progress-step.done { opacity: 1; color: var(--accent2); }

/* ---------- erro ---------- */
.error-box {
    margin-top: 20px;
    background: rgba(248,81,73,.08);
    border: 1px solid rgba(248,81,73,.4);
    border-radius: var(--radius);
    padding: 16px 20px;
    color: var(--danger);
    font-size: .93rem;
}

/* ---------- resultado ---------- */
.results { margin-top: 26px; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.result-header h2 { font-size: 1.15rem; word-break: break-all; }
.meta { color: var(--text-dim); font-size: .82rem; margin-top: 5px; }

.ghost-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-dim);
    padding: 9px 16px;
    font-size: .8rem;
    cursor: pointer;
    transition: all .15s;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent2); }

/* plataforma */
.platform-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warn);
    border-radius: var(--radius);
    padding: 15px 20px;
    margin-bottom: 24px;
}
.platform-card .tag {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--warn);
    font-weight: 700;
}
.platform-card strong { font-size: 1.05rem; }
.platform-card .conf { color: var(--text-dim); font-size: .82rem; margin-left: auto; flex-shrink: 0; }

/* seções */
.section-title {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    margin: 30px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* gateways */
.gateway-list { display: flex; flex-direction: column; gap: 12px; }

.gateway-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    cursor: pointer;
    transition: all .18s;
    position: relative;
}
.gateway-card:hover { background: var(--bg-hover); transform: translateY(-1px); border-color: rgba(46,160,67,.35); }
.gateway-card.primary { border-left: 3px solid var(--accent); }

.rank-badge {
    display: none;
    font-size: .64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #fff;
    background: linear-gradient(135deg, #238636, #3fb950);
    padding: 3px 9px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(46,160,67,.4);
}
.gateway-card.primary .rank-badge { display: inline-block; }

.gw-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gw-name { font-weight: 700; font-size: 1.02rem; }
.gw-cat {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(46,160,67,.12);
    color: var(--accent2);
    border: 1px solid rgba(46,160,67,.3);
}
.gw-cat.antifraude { background: rgba(210,153,34,.12); color: var(--warn); border-color: rgba(210,153,34,.3); }
.gw-cat.metodo { background: rgba(88,166,255,.12); color: var(--info); border-color: rgba(88,166,255,.3); }
.gw-cat.checkout { background: rgba(188,140,255,.12); color: var(--purple); border-color: rgba(188,140,255,.3); }

.gw-conf { margin-left: auto; font-weight: 800; font-size: 1rem; color: var(--accent2); }

.conf-bar {
    height: 6px;
    background: rgba(255,255,255,.06);
    border-radius: 3px;
    margin-top: 13px;
    overflow: hidden;
}
.conf-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #1f6f33, var(--accent2));
    box-shadow: 0 0 12px rgba(63,185,80,.5);
    transition: width .7s cubic-bezier(.22,1,.36,1);
}

.gw-evidence { margin-top: 13px; display: none; }
.gateway-card.open .gw-evidence { display: block; }
.ev-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 13px;
    margin-top: 8px;
    font-size: .78rem;
}
.ev-pattern { color: var(--accent2); font-weight: 600; font-family: ui-monospace, monospace; }
.ev-context {
    display: block;
    color: var(--text-dim);
    font-family: ui-monospace, monospace;
    font-size: .72rem;
    margin-top: 5px;
    word-break: break-all;
}
.ev-page { color: var(--info); font-size: .72rem; word-break: break-all; }

.hint-open {
    position: absolute;
    right: 18px;
    bottom: 12px;
    font-size: .68rem;
    color: var(--text-dim);
    opacity: .7;
}

.empty-state {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 26px;
    text-align: center;
    color: var(--text-dim);
    font-size: .9rem;
    line-height: 1.6;
}

/* páginas */
.pages-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.pages-list li {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 15px;
    font-size: .82rem;
    display: flex;
    gap: 10px;
    align-items: center;
    word-break: break-all;
}
.status-badge {
    flex-shrink: 0;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(46,160,67,.15);
    color: var(--accent2);
}
.src-badge {
    flex-shrink: 0;
    font-size: .65rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(88,166,255,.12);
    color: var(--info);
    border: 1px solid rgba(88,166,255,.25);
}
.page-bytes { margin-left: auto; color: var(--text-dim); font-size: .75rem; flex-shrink: 0; }

/* histórico */
.history { margin-top: 38px; }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.history-list li {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 15px;
    font-size: .85rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    transition: all .15s;
}
.history-list li:hover { border-color: var(--accent); transform: translateY(-1px); }
.history-list .h-date { color: var(--text-dim); font-size: .75rem; flex-shrink: 0; }

/* footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: .78rem;
    border-top: 1px solid var(--border);
}

/* ---------- responsivo ---------- */
@media (max-width: 560px) {
    .logo h1 { font-size: 1.6rem; }
    .input-group { flex-direction: column; }
    #maxPages { padding: 13px; }
    .gw-conf { margin-left: 0; width: 100%; }
    .platform-card .conf { margin-left: 0; }
}
