/* ============================================================
   AGM MISSION CONTROL — Design System
   Aqua-Guard Management | Professional Pool Management
   Deep Nebula Blue + Cosmic Purple + Luminescent Emerald
   ============================================================ */

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

/* --- CSS Custom Properties --- */
:root {
  /* Core Colors */
  --bg-primary: #020024;
  --bg-secondary: #0a0a2e;
  --bg-tertiary: #111140;
  
  /* Gradient Accent Stops */
  --accent-purple: #4A00E0;
  --accent-amethyst: #8E2DE2;
  --accent-emerald: #00C9A7;
  --accent-cyan: #00D4FF;
  
  /* Semantic Colors */
  --status-green: #00E676;
  --status-yellow: #FFD600;
  --status-red: #FF5252;
  --status-blue: #448AFF;
  --status-orange: #FF9100;
  
  /* Glassmorphism */
  --glass-bg: rgba(10, 10, 25, 0.15);
  --glass-bg-hover: rgba(10, 10, 25, 0.25);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(255, 255, 255, 0.25);
  --glass-blur: 20px;
  
  /* Typography */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.45);
  --text-accent: #00C9A7;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-purple: 0 0 30px rgba(142, 45, 226, 0.3);
  --shadow-glow-emerald: 0 0 30px rgba(0, 201, 167, 0.3);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --content-max: 1400px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a { color: var(--accent-emerald); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-cyan); }

img { max-width: 100%; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button { cursor: pointer; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* --- Animated Background --- */
.bg-fluid {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-fluid .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: blobFloat 20s infinite ease-in-out;
}

.bg-fluid .blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
  top: -10%; left: -5%;
  animation-duration: 25s;
}

.bg-fluid .blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-amethyst), transparent 70%);
  top: 50%; right: -10%;
  animation-duration: 20s;
  animation-delay: -5s;
}

.bg-fluid .blob-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, var(--accent-emerald), transparent 70%);
  bottom: -5%; left: 30%;
  animation-duration: 22s;
  animation-delay: -10s;
}

.bg-fluid .blob-4 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.5), transparent 70%);
  top: 30%; left: 50%;
  animation-duration: 18s;
  animation-delay: -7s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, -40px) scale(1.1); }
  50% { transform: translate(-30px, 50px) scale(0.95); }
  75% { transform: translate(40px, 20px) scale(1.05); }
}

/* --- App Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  background: rgba(2, 0, 36, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base), width var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 72px;
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand .brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
}

.nav-section {
  margin-bottom: var(--space-lg);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-tertiary);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(74, 0, 224, 0.2), rgba(0, 201, 167, 0.1));
  border: 1px solid rgba(0, 201, 167, 0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, var(--accent-amethyst), var(--accent-emerald));
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 82, 82, 0.2);
  color: var(--status-red);
}

.nav-item .nav-badge.green {
  background: rgba(0, 230, 118, 0.15);
  color: var(--status-green);
}

.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--glass-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  display: flex;
  flex-direction: column;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  position: relative;
}

/* --- Top Header Bar --- */
.top-bar {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  background: rgba(2, 0, 36, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-bar-left .page-title {
  font-size: 18px;
  font-weight: 700;
}

.top-bar-left .breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
}

.top-bar-left .breadcrumb a {
  color: var(--text-tertiary);
}

.top-bar-left .breadcrumb a:hover {
  color: var(--text-primary);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.menu-toggle:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-bar-search {
  position: relative;
}

.top-bar-search input {
  width: 240px;
  padding: 8px 16px 8px 36px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.top-bar-search input::placeholder {
  color: var(--text-tertiary);
}

.top-bar-search input:focus {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-emerald);
  width: 300px;
}

.top-bar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-tertiary);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.icon-btn .notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-red);
}

/* --- Page Content --- */
.page-content {
  padding: var(--space-xl);
  max-width: var(--content-max);
}

