/* ===== CSS Variables for theming ===== */
:root {
  --cyan: #0091b3;
  --cyan2: #007a99;
  --cyan-glow: rgba(0,145,179,.1);
  --gradient: linear-gradient(135deg, #0091b3, #007a99);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s ease;
}

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

/* ===== Global ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,145,179,.3); border-radius: 3px; }

/* ===== Logo ===== */
.logo-text { font-size: 1.25rem; font-weight: 800; }
.logo-text span { font-weight: 400; opacity: .7; }

/* ===== Glassmorphism Nav ===== */
.nav-glass {
  transition: var(--transition);
  border-bottom: 1px solid transparent;
}
.nav-glass.scrolled {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: rgba(0,0,0,.08);
}
.dark .nav-glass.scrolled {
  border-bottom-color: rgba(255,255,255,.08);
}

/* ===== Buttons ===== */
.btn-cyan {
  background: var(--gradient);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0,145,179,.25);
}
.btn-cyan:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0,145,179,.35);
}

/* ===== Cards ===== */
.card-hover {
  transition: var(--transition);
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.1);
}
.dark .card-hover:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}

/* ===== Sparkline Canvas ===== */
.sparkline-canvas {
  width: 100% !important;
  height: 80px !important;
}

/* ===== Spinner ===== */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0,145,179,.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: #059669; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 50px;
  cursor: pointer;
  border: none;
  background: none;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: var(--transition);
}

/* ===== Form Inputs ===== */
.input-styled {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.input-styled:focus {
  border-color: var(--cyan) !important;
  box-shadow: 0 0 0 3px rgba(0,145,179,.1);
}

/* ===== Login Page ===== */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links-desktop { display: none !important; }
  .mobile-menu-btn { display: flex !important; }
}
@media (min-width: 769px) {
  .mobile-menu-btn { display: none !important; }
}

/* ===== View transitions ===== */
.view-enter {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Config toggle ===== */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--cyan) !important;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ===== Live dot pulse ===== */
.live-dot {
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== Device detail ===== */
/* deviceChart sized by parent container */
#deviceImage {
  transition: opacity 0.3s ease;
}
#deviceHeatmap > div {
  min-height: 0;
}
