:root {
  --bg-primary: #020617; /* Very dark navy */
  --bg-secondary: #0f172a; /* Slightly lighter navy for cards */
  --bg-tertiary: #1e293b; /* Even lighter for hover states */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --gradient-primary: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-cyan) 100%);
  --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 3.5rem; letter-spacing: -0.02em; }
h2 { font-size: 2.5rem; letter-spacing: -0.01em; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.25rem; margin-bottom: 0.5rem; }
p { color: var(--text-secondary); margin-bottom: 1rem; }

/* Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.w-100 { width: 100%; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.gap-2 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }

/* Glassmorphism */
.glass-panel {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  gap: 8px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
  background: #059669;
}

.btn-outline {
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  background: transparent;
}

.btn-outline:hover {
  background: rgba(6, 182, 212, 0.1);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.05);
}

.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 50;
  padding: 24px 0;
}

.sidebar-brand {
  padding: 0 24px 32px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-item:hover, .nav-item.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
}

.nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.top-bar {
  height: 72px;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.search-bar {
  position: relative;
  width: 320px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-icon-placeholder {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  opacity: 0.5;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--accent-danger);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
}

.content-wrapper {
  padding: 32px;
}

/* Cards & Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.metric-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.metric-trend {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--accent-emerald); }
.trend-down { color: var(--accent-danger); }

/* Charts */
.chart-container {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 32px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-placeholder {
  flex: 1;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0) 100%);
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20px;
  gap: 10px;
}

.bar {
  width: 100%;
  background: var(--accent-emerald);
  border-radius: 4px 4px 0 0;
  opacity: 0.6;
  transition: height 0.3s ease;
}

.bar:hover {
  opacity: 1;
}

/* Device Cards */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.device-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.device-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: rgba(16, 185, 129, 0.3);
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.device-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 1.5rem;
}

.toggle-switch {
  width: 48px;
  height: 28px;
  background: var(--bg-tertiary);
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch.active {
  background: var(--accent-emerald);
}

.toggle-knob {
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 4px;
  left: 4px;
  transition: transform 0.3s;
}

.toggle-switch.active .toggle-knob {
  transform: translateX(20px);
}

.device-info h3 {
  font-size: 1.125rem;
  margin-bottom: 4px;
}

.device-status {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online { background: var(--accent-emerald); }
.status-dot.offline { background: var(--accent-danger); }

/* Tables */
.table-container {
  background: var(--bg-secondary);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
  background: rgba(2, 6, 23, 0.3);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Notifications */
.notification-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.notification-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.2s;
}

.notification-item:hover {
  transform: translateX(4px);
  border-left: 4px solid var(--accent-cyan);
}

.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.notif-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }
.notif-icon.info { background: rgba(6, 182, 212, 0.1); color: var(--accent-cyan); }

.notif-content h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.notif-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Form Styles for Login/Signup */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(6, 182, 212, 0.1), transparent 40%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 40%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 48px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-card);
}

.form-group { margin-bottom: 24px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.875rem; }
.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

/* Landing Page Specifics */
.navbar {
  position: fixed;
  top: 0; left: 0; width: 100%; z-index: 1000;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px 0;
}
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none;}
.logo-icon { width: 24px; height: 24px; background: var(--gradient-primary); border-radius: 50%; }
.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent-emerald); }

.hero {
  padding-top: 160px; padding-bottom: 80px;
  background: radial-gradient(circle at top right, rgba(6, 182, 212, 0.1), transparent 40%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 40%);
}

.footer { background: #000; padding: 64px 0 32px; border-top: 1px solid rgba(255, 255, 255, 0.05); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .nav-links { display: none; }
  h1 { font-size: 2.5rem; }
  .metrics-grid { grid-template-columns: 1fr; }
}