/* --- Glass Card --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.glass-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
}

.glass-card.no-hover:hover {
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

/* --- Stat Cards --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  padding: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card .stat-icon.purple {
  background: rgba(142, 45, 226, 0.15);
  color: var(--accent-amethyst);
}

.stat-card .stat-icon.emerald {
  background: rgba(0, 201, 167, 0.15);
  color: var(--accent-emerald);
}

.stat-card .stat-icon.blue {
  background: rgba(68, 138, 255, 0.15);
  color: var(--status-blue);
}

.stat-card .stat-icon.red {
  background: rgba(255, 82, 82, 0.15);
  color: var(--status-red);
}

.stat-card .stat-icon.yellow {
  background: rgba(255, 214, 0, 0.15);
  color: var(--status-yellow);
}

.stat-card .stat-icon.orange {
  background: rgba(255, 145, 0, 0.15);
  color: var(--status-orange);
}

.stat-card .stat-info {
  display: flex;
  flex-direction: column;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card .stat-change.up { color: var(--status-green); }
.stat-card .stat-change.down { color: var(--status-red); }

/* --- Section Headers --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.section-header .section-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-amethyst));
  color: white;
  box-shadow: var(--shadow-glow-purple);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 40px rgba(142, 45, 226, 0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--glass-border-hover);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-emerald), #00E5A0);
  color: #020024;
  font-weight: 700;
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-emerald);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-green { background: rgba(0, 230, 118, 0.12); color: var(--status-green); }
.badge-green::before { background: var(--status-green); }
.badge-yellow { background: rgba(255, 214, 0, 0.12); color: var(--status-yellow); }
.badge-yellow::before { background: var(--status-yellow); }
.badge-red { background: rgba(255, 82, 82, 0.12); color: var(--status-red); }
.badge-red::before { background: var(--status-red); }
.badge-blue { background: rgba(68, 138, 255, 0.12); color: var(--status-blue); }
.badge-blue::before { background: var(--status-blue); }
.badge-purple { background: rgba(142, 45, 226, 0.12); color: var(--accent-amethyst); }
.badge-purple::before { background: var(--accent-amethyst); }

/* --- Tables --- */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  padding: var(--space-md) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: rgba(2, 0, 36, 0.9);
  backdrop-filter: blur(10px);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.data-table tbody td {
  padding: var(--space-md);
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

/* --- Grid layouts --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

/* --- Pool Grid --- */
.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.pool-card {
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.pool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.pool-card .pool-card-header {
  padding: var(--space-lg);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.pool-card .pool-card-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pool-card .pool-card-type {
  font-size: 12px;
  color: var(--text-tertiary);
}

.pool-card .pool-card-body {
  padding: 0 var(--space-lg) var(--space-lg);
}

.pool-card .pool-readings {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.pool-card .pool-reading {
  flex: 1;
  text-align: center;
  padding: var(--space-sm);
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}

.pool-card .pool-reading .reading-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pool-card .pool-reading .reading-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.pool-card .pool-card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: var(--space-xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-amethyst), var(--accent-emerald), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-xl) + 4px);
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-emerald);
  border: 2px solid var(--bg-primary);
}

.timeline-item .timeline-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.timeline-item .timeline-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-item .timeline-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- Charts placeholder --- */
.chart-container {
  position: relative;
  height: 280px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: var(--space-md) 0;
}

.chart-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent-amethyst), var(--accent-emerald));
  border-radius: 4px 4px 0 0;
  min-height: 8px;
  transition: all var(--transition-base);
  position: relative;
  opacity: 0.7;
}

.chart-bar:hover {
  opacity: 1;
  transform: scaleY(1.02);
  transform-origin: bottom;
}

.chart-line-container {
  position: relative;
  height: 200px;
  border-bottom: 1px solid var(--glass-border);
  border-left: 1px solid var(--glass-border);
}

