/* ============================================================
   GATEWAY PANEL — tema "Terminal Hacker Pro"
   Tokens semânticos + animações. Todas as classes antigas mantidas.
   ============================================================ */

:root {
  /* superfícies */
  --bg: #070b12;
  --bg-secondary: #0c1220;
  --bg-tertiary: #121b2e;
  --border: #1d2b45;
  --border-soft: #16213a;

  /* texto (contraste AA sobre --bg) */
  --text: #d9e4f1;
  --text-muted: #8296b1;

  /* acentos */
  --accent: #00e59b;          /* verde matrix */
  --accent-hover: #3cffc0;
  --accent-2: #22d3ee;        /* ciano */
  --glow: rgba(0, 229, 155, 0.28);
  --glow-2: rgba(34, 211, 238, 0.22);

  /* estados */
  --success: #00e59b;
  --success-bg: rgba(0, 229, 155, 0.10);
  --warning: #f5b849;
  --warning-bg: rgba(245, 184, 73, 0.12);
  --danger: #ff5c6c;
  --danger-bg: rgba(255, 92, 108, 0.10);

  --sidebar-width: 248px;
  --radius: 10px;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, ui-monospace, monospace;

  /* ritmo de animação unificado */
  --t-fast: 150ms;
  --t-med: 250ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { height: 100%; width: 100%; }

body {
  font-family: var(--font-mono);
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* fundo: grid sutil + brilho radial no topo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 229, 155, 0.06), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(130, 150, 177, 0.045) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(130, 150, 177, 0.045) 31px 32px);
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #05130d; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2c405f; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ============ animações ============ */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blink    { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 0 var(--glow); } 50% { box-shadow: 0 0 0 6px transparent; } }
@keyframes shimmer  { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes scanline { from { top: -10%; } to { top: 110%; } }

/* entrada em cascata do conteúdo */
.content > * { animation: fadeUp var(--t-med) var(--ease-out) backwards; }
.content > *:nth-child(1) { animation-delay: 0ms; }
.content > *:nth-child(2) { animation-delay: 50ms; }
.content > *:nth-child(3) { animation-delay: 100ms; }
.content > *:nth-child(4) { animation-delay: 150ms; }
.content > *:nth-child(5) { animation-delay: 200ms; }
.content > *:nth-child(6) { animation-delay: 250ms; }
.content > *:nth-child(n+7) { animation-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ layout ============ */
.app-layout { display: flex; height: 100vh; overflow: hidden; position: relative; z-index: 1; }
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.content { flex: 1; padding: 28px; overflow-y: auto; }

/* ============ sidebar ============ */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg) 140%);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 20px 0 16px;
  flex-shrink: 0;
}
.logo {
  padding: 4px 20px 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo .logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04120c;
  box-shadow: 0 0 18px var(--glow);
}
.logo .logo-text small { display: block; font-size: 9px; font-weight: 500; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }
.logo .cursor { display: inline-block; width: 8px; height: 15px; background: var(--accent); margin-left: 4px; vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }

.nav-section { padding: 0 12px; flex: 1; overflow-y: auto; }
.nav-section-title {
  font-size: 10px; text-transform: uppercase; color: var(--text-muted);
  padding: 8px 12px 6px; letter-spacing: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-muted); font-size: 13px; margin-bottom: 2px;
  border-left: 2px solid transparent;
  transition: background var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) ease;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--bg-tertiary); color: var(--text); transform: translateX(2px); }
.nav-item.nav-active, .nav-active {
  background: linear-gradient(90deg, rgba(0, 229, 155, 0.12), transparent 80%);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-active svg { opacity: 1; }

.sidebar-foot {
  padding: 12px 20px 0; border-top: 1px solid var(--border-soft);
  font-size: 10px; color: var(--text-muted); letter-spacing: 1px;
}
.sidebar-foot .status-dot { margin-right: 6px; }

/* ============ topbar ============ */
.topbar {
  height: 58px;
  background: rgba(12, 18, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0; gap: 16px;
}
.topbar .crumb { font-size: 12px; color: var(--text-muted); letter-spacing: 0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb b { color: var(--accent); font-weight: 600; }
.actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.timestamp { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.user-badge {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 12px; cursor: pointer;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  transition: color var(--t-fast) ease, border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.user-badge:hover { color: var(--danger); border-color: var(--danger); box-shadow: 0 0 12px var(--danger-bg); }

.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); animation: pulseDot 2s ease-out infinite;
}
.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--success); letter-spacing: 1px;
  padding: 5px 12px; border: 1px solid rgba(0, 229, 155, 0.3); border-radius: 999px;
  background: var(--success-bg);
}

/* ============ botões ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(135deg, var(--accent), #00c9a0);
  color: #04120c;
  border: none; padding: 9px 18px; border-radius: 8px;
  font-weight: 700; cursor: pointer; font-size: 13px; font-family: inherit;
  letter-spacing: 0.3px;
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, filter var(--t-fast) ease;
  box-shadow: 0 0 0 transparent;
  min-height: 38px;
}
.btn:hover { filter: brightness(1.1); box-shadow: 0 4px 22px var(--glow); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none; font-weight: 600;
}
.btn-outline:hover { background: var(--bg-tertiary); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 14px var(--glow); }
.btn-sm { padding: 5px 12px; font-size: 12px; min-height: 30px; }
.btn-success { background: linear-gradient(135deg, var(--accent), #00c9a0); }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 12px var(--danger-bg); background: var(--danger-bg); }
.btn-accent-text { color: var(--accent-2); }
.btn-accent-text:hover { border-color: var(--accent-2); color: var(--accent-2); box-shadow: 0 0 12px var(--glow-2); }

/* ============ inputs ============ */
.input, .select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 13px;
  color: var(--text); font-size: 13px; font-family: inherit;
  width: 100%; outline: none; min-height: 38px;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 229, 155, 0.12); }
