/* ==========================================================================
   MINEGUARD AI — APPLE DESIGN SYSTEM SPECIFICATION
   Grounded strictly in Apple Human Interface Guidelines (HIG 2025/2026)
   Simplicity • Restraint • Liquid Glass Navigation • Solid Grouped Surfaces
   Accessible Typography • System Color Palette • Tabular Numbers
   ========================================================================== */

:root {
  /* ─── 1. APPLE SYSTEM BASE & GROUPED SURFACES ───────────────────────────── */
  /* Apple Dark Mode Base Canvas & Grouped Materials */
  --system-canvas: #000000;
  --system-grouped-bg: #1c1c1e;          /* Apple secondarySystemGroupedBackground */
  --system-grouped-secondary: #2c2c2e;   /* Apple tertiarySystemGroupedBackground */
  --system-elevated: #3a3a3c;            /* Control fill / hover */
  --system-quaternary: #48484a;

  /* Functional Layer: Apple Liquid Glass (Header, Tab Bar, Sheets) */
  --liquid-glass-bg: rgba(28, 28, 30, 0.78);
  --liquid-glass-border: rgba(255, 255, 255, 0.12);
  --liquid-glass-dim: rgba(0, 0, 0, 0.45);

  /* Content Layer: Standard Grouped Surfaces (No glass on content cards) */
  --card-bg: #1c1c1e;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(255, 255, 255, 0.16);

  /* ─── 2. APPLE DYNAMIC LABELS & TYPOGRAPHY COLORS ──────────────────────── */
  /* Meets 4.5:1 (normal text) and 3:1 (large text) contrast requirements */
  --label-primary: #ffffff;
  --label-secondary: #8e8e93;            /* Contrast: 4.6:1 against #1c1c1e */
  --label-tertiary: #636366;             /* Eyebrows, subtle captions */
  --label-quaternary: #48484a;           /* Disabled / ghost elements */
  --separator: rgba(255, 255, 255, 0.12);

  /* ─── 3. APPLE SYSTEM COLOR PALETTE (Restrained & Purposeful) ──────────── */
  /* Primary Accent: Apple System Blue */
  --accent: #0a84ff;
  --accent-tint: rgba(10, 132, 255, 0.15);
  --accent-hover: #0071e3;

  /* Weather & Hydrology: Apple System Cyan */
  --weather-cyan: #64d2ff;
  --weather-cyan-tint: rgba(100, 210, 255, 0.14);

  /* Warning / High Hazard: Apple System Orange */
  --hazard-warning: #ff9f0a;
  --hazard-warning-tint: rgba(255, 159, 10, 0.14);

  /* Critical / Danger: Apple System Red */
  --hazard-critical: #ff453a;
  --hazard-critical-tint: rgba(255, 69, 58, 0.14);

  /* Advisory / Moderate: Apple System Yellow */
  --hazard-advisory: #ffd60a;
  --hazard-advisory-tint: rgba(255, 214, 10, 0.14);

  /* Safe / Nominal: Apple System Green */
  --hazard-safe: #30d158;
  --hazard-safe-tint: rgba(48, 209, 88, 0.14);

  /* ─── 4. TYPOGRAPHY (SF Pro System Font Stack) ─────────────────────────── */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", -system-ui, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* ─── 5. SHAPE RADII & SHADOWS (Apple HIG Squircle Standards) ───────────── */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Apple Subtle Elevation (Clean, diffuse, zero garish neon halos) */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.28);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-sheet: 0 20px 48px rgba(0, 0, 0, 0.65);

  /* ─── 6. INTERACTION TIMINGS ───────────────────────────────────────────── */
  --transition-fast: 150ms cubic-bezier(0.2, 0, 0, 1);
  --transition-smooth: 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--system-canvas);
  color: var(--label-primary);
  font-family: var(--font-system);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ─── 7. CONTENT LAYER CARDS & CONTAINERS ───────────────────────────────── */
/* In Apple HIG, content cards use solid/semi-solid materials, not Liquid Glass */
.glass-panel,
.apple-card {
  background: var(--card-bg);
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.apple-card-hover:hover,
.glass-panel:hover {
  border-color: var(--card-hover-border);
}

.glass-card {
  background: var(--card-bg);
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

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

/* ─── 8. TYPOGRAPHIC HIERARCHY ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--label-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.25;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.35;
}

/* Eyebrows / Section Headers in Apple Weather & Health */
.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--label-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.mono-metric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ─── 9. APPLE RESTRAINED STATUS BADGES ─────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  line-height: 1;
}

.status-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.status-pill.critical {
  background: var(--hazard-critical-tint);
  color: var(--hazard-critical);
  border: 0.5px solid rgba(255, 69, 58, 0.25);
}
.status-pill.critical::before {
  background: var(--hazard-critical);
}

.status-pill.warning {
  background: var(--hazard-warning-tint);
  color: var(--hazard-warning);
  border: 0.5px solid rgba(255, 159, 10, 0.25);
}
.status-pill.warning::before {
  background: var(--hazard-warning);
}

.status-pill.advisory {
  background: var(--hazard-advisory-tint);
  color: var(--hazard-advisory);
  border: 0.5px solid rgba(255, 214, 10, 0.25);
}
.status-pill.advisory::before {
  background: var(--hazard-advisory);
}

.status-pill.safe, .status-pill.low {
  background: var(--hazard-safe-tint);
  color: var(--hazard-safe);
  border: 0.5px solid rgba(48, 209, 88, 0.25);
}
.status-pill.safe::before, .status-pill.low::before {
  background: var(--hazard-safe);
}

/* ─── 10. APPLE BUTTONS & CONTROLS ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-system);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 0.5px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  min-height: 38px;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--label-primary);
  border: 0.5px solid var(--separator);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-danger {
  background: var(--hazard-critical-tint);
  color: var(--hazard-critical);
  border: 0.5px solid rgba(255, 69, 58, 0.3);
}
.btn-danger:hover {
  background: rgba(255, 69, 58, 0.22);
}

.btn-outline-cyan {
  background: rgba(100, 210, 255, 0.08);
  color: var(--weather-cyan);
  border: 0.5px solid rgba(100, 210, 255, 0.28);
}
.btn-outline-cyan:hover {
  background: rgba(100, 210, 255, 0.16);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

/* ─── 11. APPLE SEGMENTED CONTROL ───────────────────────────────────────── */
.apple-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(118, 118, 128, 0.24);
  padding: 2px;
  border-radius: 9px;
  gap: 2px;
}

.apple-segment-item {
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--label-secondary);
  border-radius: 7px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.apple-segment-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ─── 12. APPLE NATIVE TOGGLE SWITCH ────────────────────────────────────── */
.apple-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  cursor: pointer;
}

.apple-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.apple-switch-slider {
  position: absolute;
  inset: 0;
  background-color: var(--system-elevated);
  border-radius: 13px;
  transition: background-color var(--transition-fast);
}

.apple-switch-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform var(--transition-fast);
}

.apple-switch input:checked + .apple-switch-slider {
  background-color: var(--hazard-safe);
}

.apple-switch input:checked + .apple-switch-slider::before {
  transform: translateX(18px);
}

/* ─── 13. ANIMATIONS & MICRO-INTERACTIONS ───────────────────────────────── */
@keyframes apple-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: apple-fade-in var(--transition-smooth) forwards;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* SVG Vector Icon Class */
.icon-svg {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-block;
  vertical-align: middle;
  stroke-width: 2;
  flex-shrink: 0;
}