/* --- Calendar --- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-header-cell {
  padding: var(--space-sm);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.calendar-cell {
  min-height: 100px;
  padding: var(--space-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.calendar-cell:hover {
  background: rgba(255,255,255,0.05);
}

.calendar-cell .cell-date {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.calendar-cell .cell-event {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-cell .cell-event.type-service { background: rgba(0, 201, 167, 0.15); color: var(--accent-emerald); }
.calendar-cell .cell-event.type-repair { background: rgba(255, 145, 0, 0.15); color: var(--status-orange); }
.calendar-cell .cell-event.type-inspection { background: rgba(68, 138, 255, 0.15); color: var(--status-blue); }

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(0, 201, 167, 0.1);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.5)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 14px;
}

.form-checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-emerald);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.tab {
  padding: var(--space-md) var(--space-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-emerald);
  border-bottom-color: var(--accent-emerald);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- Upload Zone --- */
.upload-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl);
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
}

.upload-zone:hover {
  border-color: var(--accent-emerald);
  background: rgba(0, 201, 167, 0.03);
}

.upload-zone .upload-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.upload-zone .upload-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.upload-zone .upload-sub {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-emerald));
  transition: width var(--transition-slow);
}

/* --- Quick Actions Grid --- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
}

.quick-action:hover {
  transform: translateY(-2px);
}

.quick-action .qa-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(74, 0, 224, 0.15), rgba(0, 201, 167, 0.1));
}

.quick-action .qa-label {
  font-size: 13px;
  font-weight: 600;
}

/* --- Weather Widget --- */
.weather-widget {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.weather-icon-lg {
  font-size: 48px;
}

.weather-temp {
  font-size: 36px;
  font-weight: 800;
}

.weather-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

.weather-details {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.weather-detail {
  text-align: center;
}

.weather-detail .wd-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.weather-detail .wd-value {
  font-size: 16px;
  font-weight: 700;
}

/* --- Alerts List --- */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  background: rgba(255,255,255,0.02);
  transition: background var(--transition-fast);
}

.alert-item:hover {
  background: rgba(255,255,255,0.05);
}

.alert-item .alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.alert-item .alert-dot.critical { background: var(--status-red); box-shadow: 0 0 8px var(--status-red); }
.alert-item .alert-dot.warning { background: var(--status-yellow); box-shadow: 0 0 8px var(--status-yellow); }
.alert-item .alert-dot.info { background: var(--status-blue); }

.alert-item .alert-text {
  flex: 1;
}

.alert-item .alert-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-item .alert-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

.alert-item .alert-time {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* --- Modal / Overlay --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

/* --- Donut chart (CSS) --- */
.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-chart .donut-center {
  position: absolute;
  font-size: 24px;
  font-weight: 800;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .top-bar-search { display: none; }
  
  .page-content {
    padding: var(--space-md);
  }
  
  .stat-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pool-grid { grid-template-columns: 1fr; }
  
  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
  }
  
  .calendar-cell {
    min-height: 60px;
    padding: 4px;
  }
  
  .calendar-cell .cell-event {
    font-size: 9px;
    padding: 1px 3px;
  }
  
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .weather-widget {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 0 var(--space-md);
  }
  
  .top-bar-left .page-title {
    font-size: 15px;
  }
  
  .stat-card .stat-value {
    font-size: 22px;
  }
  
  .pool-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Mobile sidebar overlay --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeIn 0.4s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }
.animate-in:nth-child(6) { animation-delay: 0.25s; }

/* --- Shimmer loading --- */
.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
}

.empty-state .empty-icon {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: var(--space-md);
}

.empty-state .empty-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.empty-state .empty-desc {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
}

/* --- Gauge (for pool detail) --- */
.gauge {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  position: relative;
  overflow: visible;
}

.gauge .gauge-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.gauge .gauge-marker {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent-emerald);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 201, 167, 0.5);
}

/* --- Tag / Chip --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.chip.active {
  background: rgba(0, 201, 167, 0.15);
  color: var(--accent-emerald);
}

/* --- Pulse animation for live indicators --- */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* --- Glow line divider --- */
.glow-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-amethyst), var(--accent-emerald), transparent);
  margin: var(--space-xl) 0;
  border: none;
}

/* --- Print styles --- */
@media print {
  .sidebar, .top-bar, .bg-fluid { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .glass-card { background: white !important; color: black !important; border: 1px solid #ddd !important; }
  body { background: white !important; color: black !important; }
}