.input::placeholder { color: #56688a; }
.select { cursor: pointer; }

label.field-label {
  display: block; font-size: 11px; font-weight: 600; margin-bottom: 6px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px;
}
label.field-label::before { content: '// '; color: var(--accent); opacity: 0.7; }

/* ============ alertas ============ */
.alert {
  padding: 13px 16px; border-radius: var(--radius); font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px; line-height: 1.5;
  border: 1px solid; border-left-width: 3px;
}
.alert-info    { background: rgba(34, 211, 238, 0.08);  border-color: rgba(34, 211, 238, 0.35);  color: var(--accent-2); }
.alert-warning { background: var(--warning-bg); border-color: rgba(245, 184, 73, 0.4);  color: var(--warning); }
.alert-success { background: var(--success-bg); border-color: rgba(0, 229, 155, 0.4);   color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border-color: rgba(255, 92, 108, 0.4);  color: var(--danger); }

/* ============ cabeçalho da página ============ */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
.page-title::before { content: '> '; color: var(--accent); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.section-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text); }
.section-title::before { content: '# '; color: var(--accent-2); }

/* ============ cards ============ */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.card {
  background: linear-gradient(160deg, var(--bg-secondary), rgba(12, 18, 32, 0.6));
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
  transition: transform var(--t-med) var(--ease-out), border-color var(--t-med) ease, box-shadow var(--t-med) ease;
}
.card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
  opacity: 0; transition: opacity var(--t-med) ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--border); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 18px rgba(0, 229, 155, 0.06); }
.card:hover::after { opacity: 1; }
.card-title { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; letter-spacing: 1.5px; }
.card-value { font-size: 28px; font-weight: 700; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.card-change { font-size: 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.card-change.positive { color: var(--success); }
.card-change.negative { color: var(--danger); }
.card-change.neutral { color: var(--text-muted); }

.section-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 24px; margin-bottom: 24px;
  transition: border-color var(--t-med) ease;
}
.section-box:hover { border-color: var(--border); }

/* ============ janela terminal (novo) ============ */
.term {
  background: #0a0f1a; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; position: relative;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.term-head {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-tertiary); border-bottom: 1px solid var(--border-soft);
  padding: 10px 14px; font-size: 11px; color: var(--text-muted); letter-spacing: 1px;
}
.term-dot { width: 11px; height: 11px; border-radius: 50%; }
.term-dot.r { background: #ff5f57; } .term-dot.y { background: #febc2e; } .term-dot.g { background: #28c840; }
.term-title { margin-left: 8px; }
.term-body { padding: 18px; font-size: 12.5px; overflow-x: auto; }
.term-body .ln { display: block; padding: 2px 0; white-space: pre-wrap; word-break: break-all; }
.term-body .p { color: var(--accent); user-select: none; }
.term-body .c { color: var(--text-muted); }
.term-body .v { color: var(--accent-2); }
.term::before {
  content: ''; position: absolute; left: 0; right: 0; height: 60px; top: -10%;
  background: linear-gradient(180deg, transparent, rgba(0, 229, 155, 0.035), transparent);
  animation: scanline 7s linear infinite; pointer-events: none;
}

/* ============ tabelas ============ */
.table-container {
  background: var(--bg-secondary); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: hidden; overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  padding: 12px 16px; text-align: left; color: var(--text-muted); font-weight: 600;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: rgba(18, 27, 46, 0.5);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast) ease; }
tbody tr:hover td { background: rgba(18, 27, 46, 0.65); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* badges de status (novo) */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  border: 1px solid; letter-spacing: 0.5px;
}
.badge-ok     { color: var(--success); border-color: rgba(0, 229, 155, 0.35); background: var(--success-bg); }
.badge-warn   { color: var(--warning); border-color: rgba(245, 184, 73, 0.4); background: var(--warning-bg); }
.badge-danger { color: var(--danger);  border-color: rgba(255, 92, 108, 0.4); background: var(--danger-bg); }

/* ============ provider cards ============ */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.provider-card {
  background: var(--bg-secondary); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px; cursor: pointer; display: block;
  transition: border-color var(--t-fast) ease, transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.provider-card:hover { border-color: var(--border); transform: translateY(-2px); }
.provider-card.active {
  border-color: var(--accent);
  background: linear-gradient(160deg, rgba(0, 229, 155, 0.07), var(--bg-secondary));
  box-shadow: 0 0 22px rgba(0, 229, 155, 0.10);
}
.provider-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.provider-name { font-weight: 700; font-size: 14px; }
.free-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 2px 7px;
  background: var(--success-bg);
}
.provider-desc { font-size: 12px; color: var(--text-muted); line-height: 1.55; margin-bottom: 8px; }
.provider-link { font-size: 12px; color: var(--accent-2); }
.provider-link:hover { text-decoration: underline; }

/* ============ chips de modelo ============ */
.model-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-tertiary); color: var(--text-muted);
  transition: border-color var(--t-fast) ease, color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.model-chip:hover { border-color: var(--accent-2); color: var(--accent-2); box-shadow: 0 0 10px var(--glow-2); }
