/* ===================== Tema & Tokens ===================== */
:root{
  --bg: #0b1220;            /* dark default, será sobrescrito no tema claro */
  --card: #0f172a;
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --border: #1f2937;
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --green: #10b981;
  --red:   #ef4444;
  --gray:  #6b7280;

  --chip-bg: rgba(255,255,255,.08);
  --chip-bd: rgba(255,255,255,.18);

  --btn-fg: #ffffff;
  --btn-green: #16a34a;
  --btn-red:   #dc2626;
  --btn-active:#64748b;

  --alert-bg: rgba(234,179,8,.12);
  --alert-bd: rgba(250,204,21,.45);
  --alert-fg: #facc15;

  --accent: #7c3aed;
}

/* Tema claro */
html[data-theme="light"]{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 10px 25px rgba(0,0,0,.08);

  --chip-bg: rgba(2,6,23,.06);
  --chip-bd: rgba(2,6,23,.08);

  --btn-fg: #ffffff;
  --btn-green: #10b981;
  --btn-red:   #ef4444;
  --btn-active:#6b7280;

  --alert-bg: #fff6d1;
  --alert-bd: #fde68a;
  --alert-fg: #92400e;
}

/* Reset e base */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background: radial-gradient(1200px 800px at -10% -20%, rgba(124,58,237,.10), transparent 60%),
              radial-gradient(1200px 800px at 110% 0%, rgba(20,184,166,.08), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  line-height: 1.45;
}

/* ===================== Topbar ===================== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:center;   /* <-- centraliza horizontalmente */
  padding:22px clamp(16px, 2.5vw, 32px);
  gap:18px;
  text-align:center;
}
.brand{display:flex; align-items:center; gap:14px}
.logo{
  width:38px; height:38px; border-radius:12px;
  background: linear-gradient(135deg, var(--accent), #22c55e);
  display:grid; place-items:center; color:#fff; font-weight:800; letter-spacing:.5px;
  box-shadow: var(--shadow);
}
.title h1{margin:0; font-size: clamp(20px, 2.3vw, 32px); font-weight:800}
.title{text-align:center;}
.title .subtitle{color:var(--muted); font-size:12px; margin-left:6px}

.actions{display:flex; align-items:center; gap:16px; flex-wrap:wrap}
.legend{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:7px 10px; border-radius:999px;
  font-size:12px; color:#fff; border:1px solid var(--chip-bd); background:var(--chip-bg);
}
.chip-green{background:rgba(16,185,129,.18); border-color:rgba(16,185,129,.35)}
.chip-red  {background:rgba(239,68,68,.20); border-color:rgba(239,68,68,.40)}
.chip-gray {background:rgba(107,114,128,.22); border-color:rgba(107,114,128,.40)}

.theme-toggle{
  display:inline-flex; align-items:center; gap:8px;
  background:transparent; border:1px solid var(--border); color:var(--text);
  padding:8px 12px; border-radius:12px; cursor:pointer;
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.theme-toggle:hover{ transform: translateY(-1px); background: rgba(127,127,127,.06); }
.theme-toggle .icon{ width:18px; height:18px; display:block; fill:currentColor; }
.theme-toggle .moon{ display: none; }
html[data-theme="dark"] .theme-toggle .sun{ display:none }
html[data-theme="dark"] .theme-toggle .moon{ display:block }
.toggle-text{ font-size:12px; color:var(--muted) }

/* ===================== Container / Grid ===================== */
.container{
  max-width:1200px; margin:0 auto; padding:0 clamp(16px, 2.5vw, 32px) 32px;
}
.alert{
  display:flex; gap:10px; align-items:center;
  background:var(--alert-bg); color:var(--alert-fg);
  border:1px solid var(--alert-bd); border-radius:14px; padding:12px 14px;
  margin: 4px 0 18px; box-shadow: var(--shadow);
}
.alert-dot{width:10px; height:10px; border-radius:999px; background:var(--alert-fg)}

.grid{
  display:grid; gap:14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ===================== VPN Card ===================== */
.vpn-item{margin:0}
.vpn-card{
  width:100%; border:1px solid var(--border); background:var(--card); color:var(--btn-fg);
  border-radius:16px; padding:16px; text-align:left; cursor:pointer;
  box-shadow: var(--shadow);
  transition: transform .08s ease, filter .2s ease, opacity .2s ease, border-color .2s ease;
  position:relative; overflow:hidden;
}
.vpn-card:hover{ transform: translateY(-1px); filter: brightness(1.03); }
.vpn-card:active{ transform: translateY(0) scale(.99); }

.vpn-card.running{ background: linear-gradient(180deg, var(--btn-green), #15803d); }
.vpn-card.down{    background: linear-gradient(180deg, var(--btn-red),   #991b1b); }
.vpn-card.active{  background: linear-gradient(180deg, var(--btn-active), #475569); }

.vpn-card-header{ display:flex; align-items:center; justify-content:space-between; gap:8px }
.vpn-name{ font-weight:800; font-size:18px; letter-spacing:.2px }
.vpn-sub{  font-size:12px; opacity:.85; margin-top:2px }

.status-dot{
  width:10px; height:10px; border-radius:999px; background:rgba(255,255,255,.9);
  box-shadow:0 0 0 2px rgba(255,255,255,.25) inset;
}

/* ===================== Empty ===================== */
.empty{
  grid-column: 1 / -1;
  background: transparent; border: 2px dashed var(--border); border-radius:16px;
}
.empty-inner{ padding:24px; text-align:center }
.empty-title{ font-weight:700; margin-bottom:6px }
.empty-sub{ color:var(--muted); font-size:14px }

/* ===================== Footer ===================== */
.footer{
  display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap;
  margin-top:18px; padding-top:16px; border-top:1px dashed var(--border);
}
.footer .gw{ font-size:15px }
.footer .hint{ color:var(--muted); font-size:12px }

/* ===================== Debug ===================== */
.debug{
  max-width:1200px; margin:18px auto 32px; padding:16px;
  background: #0b1020; color:#e5e7eb; border-radius:14px; box-shadow:var(--shadow);
  border:1px solid rgba(255,255,255,.08);
}
.debug h3{ margin:0 0 8px }
.debug pre{ margin:0; white-space:pre-wrap; word-break:break-word; font-size:12px }
