/**
 * MKMRS Dashboard - Production Styles
 * Version: 2.0.0
 * Author: Dr. Maoz Lahav
 * Last Modified: September 2024
 * 
 * Morris Kahn Marine Research Station - University of Haifa
 * Live Buoy Data Visualization Dashboard
 * 
 * TABLE OF CONTENTS:
 * 1. CSS Custom Properties (Variables)
 * 2. Reset & Base Styles
 * 3. Utility Classes
 * 4. Layout Components
 * 5. Theme Toggle & Floating Clock
 * 6. Statistics Grid (Desktop/Tablet)
 * 7. Charts & Containers
 * 8. Map Component
 * 9. Buttons & Controls
 * 10. Status Messages
 * 11. Footer
 * 12. Responsive Breakpoints (Tablet/Desktop)
 * 13. Animations
 * 14. Accessibility
 * 15. Performance Optimizations
 * 16. Print Styles
 * 
 * MOBILE STYLES: Handled in separate mobile-styles.css file
 * BREAKPOINTS: 768px (tablet), 1024px (desktop), 1440px (large desktop)
 */

/* ============================================
   1. CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================ */
:root {
  /* Color System - Dark Theme Default */
  --primary-cyan: #00d4ff;
  --primary-cyan-hover: #00b8e6;
  --secondary-blue: #0099cc;
  --accent-blue: #0066cc;

  --dark-bg: #1a1a1a;
  --dark-bg-secondary: #2a2a2a;
  --card-bg: #2a2a2a;
  --card-bg-hover: #353535;
  --border-color: #404040;
  --border-color-light: #555;

  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #b0b0b0;
  --text-accent: var(--primary-cyan);

  --success-color: #28a745;
  --error-color: #dc3545;
  --info-color: #17a2b8;
  --warning-color: #ffc107;

  /* Typography System */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono',
    Consolas, 'Courier New', monospace;

  /* Fluid Typography - Desktop First */
  --text-xs: 0.875rem;
  --text-sm: 1rem;
  --text-base: 1.125rem;
  --text-lg: 1.375rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.25rem;
  --text-3xl: 3rem;

  /* Spacing System */
  --space-1: 0.375rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 2.5rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 5rem;

  /* Layout System */
  --container-max: 1400px;
  --container-padding: var(--space-4);
  --grid-gap: var(--space-4);

  /* Component Sizes */
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --border-radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-cyan: 0 4px 20px rgba(0, 212, 255, 0.15);
  --shadow-cyan-hover: 0 8px 25px rgba(0, 212, 255, 0.25);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Component Specific Sizes */
  --compass-size: 300px;
  --clock-size: 200px;
  --card-min-height: 120px;
  --chart-height-md: 450px;
  --chart-height-lg: 600px;
  --map-height: 400px;

  /* Z-index Scale */
  --z-base: 1;
  --z-fixed: 1030;
}

/* Light Theme Variables */
[data-theme='light'] {
  --primary-cyan: #0066cc;
  --primary-cyan-hover: #0056b3;
  --secondary-blue: #004d99;
  --accent-blue: #003d7a;

  --dark-bg: #ffffff;
  --dark-bg-secondary: #f8f9fa;
  --card-bg: #ffffff;
  --card-bg-hover: #f5f5f5;
  --border-color: #e1e5e9;
  --border-color-light: #dee2e6;

  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-cyan: 0 4px 20px rgba(0, 102, 204, 0.1);
  --shadow-cyan-hover: 0 8px 25px rgba(0, 102, 204, 0.15);
}

/* ============================================
   2. RESET & BASE STYLES
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  cursor: none; /* Hide default cursor */
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--dark-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  padding: var(--container-padding);
  min-height: 100vh;
}
#pointer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: visible;
  color: var(--text-primary);
}
/* ============================================
   3. UTILITY CLASSES
   ============================================ */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  font-size: var(--text-base);
  text-align: center;
  padding: var(--space-8);
}

/* ============================================
   4. LAYOUT COMPONENTS
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
}

/* ============================================
   5. THEME TOGGLE & FLOATING CLOCK
   ============================================ */
