/* ============================================================================
   TRADER HUNTER · Painel Admin
   Estética: terminal de trading profissional · dark theme · acentos âmbar
   ============================================================================ */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=JetBrains+Mono:wght@400;500;600;700&family=Manrope:wght@300;400;500;600;700;800&display=swap");

:root {
    /* === Backgrounds === */
    --bg-0:   #060607;          /* Mais profundo */
    --bg-1:   #0b0b0d;          /* Base */
    --bg-2:   #131316;          /* Cards */
    --bg-3:   #1c1c20;          /* Hover */
    --bg-4:   #25252a;          /* Borders elevadas */

    /* === Borders === */
    --br-1:   #1f1f24;
    --br-2:   #2a2a30;

    /* === Text === */
    --tx-1:   #f4f4f5;
    --tx-2:   #c9c9cf;
    --tx-3:   #8b8b95;
    --tx-4:   #5a5a64;

    /* === Accents === */
    --amber:      #f59e0b;
    --amber-soft: #fbbf24;
    --amber-glow: rgba(245, 158, 11, 0.25);

    --pos:    #34d399;
    --pos-bg: rgba(52, 211, 153, 0.12);
    --neg:    #f87171;
    --neg-bg: rgba(248, 113, 113, 0.12);

    --pending: #60a5fa;
    --pending-bg: rgba(96, 165, 250, 0.12);

    --warn:   #facc15;

    /* === Type === */
    --font-display: "Bricolage Grotesque", "Manrope", sans-serif;
    --font-body:    "Manrope", system-ui, -apple-system, sans-serif;
    --font-mono:    "JetBrains Mono", "SF Mono", Menlo, monospace;
}

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

html, body {
    background: var(--bg-0);
    color: var(--tx-1);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(245, 158, 11, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.03) 0%, transparent 40%);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--tx-1);
}

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

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.app--login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */
.sidebar {
    background: var(--bg-1);
    border-right: 1px solid var(--br-1);
    display: flex;
    flex-direction: column;
    padding: 24px 16px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--br-1);
    margin-bottom: 16px;
}

.sidebar__mark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 22px;
    color: var(--amber);
    line-height: 1;
    letter-spacing: -2px;
    text-shadow: 0 0 16px var(--amber-glow);
}

.sidebar__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.sidebar__sub {
    font-size: 10px;
    color: var(--tx-3);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--tx-2);
    font-weight: 500;
    font-size: 13.5px;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    position: relative;
}

.nav-btn:hover {
    background: var(--bg-2);
    color: var(--tx-1);
}

.nav-btn.is-active {
    background: var(--bg-2);
    color: var(--amber);
}

.nav-btn.is-active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--amber);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 12px var(--amber-glow);
}

.nav-btn .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tx-4);
}

.nav-btn .badge {
    margin-left: auto;
    background: var(--amber);
    color: #0c0c0c;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar__footer {
    border-top: 1px solid var(--br-1);
    padding-top: 16px;
    font-size: 12px;
    color: var(--tx-3);
}

.sidebar__footer button {
    color: var(--tx-3);
    font-size: 12px;
    padding: 6px 0;
}

.sidebar__footer button:hover { color: var(--amber); }

/* ============================================================================
   MAIN
   ============================================================================ */
.main {
    padding: 32px 40px 64px;
    max-width: 100%;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--br-1);
}

.page-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.page-sub {
    color: var(--tx-3);
    font-size: 13px;
    margin-top: 4px;
}

/* Hidden sections */
.section { display: none; }
.section.is-active { display: block; }

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: var(--bg-2);
    border: 1px solid var(--br-1);
    border-radius: 12px;
    padding: 20px;
}

.card--header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--br-1);
}

.card__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.card__sub {
    color: var(--tx-3);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 600;
}

/* ============================================================================
   STATS GRID
   ============================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat {
    background: var(--bg-2);
    border: 1px solid var(--br-1);
    border-radius: 12px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, var(--amber-glow) 200%);
    opacity: 0.4;
    pointer-events: none;
}

.stat__label {
    color: var(--tx-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
}

.stat__value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 28px;
    color: var(--tx-1);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat__hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--tx-3);
}

.stat__hint .pos { color: var(--pos); font-weight: 600; }
.stat__hint .neg { color: var(--neg); font-weight: 600; }

.stat--accent { border-color: rgba(245, 158, 11, 0.3); }
.stat--accent .stat__value { color: var(--amber); }

/* ============================================================================
   TABLE
   ============================================================================ */
.table-wrap {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    color: var(--tx-3);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 8px 12px;
    border-bottom: 1px solid var(--br-1);
    background: var(--bg-1);
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--br-1);
    vertical-align: middle;
}

tbody tr:hover { background: var(--bg-3); }

td.mono { font-family: var(--font-mono); font-size: 12.5px; }
td.right { text-align: right; }
td.center { text-align: center; }