.model-chip.checked { background: rgba(0, 229, 155, 0.1); border-color: var(--accent); color: var(--accent); }

/* ============ login ============ */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); position: relative; z-index: 1; padding: 20px; }
.auth-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 14px; padding: 0; width: 460px; max-width: 94vw;
  overflow: hidden; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 40px rgba(0, 229, 155, 0.05);
  animation: fadeUp 0.45s var(--ease-out);
}
.auth-inner { padding: 30px 38px 34px; }
.auth-logo { font-size: 21px; font-weight: 700; margin-bottom: 4px; text-align: center; letter-spacing: 0.5px; }
.auth-logo .cursor { display: inline-block; width: 9px; height: 17px; background: var(--accent); margin-left: 5px; vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
.auth-subtitle { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 24px; letter-spacing: 0.5px; }
.auth-field { margin-bottom: 16px; }
.auth-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 16px; opacity: 0.7; }
.auth-tabs { display: flex; margin-bottom: 22px; border: 1px solid var(--border); border-radius: 9px; padding: 4px; gap: 4px; background: var(--bg); }
.auth-tab {
  flex: 1; text-align: center; padding: 9px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--text-muted); border-radius: 6px;
  transition: all var(--t-fast) ease;
}
.auth-tab:hover { color: var(--text); background: var(--bg-tertiary); }
.auth-tab.active { color: #04120c; background: linear-gradient(135deg, var(--accent), #00c9a0); box-shadow: 0 2px 14px var(--glow); }
.auth-tab input[type="radio"] { display: none; }
.auth-panel { display: none; }
.auth-panel.active { display: block; animation: fadeUp var(--t-med) var(--ease-out); }

/* ============ botão copiar ============ */
.copy-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; font-size: 11px; padding: 3px 10px; border-radius: 6px;
  font-family: inherit; line-height: 1.5;
  transition: all var(--t-fast) ease;
}
.copy-btn:hover { background: var(--bg-tertiary); color: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--glow); }
.copy-btn.copied { background: var(--success-bg); color: var(--success); border-color: var(--success); }

/* toast global */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: linear-gradient(135deg, var(--accent), #00c9a0); color: #04120c;
  padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 30px var(--glow);
  animation: fadeUp var(--t-med) var(--ease-out);
}

/* código inline */
code {
  background: var(--bg-tertiary); border: 1px solid var(--border-soft);
  padding: 1px 6px; border-radius: 5px; font-size: 12px; font-family: var(--font-mono);
}
pre { font-family: var(--font-mono); }
pre code { background: none; border: none; padding: 0; }

/* skeleton opcional */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, #1a2540 37%, var(--bg-tertiary) 63%);
  background-size: 400px 100%; animation: shimmer 1.4s infinite linear; border-radius: 6px;
}

/* ============ utilitários ============ */
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }

/* ============ responsivo ============ */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform var(--t-med) var(--ease-out); }
  .sidebar.open { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.5); }
  .menu-toggle { display: inline-flex !important; }
  .content { padding: 18px; }
  .topbar { padding: 0 14px; }
  .timestamp { display: none; }
}
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 7px 10px; cursor: pointer; align-items: center;
}