.theme-toggle {
  position: fixed;
  top: var(--space-6);
  right: var(--space-4);
  z-index: var(--z-fixed);
  background: var(--card-bg);
  border: 2px solid var(--primary-cyan);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  background: var(--primary-cyan);
  color: var(--dark-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-cyan-hover);
}
/* In light theme - make logo more visible */
[data-theme='light'] .detailed-compass-container .logo-image {
  opacity: 0.9 !important; /* Less transparent - more visible */
  filter: contrast(1.5) !important;
  filter: brightness(1.3) !important;

  /* filter: invert(1) !important; */
  /* filter: grayscale(1) !important; */
}
.floating-clock {
  position: fixed;
  top: var(--space-6);
  left: var(--space-4);
  z-index: calc(var(--z-fixed) - 1);
  width: var(--clock-size);
  height: var(--clock-size);
  background: transparent;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
  box-shadow: var(--shadow-md);
}

.floating-clock:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-cyan);
}

#clockCanvas {
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-full);
}

/* ============================================
   6. STATISTICS COMPONENTS (DESKTOP)
   Note: Mobile handled in mobile-styles.css
   ============================================ */
.current-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: var(--card-min-height);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.current-stat-card:hover {
  background: var(--card-bg-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.current-stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-accent);
  line-height: 1.1;
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.current-stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.3;
}

/* Wind Speed Card - Interactive */
.wind-speed-card {
  cursor: pointer;
  user-select: none;
}

.wind-speed-card:hover {
  background: var(--card-bg-hover);
  box-shadow: var(--shadow-cyan);
  transform: translateY(-2px);
}

/* ============================================
   7. CHARTS & CONTAINERS
   ============================================ */
.chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
  width: 100%;
}

.chart-container:hover {
  box-shadow: var(--shadow-lg);
}

#windRoseChart {
  width: 100% !important;
  height: var(--chart-height-md) !important;
}

#temperatureChart,
#windBarbChart {
  width: 100% !important;
  height: var(--chart-height-lg) !important;
}

/* ============================================
   8. MAP COMPONENT
   ============================================ */
.map-container {
  position: relative;
}

.map-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.map-header h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-accent);
  margin: 0;
  position: relative;
  display: inline-block;
}

.map-header h3::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-cyan), transparent);
  border-radius: 1px;
}

.map-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-btn {
  background: var(--dark-bg) !important;
  border: 1px solid #00d4ff !important;
  color: var(--text-primary) !important;
  padding: 10px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: var(--transition-base);
}

.map-btn.active {
  background: #00d4ff !important;
  color: #000000 !important;
}

.map-btn:hover {
  transform: translateY(-1px);
}

#buoyMap {
  border-radius: var(--border-radius);
  border: 2px solid var(--primary-cyan);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  height: var(--map-height) !important;
}

.map-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--dark-bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.map-info-item {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
}

.map-info-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

.coordinates {
  color: var(--text-accent);
  font-weight: 600;
  font-family: var(--font-family-mono);
  font-size: var(--text-xs);
}

/* ============================================
   9. BUTTONS & CONTROLS
   ============================================ */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin: var(--space-8) 0;
  padding: var(--space-4);
  background: var(--dark-bg-secondary);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
}

.btn {
  background: linear-gradient(
    135deg,
    var(--primary-cyan),
    var(--secondary-blue)
  );
  border: none;
  color: var(--dark-bg);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  min-width: 140px;
  min-height: 44px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left var(--transition-slow);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-cyan-hover);
}

.btn:hover:not(:disabled)::before {
  left: 100%;
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn.loading {
  pointer-events: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.3);
}

select {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: var(--space-3);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  min-width: 140px;
  min-height: 44px;
  transition: var(--transition-base);
  cursor: pointer;
}

select:hover {
  border-color: var(--primary-cyan);
  box-shadow: var(--shadow-sm);
}

select:focus {
  outline: none;
  border-color: var(--primary-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Statistics Grid */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 140px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  background: var(--card-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-accent);
  line-height: 1.1;
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.3;
}

/* ============================================
   10. STATUS MESSAGES
   ============================================ */
.status-message {
  display: none;
  padding: var(--space-4);
  margin: var(--space-4) 0;
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  border-left: 4px solid currentColor;
  position: relative;
  overflow: hidden;
}

.status-message::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 2s ease-in-out infinite;
}

.status-message.info {
  background: rgba(23, 162, 184, 0.1);
  color: var(--info-color);
  border-color: var(--info-color);
}

.status-message.success {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success-color);
  border-color: var(--success-color);
}

.status-message.error {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error-color);
  border-color: var(--error-color);
}