/* ============================================================================
   STATUS BADGES
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.badge--active   { color: var(--pos);     background: var(--pos-bg);     }
.badge--pending  { color: var(--pending); background: var(--pending-bg); }
.badge--blocked  { color: var(--neg);     background: var(--neg-bg);     }
.badge--expired  { color: var(--warn);    background: rgba(250, 204, 21, 0.12); }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.06s;
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
    background: var(--amber);
    color: #0a0a0a;
}
.btn--primary:hover { background: var(--amber-soft); box-shadow: 0 8px 24px -10px var(--amber-glow); }

.btn--ghost {
    background: var(--bg-2);
    color: var(--tx-2);
    border-color: var(--br-2);
}
.btn--ghost:hover { background: var(--bg-3); color: var(--tx-1); }

.btn--success { background: var(--pos-bg); color: var(--pos); border-color: rgba(52,211,153,0.25); }
.btn--success:hover { background: rgba(52,211,153,0.2); }

.btn--danger { background: var(--neg-bg); color: var(--neg); border-color: rgba(248,113,113,0.25); }
.btn--danger:hover { background: rgba(248,113,113,0.2); }

.btn--sm { padding: 6px 10px; font-size: 12px; }
.btn--icon { padding: 6px 8px; }

/* ============================================================================
   FORM
   ============================================================================ */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.field__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--tx-3);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.input, .select, .textarea {
    background: var(--bg-1);
    border: 1px solid var(--br-2);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--tx-1);
    font-size: 14px;
    transition: border-color 0.12s, box-shadow 0.12s;
    width: 100%;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-glow);
}

.input--mono { font-family: var(--font-mono); font-size: 13px; }

.textarea { font-family: var(--font-mono); font-size: 12.5px; resize: vertical; min-height: 100px; }

/* ============================================================================
   TOOLBAR
   ============================================================================ */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar .input { width: auto; flex: 1; min-width: 240px; max-width: 420px; }
.toolbar .select { width: auto; min-width: 160px; }

.search {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 420px;
}

.search input {
    background: var(--bg-1);
    border: 1px solid var(--br-2);
    border-radius: 8px;
    padding: 10px 12px 10px 40px;
    width: 100%;
    color: var(--tx-1);
    font-size: 14px;
}

.search input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }

.search::before {
    content: "🔍";
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    pointer-events: none;
    opacity: 0.5;
}

/* ============================================================================
   MODAL
   ============================================================================ */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-bg.is-open { opacity: 1; pointer-events: auto; }

.modal {
    background: var(--bg-2);
    border: 1px solid var(--br-2);
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.7);
    transform: translateY(20px);
    transition: transform 0.25s;
}

.modal-bg.is-open .modal { transform: translateY(0); }

.modal__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.modal__sub {
    color: var(--tx-3);
    font-size: 13px;
    margin-bottom: 20px;
}

.modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--br-1);
}

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */
.login {
    width: 100%;
    max-width: 420px;
    padding: 36px;
    background: var(--bg-2);
    border: 1px solid var(--br-1);
    border-radius: 16px;
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
}

.login__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login__mark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 32px;
    color: var(--amber);
    line-height: 1;
    letter-spacing: -3px;
    text-shadow: 0 0 24px var(--amber-glow);
}

.login__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.04em;
}

.login__sub {
    font-size: 11px;
    color: var(--tx-3);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.login form { margin-top: 8px; }

.login .btn--primary { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; }

.login__error {
    background: var(--neg-bg);
    color: var(--neg);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(248, 113, 113, 0.2);
}
.login__error[hidden] { display: none; }

/* ============================================================================
   CHARTS / SPARKLINES
   ============================================================================ */
.chart-wrap {
    position: relative;
    width: 100%;
    height: 220px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100%;
    padding: 16px 0;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--amber-soft), var(--amber));
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    position: relative;
    transition: opacity 0.2s;
}

.chart-bar:hover { opacity: 0.8; }

.chart-bar__tip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-3);
    border: 1px solid var(--br-2);
    color: var(--tx-1);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
    margin-bottom: 4px;
}

.chart-bar:hover .chart-bar__tip { opacity: 1; }

.chart-axis {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--tx-4);
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--br-1);
}

/* ============================================================================
   LAYOUTS
   ============================================================================ */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1000px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

.text-mono { font-family: var(--font-mono); }
.text-pos  { color: var(--pos); }
.text-neg  { color: var(--neg); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--tx-3); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-bold { font-weight: 700; }

.empty {
    padding: 40px;
    text-align: center;
    color: var(--tx-3);
    font-size: 13px;
}

/* ============================================================================
   TOAST
   ============================================================================ */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 18px;
    background: var(--bg-3);
    border: 1px solid var(--br-2);
    border-radius: 10px;
    color: var(--tx-1);
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 380px;
    box-shadow: 0 16px 32px -10px rgba(0,0,0,0.4);
}

.toast.is-open { transform: translateX(0); }
.toast--success { border-color: rgba(52,211,153,0.3); color: var(--pos); }
.toast--error   { border-color: rgba(248,113,113,0.3); color: var(--neg); }

/* ============================================================================
   SPINNER
   ============================================================================ */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--tx-3);
    gap: 12px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 800px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; padding: 12px; align-items: center; }
    .sidebar__brand { padding: 0; border: none; margin: 0; flex: 1; }
    .sidebar__nav { flex-direction: row; overflow-x: auto; }
    .sidebar__footer { display: none; }
    .nav-btn.is-active::before { display: none; }
    .main { padding: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}


/* === Auto-approve switch (Usuarios > toggle) =================== */
.auto-approve-card { padding: 14px 16px; border-left: 3px solid #f59e0b; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch__slider {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    background: #1f2937;
    border-radius: 999px;
    transition: background 0.2s;
}
.switch__slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #94a3b8;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .switch__slider { background: #065f46; }
.switch input:checked + .switch__slider::before { transform: translateX(16px); background: #10b981; }
.switch__label { font-size: 13px; font-weight: 600; color: #cbd5e1; }
.switch input:checked ~ .switch__label { color: #34d399; }
