/* =========================================================
   GLASS UI KIT — dark glassmorphism
   Troque as variáveis abaixo para adaptar à sua marca.
   ========================================================= */
:root {
  --bg-image: none; /* ex.: url("../img/bg.jpg") — imagem 3D abstrata escura */
  --bg-base: #0c0c0e;

  --glass-top: rgba(255, 255, 255, 0.08);
  --glass-bottom: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.18);
  --glass-blur: 20px;

  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.6);
  --text-3: rgba(255, 255, 255, 0.38);

  --green: #34d399;
  --violet: #8b7cf6;
  --cyan: #22d3ee;
  --blue: #60a5fa;
  --amber: #FFC72C;

  /* Paleta Byroepke (mesma do PMS/COMANDA) */
  --brand: #FFC72C;
  --brand-hi: #FFE08A;
  --brand-lo: #E08A00;
  --brand-soft: #FFF1BE;
  --ink: #2A2A2E;
  --linha: #FFF7DC;
  --font-display: "Poppins", "Inter", system-ui, sans-serif;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- FUNDO (o vidro precisa de algo atrás) ---------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg-base);
  background-image:
    var(--bg-image),
    radial-gradient(60% 50% at 15% 20%, rgba(255, 199, 44, 0.16), transparent 70%),
    radial-gradient(45% 40% at 85% 75%, rgba(224, 138, 0, 0.12), transparent 70%),
    linear-gradient(125deg, transparent 30%, rgba(255,255,255,0.05) 42%, transparent 48%),
    linear-gradient(55deg, transparent 55%, rgba(255,255,255,0.04) 63%, transparent 70%),
    linear-gradient(160deg, #1b1b1f 0%, #0c0c0e 60%);
  background-size: cover;
  background-position: center;
}

/* formas abstratas que dão “profundidade” ao desfoque */
.scene::before,
.scene::after {
  content: "";
  position: absolute;
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  filter: blur(2px);
}
.scene::before {
  width: 520px; height: 520px;
  top: -120px; right: 8%;
  background: linear-gradient(140deg, #34342b, #0d0d0f 70%);
  box-shadow: inset 20px 20px 60px rgba(255,255,255,0.06);
  transform: rotate(-18deg);
}
.scene::after {
  width: 640px; height: 420px;
  bottom: -160px; left: 10%;
  background: linear-gradient(200deg, #2a2820, #0b0b0d 70%);
  box-shadow: inset -20px -20px 80px rgba(255,255,255,0.05);
  transform: rotate(14deg);
}

/* ---------- A CLASSE PRINCIPAL ---------- */
.glass {
  background: linear-gradient(180deg, var(--glass-top) 0%, var(--glass-bottom) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 20px 40px -12px rgba(0, 0, 0, 0.6);
}

.glass-card {
  border-radius: var(--radius-md);
  padding: 16px;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s, border-color 0.35s;
  will-change: transform;
}
.glass-card.lift:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -1px 0 rgba(0,0,0,0.35),
    0 30px 50px -14px rgba(0,0,0,0.75);
}

/* ---------- LAYOUT ---------- */
.shell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  max-width: 1320px;
  margin: 32px auto;
  padding: 16px;
  border-radius: var(--radius-lg);
  min-height: calc(100vh - 64px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}
.logo {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.nav-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-btn.active {
  color: var(--text);
  background: rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.nav-btn.active::after {
  content: "";
  position: absolute;
  right: -10px; top: 10px;
  width: 3px; height: 20px;
  border-radius: 3px;
  background: var(--amber);
}
.sidebar .spacer { flex: 1; }

.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- TOPBAR ---------- */
.topbar { display: flex; align-items: center; gap: 16px; }
.search {
  display: flex; align-items: center; gap: 8px;
  width: 260px; max-width: 100%;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-3);
}
.search input {
  background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit; font-size: 13px; width: 100%;
}
.search input::placeholder { color: var(--text-3); }
.date { font-size: 12px; color: var(--brand-hi); }
.topbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-2);
  cursor: pointer;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-hi), var(--brand-lo));
  color: var(--ink);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
  border: 2px solid rgba(255,255,255,0.2);
}

