/* ========================================================================== */
/* AQUAPOD OS: MASTER CROSS-DEVICE UI/UX UNIFICATION STYLESHEET               */
/* ========================================================================== */

/* 0. Universal Reset & Box-Sizing */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #0f172a; /* Slate Dark background */
  color: #f8fafc;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* ========================================================================== */
/* 1. UNIVERSAL FLUID LAYOUTS & CONTAINERS (Applied across ALL pages)         */
/* ========================================================================== */
.page-container, 
.dashboard-wrapper, 
main, 
section {
  width: 100% !important;
  max-width: 1440px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1rem !important;  /* 16px safe mobile padding */
  padding-right: 1.0rem !important;
}

@media (min-width: 640px) {
  .page-container, .dashboard-wrapper, main, section {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

@media (min-width: 1024px) {
  .page-container, .dashboard-wrapper, main, section {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }
}

/* ========================================================================== */
/* 2. TYPOGRAPHY & SCALE CONSISTENCY (Fluid Scaling via clamp)                 */
/* ========================================================================== */
h1, .page-title {
  font-size: clamp(1.35rem, 4vw, 2.25rem) !important;
  line-height: 1.25 !important;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

h2, .section-title {
  font-size: clamp(1.15rem, 3vw, 1.75rem) !important;
  line-height: 1.3 !important;
  font-weight: 600;
}

h3, .card-title {
  font-size: clamp(1rem, 2.5vw, 1.25rem) !important;
  font-weight: 600;
}

p, span, label, input, button {
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  word-break: break-word;
}

.sensor-metric-value {
  font-size: clamp(1.5rem, 5vw, 2.75rem) !important;
  font-weight: 800;
  line-height: 1.1;
}

/* ========================================================================== */
/* 3. BOXES, CARDS, & UNIFORM GRID ALIGNMENT                                  */
/* ========================================================================== */
.card, 
.module-panel, 
.sensor-card, 
.control-box {
  width: 100% !important;
  max-width: 100% !important;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem !important;
  padding: 1.125rem !important;
  margin-bottom: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .card, .module-panel, .sensor-card, .control-box {
    padding: 1.5rem !important;
  }
}

/* Universal responsive grid system for all modules and metric rows */
.aquapod-grid {
  display: grid;
  grid-template-columns: 1fr !important; /* 1-column on compact mobile */
  gap: 1rem !important;
  width: 100% !important;
}

@media (min-width: 640px) {
  .aquapod-grid {
    grid-template-columns: repeat(2, 1fr) !important; /* 2-columns on tablets/large phones */
  }
}

@media (min-width: 1024px) {
  .aquapod-grid.three-col {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .aquapod-grid.four-col {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* ========================================================================== */
/* 4. GRAPHIC DESIGN, CHARTS, & DATA VISUALIZATION WRAPPERS                   */
/* ========================================================================== */
.chart-container {
  position: relative;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 240px;
  max-height: 360px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 0.75rem;
  padding: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 340px;
}

/* ========================================================================== */
/* 5. TOUCH TARGETS & INTERACTIVE UX (Minimum 44x44px for thumbs)            */
/* ========================================================================== */
button, 
.btn-action, 
input, 
select, 
.interactive-toggle {
  min-height: 44px !important;
  min-width: 44px !important;
  padding: 0.75rem 1rem !important;
  font-size: 1rem !important;
  border-radius: 0.625rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
}

button:active, .btn-action:active {
  transform: scale(0.98);
}

/* ========================================================================== */
/* 6. FULL-WIDTH GEOGRAPHIC MAP WRAPPER & RESPONSIVE CANVAS                   */
/* ========================================================================== */
/* Force the map container and Leaflet canvas to take 100% full width */
.map-section-wrapper, 
.map-container {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Ensure the map element takes full screen width and proper responsive height */
#map, .leaflet-container {
  width: 100% !important;
  max-width: 100% !important;
  height: 480px !important;
}

@media (min-width: 768px) {
  #map, .leaflet-container {
    height: 600px !important; /* Expands nicely on larger tablet & desktop displays */
  }
}

/* Leaflet Dark Custom Popup Styling */
.leaflet-popup-content-wrapper {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-tip {
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