.status-message.warning {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning-color);
  border-color: var(--warning-color);
}

/* ============================================
   11. FOOTER
   ============================================ */
.separator {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-cyan),
    transparent
  );
  margin: var(--space-12) 0 var(--space-8) 0;
}

.credits {
  text-align: center;
  padding: var(--space-6) 0;
  margin-bottom: var(--space-4);
}

.credits p {
  margin: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.credits p:first-child {
  font-size: var(--text-base);
  font-weight: 600;
  background: linear-gradient(
    135deg,
    var(--primary-cyan),
    var(--secondary-blue)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2);
}

/* ============================================
   12. RESPONSIVE BREAKPOINTS (TABLET & DESKTOP)
   Mobile styles removed - see mobile-styles.css
   ============================================ */

/* Tablet Breakpoint - 768px and up */
@media (min-width: 768px) and (orientation: portrait),
  (min-width: 768px) and (min-height: 601px) {
  .current-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: auto auto;
    gap: var(--space-4);
  }

  /* Row 1: Wave Height, Wave Period, Compass, Air Temp, Water Temp */
  .current-stats > :nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }
  .current-stats > :nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }
  .current-stats > :nth-child(3) {
    grid-column: 3;
    grid-row: 1 / 3; /* Compass spans both rows */
    width: var(--compass-size);
    height: var(--compass-size);
    justify-self: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .current-stats > :nth-child(5) {
    grid-column: 4;
    grid-row: 1;
  }
  .current-stats > :nth-child(6) {
    grid-column: 5;
    grid-row: 1;
  }

  /* Row 2: Wind Speed in middle under compass */
  .current-stats > :nth-child(4) {
    grid-column: 3;
    grid-row: 2;
    justify-self: center;
    width: 80%;
    margin-top: -20px; /* Pull closer to compass */
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktop Breakpoint - 1024px and up */
@media (min-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 40px;
  }

  :root {
    --compass-size: 320px;
  }

  .floating-clock {
    width: 110px !important;
    height: 110px !important;
    top: -10px !important;
    left: -5px !important;
  }
}

/* Large Desktop - 1440px and up */
@media (min-width: 1440px) {
  .current-stats > :not(:nth-child(3)) {
    width: 70%;
    margin: 15%;
  }

  :root {
    --compass-size: 350px;
    --clock-size: 300px;
  }
  .floating-clock {
    width: 120px !important;
    height: 120px !important;
    top: 250px !important;
    left: 25px !important;
  }
  .theme-toggle {
    top: 250px !important; /* Same as clock */
    right: 25px !important; /* Same distance from edge as clock */
  }
}
/* Tablet Fixes - 768px to 1439px */
@media (min-width: 768px) and (max-width: 1439px) and (min-height: 601px) {
  .floating-clock {
    width: 120px !important;
    height: 120px !important;
    top: 200px !important;
    left: 25px !important;
  }
  .theme-toggle {
    top: 250px !important; /* Same as clock */
    right: 25px !important; /* Same distance from edge as clock */
  }
  /* Shrink stat cards */
  .current-stats > :nth-child(1),
  .current-stats > :nth-child(2),
  .current-stats > :nth-child(5),
  .current-stats > :nth-child(6) {
    width: 80% !important;
    height: 90px !important;
    padding: 0.75rem !important;
    justify-self: center;
    align-self: center;
  }

  /* Smaller text for stat cards */
  .current-stats > :nth-child(1) .current-stat-value,
  .current-stats > :nth-child(2) .current-stat-value,
  .current-stats > :nth-child(5) .current-stat-value,
  .current-stats > :nth-child(6) .current-stat-value {
    font-size: 2rem !important;
  }

  .current-stats > :nth-child(1) .current-stat-label,
  .current-stats > :nth-child(2) .current-stat-label,
  .current-stats > :nth-child(5) .current-stat-label,
  .current-stats > :nth-child(6) .current-stat-label {
    font-size: 0.8rem !important;
  }

  /* Fix wind speed positioning - push it down */
  .current-stats > :nth-child(4) {
    grid-column: 3 !important;
    grid-row: 2 !important;
    justify-self: center !important;
    align-self: start !important; /* Align to top of row 2 */
    width: 90% !important;
    height: 70px !important;
    min-height: 70px !important;
    max-height: 70px !important;
    padding: 0.5rem !important;
    position: relative !important;
    top: 18vh !important;
    margin-top: 0 !important;
    z-index: 1 !important;
  }
  /* Force font sizes for wind speed card */
  .current-stats > :nth-child(4) .current-stat-value {
    font-size: 2rem !important;
    margin: 0 !important;
    line-height: 1 !important;
  }

  .current-stats > :nth-child(4) .current-stat-label {
    font-size: 0.8rem !important;
    margin: 0 !important;
    margin-top: 2px !important;
    line-height: 1 !important;
  }

  /* Push down the first chart after current stats */
  .current-stats + .chart-container {
    margin-top: 20vh !important; /* Push down by 15% of viewport height */
  }
  /* Ensure compass doesn't overlap */
  .current-stats > :nth-child(3) {
    z-index: 2 !important;
    position: relative !important;
  }

  /* Adjust grid row heights */
  .current-stats {
    grid-template-rows: minmax(100px, auto) minmax(60px, auto) !important;
  }
}
/* Ultra-wide screens - 1920px and up */
@media (min-width: 1920px) {
  :root {
    --compass-size: 380px;
    --clock-size: 300px;
  }
  .floating-clock {
    width: 140px !important;
    height: 140px !important;
    top: 20px !important;
    left: 70px !important;
  }
  .container {
    max-width: 1600px;
  }
}

/* ============================================
   13. ANIMATIONS
   ============================================ */
@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* Progressive Enhancement Animations */
.current-stat-card {
  animation: fadeInUp 0.6s ease-out backwards;
}

.current-stat-card:nth-child(1) {
  animation-delay: 0.1s;
}
.current-stat-card:nth-child(2) {
  animation-delay: 0.2s;
}
.current-stat-card:nth-child(3) {
  animation-delay: 0.3s;
}
.current-stat-card:nth-child(4) {
  animation-delay: 0.4s;
}
.current-stat-card:nth-child(5) {
  animation-delay: 0.5s;
}
.current-stat-card:nth-child(6) {
  animation-delay: 0.6s;
}

.chart-container {
  animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

.status-message {
  animation: fadeInUp 0.4s ease-out;
}

/* Loading States */
.current-stat-value.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

.loader {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

/* ============================================
   14. ACCESSIBILITY
   ============================================ */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .btn::before {
    display: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: currentColor;
    --card-bg: var(--dark-bg);
  }
}

/* Focus States for Accessibility */
:focus-visible {
  outline: 2px solid var(--primary-cyan);
  outline-offset: 2px;
  border-radius: var(--border-radius);
}

/* Enhanced Touch Targets */
@media (pointer: coarse) {
  .btn,
  select,
  .map-btn,
  .theme-toggle,
  .wind-speed-card {
    min-height: 44px;
    min-width: 44px;
  }

  .current-stat-card {
    min-height: 88px;
  }
}

/* ============================================
   15. PERFORMANCE OPTIMIZATIONS
   ============================================ */
.chart-container,
.current-stat-card,
.stat-card {
  contain: layout style paint;
}

#clockCanvas,
#buoyMap,
.detailed-compass-container {
  will-change: transform;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-cyan);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-cyan-hover);
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  #clockCanvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark Mode Image Adjustments */
[data-theme='dark'] img {
  opacity: 0.9;
  transition: opacity var(--transition-base);
}

[data-theme='dark'] img:hover {
  opacity: 1;
}

/* ============================================
   16. PRINT STYLES
   ============================================ */
@media print {
  .theme-toggle,
  .floating-clock,
  .controls {
    display: none;
  }

  .chart-container {
    break-inside: avoid;
  }

  body {
    background: white;
    color: black;
  }

  .current-stat-card,
  .chart-container,
  .map-container {
    border: 1px solid #000;
    background: white;
  }
}

/* Typography Enhancements */
.current-stat-value,
.stat-value,
h1,
h2,
h3,
h4,
h5,
h6 {
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1;
}

/* Browser Specific Fixes */
/* Safari iOS */
@supports (-webkit-touch-callout: none) {
  .current-stat-card,
  .btn,
  .map-btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
}

/* Firefox */
@-moz-document url-prefix() {
  .detailed-compass-container {
    transform: translateZ(0);
  }
}

/* Edge */
@supports (-ms-ime-align: auto) {
  .current-stats {
    display: -ms-grid;
  }
}
/* End of styles.css */
