/* ============================================================
   ZERO — UI ENHANCEMENTS
   ============================================================ */

/* ---------- desktop sidebar collapse ---------- */

@media (min-width: 769px) {
  .burger { display: flex; }
  .sidebar { transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1); }
  .main { transition: margin-left 0.42s cubic-bezier(0.16, 1, 0.3, 1); }
  body.sidebar-collapsed .sidebar { transform: translateX(-101%); }
  body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-collapsed .burger svg { transform: rotate(180deg); }
}

.burger svg { transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.burger:hover svg { transform: scale(1.12); }
.burger:active { transform: scale(0.94); }

/* ---------- ambient background ---------- */

.app-page .bg-aura::before {
  content: "";
  position: absolute;
  inset: -25%;
  pointer-events: none;
  background:
    radial-gradient(38% 34% at 18% 14%, rgba(255, 255, 255, 0.055), transparent 70%),
    radial-gradient(32% 30% at 82% 22%, rgba(120, 160, 255, 0.05), transparent 72%),
    radial-gradient(46% 42% at 62% 88%, rgba(255, 255, 255, 0.035), transparent 70%);
  filter: blur(34px);
  animation: zAurora 24s ease-in-out infinite alternate;
}

@keyframes zAurora {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); opacity: 0.7; }
  100% { transform: translate3d(2%, 2%, 0) scale(1.08); opacity: 1; }
}

.app-page .bg-aura::after { animation: zGridDrift 30s linear infinite; }

@keyframes zGridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 72px 72px, 72px 72px; }
}

/* soft mouse spotlight */
.app-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(560px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, 0.045), transparent 62%);
  opacity: 1;
  transition: background 0.12s linear;
}

/* ---------- topbar ---------- */

.topbar { position: sticky; }
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  background-size: 200% 100%;
  animation: zTopline 6s linear infinite;
  opacity: 0.6;
  pointer-events: none;
}

@keyframes zTopline {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.topbar-title { transition: letter-spacing 0.35s ease, color 0.35s ease; }
.topbar-title:hover { letter-spacing: 0.24em; }

/* ---------- view entrance stagger ---------- */

.view.active > * {
  animation: zRise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.view.active > *:nth-child(1) { animation-delay: 0.02s; }
.view.active > *:nth-child(2) { animation-delay: 0.06s; }
.view.active > *:nth-child(3) { animation-delay: 0.10s; }
.view.active > *:nth-child(4) { animation-delay: 0.14s; }
.view.active > *:nth-child(5) { animation-delay: 0.18s; }
.view.active > *:nth-child(6) { animation-delay: 0.22s; }
.view.active > *:nth-child(7) { animation-delay: 0.26s; }

@keyframes zRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- nav ---------- */

.nav-item {
  position: relative;
  overflow: hidden;
  transition: color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.nav-item svg {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, color 0.25s ease;
}
.nav-item:hover svg { transform: translateX(2px) scale(1.1); }
.nav-item:active { transform: scale(0.985); }
.nav-item.active svg {
  transform: scale(1.12);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}
.nav-item.active::before { animation: zNavPulse 2.6s ease-in-out infinite; }

@keyframes zNavPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
}

.z-ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
  animation: zRipple 0.6s ease-out forwards;
}

@keyframes zRipple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---------- cards ---------- */

.stat-card,
.card,
.device-card,
.profile-card,
.graph-card {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              box-shadow 0.35s ease,
              background 0.3s ease;
}

.stat-card:hover,
.device-card:hover,
.profile-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 26px 55px -34px rgba(0, 0, 0, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.card:hover,
.graph-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px -40px rgba(0, 0, 0, 0.95);
}

.stat-card,
.card,
.profile-card {
  position: relative;
}

.profile-card { overflow: hidden; }

.stat-card::after,
.card::after {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
  transform: translateX(-120%);
  opacity: 0;
}

.stat-card:hover::after,
.card:hover::after {
  opacity: 1;
  animation: zSheen 1.1s ease;
}

@keyframes zSheen {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

/* ---------- buttons ---------- */

.btn-primary,
.btn-ghost,
.btn-danger {
  position: relative;
  overflow: hidden;
}
.btn-primary::after,
.btn-ghost::after,
.btn-danger::after {
  content: "";
  position: absolute;
  top: 0;
  left: -130%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn-primary:hover::after,
.btn-ghost:hover::after,
.btn-danger:hover::after { left: 140%; }
.btn-primary:active,
.btn-ghost:active,
.btn-danger:active { transform: scale(0.98); }

/* ---------- inputs ---------- */

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.input-field:focus { box-shadow: none; }

/* ---------- live dots ---------- */

.device-dot.live,
.pulse-dot {
  position: relative;
}
.device-dot.live::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.45);
  animation: zPing 1.8s ease-out infinite;
}

@keyframes zPing {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ---------- scroll progress ---------- */

.z-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 60;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), #ffffff);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.55);
  transition: width 0.08s linear;
}

