/* ============================================================
   Hiper Tecnologia API 2026 — Tema "Purple VIP"
   Paleta:
     --bg-deep:    #170B2E  (fundo profundo, quase preto-violeta)
     --bg-panel:   #241344  (superfície dos cartões)
     --violet:     #8B5CF6  (acento primário)
     --violet-2:   #B794F6  (acento secundário / hover)
     --gold:       #D4AF37  (detalhe premium/VIP, uso restrito)
     --ok:         #22C55E  (link ativo / distance=100)
     --warn:       #F5B942  (link secundário / distance=200)
     --danger:     #EF4444  (erro / host offline)
     --text-hi:    #F5F3FF
     --text-mid:   #C6BEDD
   Tipografia: "Manrope" (display/UI) + "Inter" (texto de apoio)
   ============================================================ */

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

:root {
  --bg-deep: #170B2E;
  --bg-panel: #241344;
  --bg-panel-2: #2E1A57;
  --violet: #8B5CF6;
  --violet-2: #B794F6;
  --violet-dim: #4C2E8F;
  --gold: #D4AF37;
  --ok: #22C55E;
  --warn: #F5B942;
  --danger: #EF4444;
  --text-hi: #F5F3FF;
  --text-mid: #C6BEDD;
  --text-dim: #8A7FB0;
  --radius: 14px;
  --shadow-glow: 0 8px 32px rgba(139, 92, 246, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 0%, #2a1656 0%, var(--bg-deep) 45%, #0d0620 100%);
  color: var(--text-hi);
  font-family: 'Inter', system-ui, sans-serif;
}

h1, h2, h3, .brand {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
}

a { color: var(--violet-2); text-decoration: none; }

::selection { background: var(--violet); color: #fff; }

/* ---------- Layout base ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1D0E3B 0%, #150A2C 100%);
  border-right: 1px solid rgba(139, 92, 246, 0.15);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  font-size: 1.15rem;
  color: var(--text-hi);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .vip-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: #1a1330;
  background: linear-gradient(135deg, var(--gold), #F1D98B);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-mid);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover, .nav-item.active {
  background: rgba(139, 92, 246, 0.18);
  color: var(--text-hi);
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar h1 { font-size: 1.5rem; margin: 0; }
.topbar .subtitle { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-mid);
}

/* ---------- Cartões ---------- */

.card {
  background: linear-gradient(160deg, var(--bg-panel) 0%, var(--bg-panel-2) 130%);
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-glow);
}

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

.host-card { display: flex; flex-direction: column; gap: 14px; }

.host-card .host-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.host-card .host-name { font-weight: 700; font-size: 1.02rem; color: var(--text-hi); }
.host-card .host-desc { color: var(--text-dim); font-size: 0.8rem; margin-top: 2px; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.online { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.uptime-row {
  font-size: 0.82rem;
  color: var(--text-mid);
  display: flex;
  justify-content: space-between;
}

.links-row { display: flex; gap: 14px; }

.link-block { flex: 1; text-align: center; }

.link-btn {
  width: 100%;
  padding: 10px 8px;
  border-radius: 10px;
  border: none;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #14101f;
  background: var(--text-dim);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.link-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.link-btn:active { transform: translateY(0); }
.link-btn.primary { background: linear-gradient(135deg, var(--ok), #16a34a); color: #06210f; }
.link-btn.secondary { background: linear-gradient(135deg, var(--warn), #e0983a); color: #2a1900; }
.link-btn.unknown { background: #3a3355; color: var(--text-mid); }
.link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.distance-label {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.distance-label b { color: var(--text-hi); }

/* ---------- Formulários ---------- */

label { font-size: 0.82rem; color: var(--text-mid); font-weight: 600; display: block; margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  background: #150A2C;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-hi);
  font-size: 0.9rem;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--violet);
  outline-offset: 1px;
}

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 10px;
  border: none;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--violet), #6D28D9);
  color: #fff;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; border: 1px solid rgba(139,92,246,0.4); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, var(--danger), #B91C1C); }

table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th { text-align: left; color: var(--text-dim); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid rgba(139,92,246,0.2); }
td { padding: 10px 12px; border-bottom: 1px solid rgba(139,92,246,0.08); color: var(--text-mid); }
tr:hover td { background: rgba(139, 92, 246, 0.06); }

.badge { font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.badge.admin { background: rgba(212, 175, 55, 0.18); color: var(--gold); }
.badge.user { background: rgba(139, 92, 246, 0.18); color: var(--violet-2); }
.badge.active { background: rgba(34, 197, 94, 0.18); color: var(--ok); }
.badge.inactive { background: rgba(239, 68, 68, 0.18); color: var(--danger); }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-panel);
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
  font-size: 0.85rem;
  z-index: 999;
  max-width: 320px;
}
.toast.error { border-color: rgba(239, 68, 68, 0.5); }

/* ---------- Página de login ---------- */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  text-align: center;
}

.login-card .brand-hero {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--violet-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-card .tagline { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 28px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-error { color: var(--danger); font-size: 0.82rem; margin-top: 10px; min-height: 18px; }

/* ---------- Responsivo ---------- */

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 14px 16px;
  }
  .sidebar .brand { display: none; }
  .main { padding: 20px; }
  .grid-hosts { grid-template-columns: 1fr; }
}

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