/* ---------- TÍTULO DA SEÇÃO ---------- */
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-head h1 { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.section-head p { font-size: 12px; color: var(--text-2); }
.section-head .right { margin-left: auto; display: flex; gap: 8px; }
.pill {
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text); cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}

/* ---------- CARDS DE INTEGRAÇÃO ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .grid-3 { grid-template-columns: 1fr; } }
.int-card { display: flex; flex-direction: column; gap: 28px; min-height: 128px; }
.int-top { display: flex; justify-content: space-between; align-items: center; }
.int-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08);
}
.int-name { font-size: 14px; font-weight: 600; }
.int-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.int-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-2); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 8px var(--green); }
.status-dot.off { background: var(--text-3); box-shadow: none; }
.badge { padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,0.08); font-size: 10px; color: var(--text); }

/* toggle */
.toggle {
  position: relative;
  width: 34px; height: 20px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,0.14);
  cursor: pointer;
  transition: background 0.25s;
}
.toggle::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
}
.toggle[aria-checked="true"] { background: var(--brand); box-shadow: 0 0 12px rgba(255,199,44,0.45); }
.toggle[aria-checked="true"]::after { transform: translateX(14px); }

/* ---------- PAINÉIS INFERIORES ---------- */
.grid-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
}
.panel-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head span { font-size: 11px; color: var(--text-3); }
.legend { margin-left: auto; display: flex; gap: 12px; font-size: 11px; color: var(--text-2); }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }

/* gráfico de barras */
.chart { position: relative; height: 200px; display: flex; gap: 4px; padding-left: 44px; }
.chart .y-axis {
  position: absolute; left: 0; top: 0; bottom: 22px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 10px; color: var(--text-3);
}
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.chart .bars { display: flex; align-items: flex-end; gap: 4px; height: calc(100% - 22px); }
.chart .bar {
  width: 10px; border-radius: 6px 6px 3px 3px;
  height: 0;
  transition: height 0.9s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}
.chart .bar.in { background: linear-gradient(180deg, #a99cff, var(--violet)); }
.chart .bar.out { background: linear-gradient(180deg, #67e8f9, var(--cyan)); }
.chart .label { font-size: 10px; color: var(--text-3); height: 14px; }
.tooltip {
  position: absolute; pointer-events: none;
  padding: 4px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.92); color: #0b0c12;
  font-size: 10px; font-weight: 600; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -8px);
  transition: opacity 0.15s;
}

/* telemetria */
.telemetry { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.ring { width: 130px; height: 130px; }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: rgba(255,255,255,0.08); }
.ring .value { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); transform: rotate(-90deg); transform-origin: 50% 50%; }
.metrics { list-style: none; flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
.metrics li { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.metrics li b { margin-left: auto; white-space: nowrap; font-weight: 500; color: var(--cyan); }

/* entrada suave */
.reveal { opacity: 0; transform: translateY(12px); animation: reveal 0.7s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- RESPONSIVO ---------- */
@media (max-width: 900px) {
  .grid-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; margin: 0; border-radius: 0; padding: 16px; min-height: 100vh; }
  .sidebar {
    flex-direction: row; justify-content: space-around;
    padding: 6px; border-radius: var(--radius-md);
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 10;
    background: rgba(24, 24, 28, 0.6);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 12px 30px rgba(0,0,0,0.5);
  }
  .main { padding-bottom: 76px; }
  .shell.glass {
    background: transparent; border: 0; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .shell.reveal { animation: none; opacity: 1; transform: none; }
  .sidebar .logo, .sidebar .spacer { display: none; }
  .nav-btn.active::after { right: auto; top: auto; bottom: -6px; left: 10px; width: 20px; height: 3px; }
  .date { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* fallback para navegadores sem backdrop-filter */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(22, 24, 33, 0.92); }
}