/* ---------- back to top ---------- */

.z-backtop {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 55;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.z-backtop.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.z-backtop:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 26px rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

/* ---------- toast polish ---------- */

.toast { animation: zToastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes zToastIn {
  from { opacity: 0; transform: translateX(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- shimmer for loading ---------- */

.z-shimmer {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  background-size: 200% 100%;
  animation: zShimmer 1.6s linear infinite;
}

@keyframes zShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- scrollbar accent ---------- */

::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

/* ============================================================
   APP BACKGROUND — GIRL VIDEO
   ============================================================ */

.bg-video { display: none; }

.app-page .bg-video {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scaleX(-1);
  width: min(98vw, 1700px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  opacity: 0.3;
  filter: grayscale(0.4) contrast(1.06) blur(1px);
  pointer-events: none;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.95);
}

.app-page .bg-veil {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(5, 5, 5, 0.72);
}

.app-page .bg-veil::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

.app-page .scanlines {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(255, 255, 255, 0.025) 3px);
  animation: zScanmove 9s linear infinite;
}

@keyframes zScanmove {
  0% { background-position: 0 0; }
  100% { background-position: 0 6px; }
}

.app-page .vignette {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.6) 100%);
}

.app-page .bg-aura { background: transparent; }

/* ============================================================
   REMOVE GREEN ACCENTS + GLOW DOTS
   ============================================================ */

:root { --good: #a1a1aa; }

.nav-tag,
.graph-live-lbl,
.graph-live-dot,
.dev-live,
.device-dot,
.pulse-dot,
.live-pill i { display: none !important; }

.live-pill,
.graph-live {
  color: var(--text-secondary) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.graph-legend i {
  background: #a1a1aa !important;
  box-shadow: none !important;
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */

.z-reveal {
  opacity: 0;
  translate: 0 26px;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              translate 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, translate;
}
.z-reveal.in {
  opacity: 1;
  translate: 0 0;
}

/* ============================================================
   CLICK / PRESS FEEDBACK
   ============================================================ */

.card:active,
.stat-card:active,
.device-card:active,
.profile-card:active,
.graph-card:active {
  transform: scale(0.985);
  transition: transform 0.12s ease;
}

.btn:active,
.btn-primary:active,
.btn-ghost:active,
.btn-danger:active,
.login-btn:active { transform: scale(0.96); }

.nav-item:active { transform: scale(0.97); }

/* stronger sidebar transition */
.sidebar { transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease !important; }
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    transform: translateX(-105%);
    opacity: 0;
  }
}

/* page load */
.app-page .shell { animation: zPageIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes zPageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* overlay fade */
.sidebar-overlay.show { animation: zFade 0.28s ease both; }
@keyframes zFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================================
   FULL DARK THEME
   ============================================================ */

:root { color-scheme: dark; }

html,
body,
body.app-page,
body.login-new,
body.client-page {
  background: #050506;
}

body { color: #f2f2f4; }

.app-page .topbar { background: rgba(6, 6, 8, 0.9); }
.app-page .sidebar { background: rgba(7, 7, 9, 0.97); }
.app-page .card { background: rgba(10, 10, 12, 0.82); }
.app-page .stat-card { background: rgba(11, 11, 13, 0.78); }
.app-page .device-card,
.app-page .profile-card { background: rgba(255, 255, 255, 0.022); }

input,
textarea,
select {
  background-color: #0b0b0d;
  color: #f2f2f4;
  border-color: #24242a;
}

select option { background: #0b0b0d; color: #f2f2f4; }

input::placeholder,
textarea::placeholder { color: #5b5b66; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #f2f2f4;
  -webkit-box-shadow: 0 0 0 1000px #0b0b0d inset;
  box-shadow: 0 0 0 1000px #0b0b0d inset;
  transition: background-color 9999s ease-out 0s;
}

::selection { background: rgba(255, 255, 255, 0.22); color: #fff; }

* { scrollbar-color: #2a2a31 #050506; }
::-webkit-scrollbar-track { background: #050506; }
::-webkit-scrollbar-thumb { background: #2a2a31; }
::-webkit-scrollbar-thumb:hover { background: #3a3a43; }

/* ============================================================
   FULL CONTROL CONSOLE
   ============================================================ */

.cx-btn-fullcontrol {
  border: 1px solid #3a3a44;
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.03em;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03) inset, 0 6px 22px rgba(0,0,0,0.45);
}
.cx-btn-fullcontrol:hover {
  border-color: #6b6b78;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05));
}
.cx-btn-fullcontrol svg { width: 16px; height: 16px; }
.cx-btn-fullcontrol::after {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: #6ee7b7;
  box-shadow: 0 0 8px #6ee7b7;
  margin-left: 2px;
}
.cx-btn-fullcontrol.active {
  border-color: #6ee7b7;
  box-shadow: 0 0 0 1px rgba(110,231,183,0.35) inset, 0 0 22px rgba(110,231,183,0.28);
}

.fc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 6, 0.72);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.fc-overlay.open { opacity: 1; pointer-events: auto; }

.fc-panel {
  width: min(880px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(18,18,22,0.98), rgba(10,10,13,0.99));
  border: 1px solid #2a2a33;
  border-radius: 16px;
  box-shadow: 0 40px 120px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03) inset;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.16,1,0.3,1);
}
.fc-overlay.open .fc-panel { transform: none; }

.fc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #202028;
}
.fc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: #fff;
}
.fc-title small {
  font-weight: 400;
  letter-spacing: 0.06em;
  color: #6b6b78;
  text-transform: none;
  font-size: 10px;
}
.fc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6ee7b7;
  box-shadow: 0 0 10px #6ee7b7;
  animation: fcPulse 1.8s ease-in-out infinite;
}
.fc-dot.off { background: #f87171; box-shadow: 0 0 10px #f87171; animation: none; }
@keyframes fcPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.fc-close {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid #2a2a33;
  background: #14141a;
  color: #a1a1aa;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.fc-close:hover { color: #fff; border-color: #4a4a56; background: #1d1d25; }

.fc-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px 0;
}
.fc-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid #26262e;
  background: #101015;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #8b8b96;
}
.fc-pill i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4b4b56;
  transition: all 0.15s ease;
}
.fc-pill.on { color: #e8e8ec; border-color: #34343e; }
.fc-pill.on i { background: #6ee7b7; box-shadow: 0 0 7px #6ee7b7; }
.fc-pill.danger.on i { background: #f87171; box-shadow: 0 0 7px #f87171; }

.fc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding: 16px 22px;
}
.fc-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid #26262e;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  color: #d4d4d9;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.fc-tile:hover { border-color: #3c3c48; background: rgba(255,255,255,0.04); }
.fc-tile:active { transform: scale(0.985); }
.fc-tile.on {
  border-color: #4b5563;
  background: linear-gradient(180deg, rgba(110,231,183,0.10), rgba(110,231,183,0.02));
}
.fc-tile-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  border: 1px solid #2c2c35;
  background: #0d0d11;
  font-size: 16px;
  color: #c9c9d1;
}
.fc-tile.on .fc-tile-ico { color: #6ee7b7; border-color: #2f4f45; }
.fc-tile-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.fc-tile-body b {
  font-family: var(--font-sans, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  color: #f2f2f4;
}
.fc-tile-body small {
  font-size: 10.5px;
  color: #6b6b78;
  line-height: 1.35;
}
.fc-switch {
  position: relative;
  width: 38px; height: 20px;
  flex: 0 0 38px;
  border-radius: 999px;
  background: #26262e;
  border: 1px solid #33333d;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.fc-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #7a7a86;
  transition: transform 0.18s ease, background 0.18s ease;
}
.fc-tile.on .fc-switch { background: rgba(110,231,183,0.25); border-color: #3f6b5c; }
.fc-tile.on .fc-switch::after { transform: translateX(18px); background: #6ee7b7; }

.fc-go {
  font-size: 15px;
  color: #56565f;
  flex: 0 0 auto;
}
.fc-tile-danger { border-color: #3a2024; }
.fc-tile-danger:hover { border-color: #7f2a30; background: rgba(248,113,113,0.06); }
.fc-tile-danger .fc-tile-ico { color: #f87171; border-color: #48242a; }
.fc-tile-danger .fc-tile-body b { color: #fca5a5; }

.fc-note {
  margin: 0 22px 20px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid #26262e;
  background: #0d0d11;
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: #7c7c88;
}
.fc-note.bad { color: #fca5a5; border-color: #3a2024; }

@media (max-width: 640px) {
  .fc-grid { grid-template-columns: 1fr; padding: 14px; }
  .fc-head, .fc-status { padding-left: 14px; padding-right: 14px; }
  .fc-note { margin-left: 14px; margin-right: 14px; }
}
