@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* Theme variables - Default Dark Mode (Premium Midnight) */
  --bg-primary: #070913;
  --bg-secondary: #0f1225;
  --bg-tertiary: #161a33;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1; /* Increased contrast (was #94a3b8) */
  --text-muted: #8a99ad;      /* Increased contrast (was #475569) */
  
  --accent-cyan: #00F2FE;
  --accent-blue: #4FACFE;
  --accent-green: #00F2A9; /* best lap */
  --accent-red: #FF5E62; /* worst lap / delete / alert */
  --accent-violet: #c084fc;
  
  --glass-bg: rgba(15, 18, 37, 0.45);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-glow: rgba(0, 242, 254, 0.05);
  --shadow-color: rgba(0, 0, 0, 0.4);

  --btn-bg: rgba(255, 255, 255, 0.04);
  --btn-hover: rgba(255, 255, 255, 0.08);
  --btn-active: rgba(255, 255, 255, 0.12);
  --btn-border: rgba(255, 255, 255, 0.06);
  
  --input-bg: rgba(255, 255, 255, 0.03);
  --input-border: rgba(255, 255, 255, 0.08);
  
  --glow-intensity: 0 0 20px rgba(0, 242, 254, 0.15);
  
  --ad-bg: rgba(15, 18, 37, 0.3);
  --ad-border: rgba(255, 255, 255, 0.04);
  --ad-text: rgba(255, 255, 255, 0.2);
}

.theme-light {
  --bg-primary: #f5f8fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9eef2;
  --text-primary: #0f172a;
  --text-secondary: #334155; /* Increased contrast (was #475569) */
  --text-muted: #64748b;      /* Increased contrast (was #94a3b8) */
  
  --accent-cyan: #0369a1;    /* Increased contrast for light text (was #0284c7) */
  --accent-blue: #1d4ed8;    /* Increased contrast for light text (was #2563eb) */
  --accent-green: #047857;   /* Increased contrast for light text (was #10b981) */
  --accent-red: #b91c1c;     /* Increased contrast for light text (was #ef4444) */
  --accent-violet: #6d28d9;  /* Increased contrast for light text (was #8b5cf6) */
  
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(15, 23, 42, 0.06);
  --glass-glow: rgba(37, 99, 235, 0.04);
  --shadow-color: rgba(15, 23, 42, 0.04);

  --btn-bg: rgba(15, 23, 42, 0.04);
  --btn-hover: rgba(15, 23, 42, 0.07);
  --btn-active: rgba(15, 23, 42, 0.1);
  --btn-border: rgba(15, 23, 42, 0.06);
  
  --input-bg: rgba(15, 23, 42, 0.02);
  --input-border: rgba(15, 23, 42, 0.06);
  
  --glow-intensity: 0 0 15px rgba(37, 99, 235, 0.1);
  
  --ad-bg: rgba(15, 23, 42, 0.02);
  --ad-border: rgba(15, 23, 42, 0.03);
  --ad-text: rgba(15, 23, 42, 0.3);
}

/* Base resets & typography */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Background animated glow meshes */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-glow-1 {
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.08) 0%, rgba(0,0,0,0) 70%);
  filter: blur(120px);
  animation: float-glow 25s infinite ease-in-out alternate;
}

.bg-glow-2 {
  position: absolute;
  bottom: -15%;
  left: -15%;
  width: 70vw;
  height: 70vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192, 132, 252, 0.06) 0%, rgba(0,0,0,0) 75%);
  filter: blur(140px);
  animation: float-glow 35s infinite ease-in-out alternate-reverse;
}

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 5%) scale(1.1); }
  100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* Header & Navbar styling */
.navbar-crononova {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.4s ease;
  z-index: 1000;
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link-crononova {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.5rem 1rem !important;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-link-crononova:hover {
  color: var(--text-primary);
  background-color: var(--btn-bg);
}

.nav-link-crononova.active {
  color: var(--accent-cyan) !important;
  background-color: rgba(0, 242, 254, 0.08);
  border-bottom: 2px solid var(--accent-cyan);
  border-radius: 8px 8px 0 0;
}

.theme-light .nav-link-crononova.active {
  color: var(--accent-cyan) !important;
  background-color: rgba(3, 105, 161, 0.06);
  border-bottom: 2px solid var(--accent-cyan);
}

/* Glassmorphism & Liquid Crystal UI panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--shadow-color);
  border-radius: 20px;
  padding: 2rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(0, 242, 254, 0.15);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45), var(--glass-glow);
}

.theme-light .glass-panel:hover {
  border-color: rgba(37, 99, 235, 0.1);
  box-shadow: 0 12px 32px 0 rgba(15, 23, 42, 0.06), var(--glass-glow);
}

/* Liquid Crystal UI Monospaced digital clock */
.lcd-clock {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-shadow: var(--glow-intensity);
  line-height: 1;
}

/* Beautiful Controls & Buttons */
.btn-crononova {
  background: var(--btn-bg);
  color: var(--text-primary);
  border: 1px solid var(--btn-border);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-crononova:hover {
  background: var(--btn-hover);
  border-color: rgba(0, 242, 254, 0.3);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.btn-crononova:active {
  background: var(--btn-active);
  transform: translateY(0);
}

.btn-crononova-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #070913 !important;
  border: none;
}

.btn-crononova-primary:hover {
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.4);
  transform: translateY(-2px);
  color: #070913 !important;
}

.theme-light .btn-crononova-primary {
  color: #ffffff !important;
}

.theme-light .btn-crononova-primary:hover {
  color: #ffffff !important;
}

.btn-crononova-danger {
  background: rgba(255, 94, 98, 0.1);
  border-color: rgba(255, 94, 98, 0.3);
  color: var(--accent-red);
}

.btn-crononova-danger:hover {
  background: rgba(255, 94, 98, 0.2);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.input-crononova {
  background-color: rgba(255, 255, 255, 0.08); /* Increased visibility */
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  transition: all 0.3s ease;
}

.input-crononova::placeholder {
  color: var(--text-secondary);
  opacity: 0.8;
}

.input-crononova:focus {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
  color: var(--text-primary);
  outline: none;
}

.theme-light .input-crononova {
  background-color: #ffffff; /* Solid white background in light mode */
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
}

.theme-light .input-crononova::placeholder {
  color: #64748b;
}

.theme-light .input-crononova:focus {
  background-color: #ffffff;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(3, 105, 161, 0.2);
  color: var(--text-primary);
}

/* Theme selector widget */
.theme-switch-container {
  display: flex;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 50px;
  padding: 3px;
  align-items: center;
}

.theme-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.theme-btn.active {
  background: var(--bg-primary);
  color: var(--accent-cyan);
  box-shadow: 0 2px 8px var(--shadow-color);
}

/* Language Switcher */
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  transition: color 0.3s ease;
}

.lang-btn.active {
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
}

/* --- World Clock signature styles --- */
.city-card {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.solar-arc-container {
  position: relative;
  height: 60px;
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.solar-arc-path {
  fill: none;
  stroke: var(--btn-border);
  stroke-width: 2;
  stroke-dasharray: 4,4;
}

.solar-arc-day-fill {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 2;
  opacity: 0.2;
}

.solar-dot {
  fill: var(--accent-cyan);
  filter: drop-shadow(0 0 4px var(--accent-cyan));
  transition: cx 0.5s ease, cy 0.5s ease;
}

.solar-arc-sun {
  fill: #ffd700;
  filter: drop-shadow(0 0 6px #ffd700);
}

.solar-arc-moon {
  fill: #ffffff;
  filter: drop-shadow(0 0 6px #e0e0e0);
}

.city-time-diff {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--btn-bg);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* --- Stopwatch Laps list --- */
.laps-container {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.laps-container::-webkit-scrollbar {
  width: 6px;
}

.laps-container::-webkit-scrollbar-track {
  background: transparent;
}

.laps-container::-webkit-scrollbar-thumb {
  background: var(--btn-border);
  border-radius: 10px;
}

.laps-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.lap-item {
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0.5rem;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.lap-item.best-lap {
  color: var(--accent-green);
  text-shadow: 0 0 10px rgba(0, 242, 169, 0.2);
  background: rgba(0, 242, 169, 0.03);
  border-radius: 8px;
}

.lap-item.worst-lap {
  color: var(--accent-red);
  text-shadow: 0 0 10px rgba(255, 94, 98, 0.2);
  background: rgba(255, 94, 98, 0.03);
  border-radius: 8px;
}

/* Circular Progress Dial for Timer & Stopwatch */
.progress-ring-container {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto;
}

.progress-ring-bg {
  fill: none;
  stroke: var(--btn-border);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-liquid-wave {
  fill: url(#liquid-gradient);
  opacity: 0.15;
  transition: transform 0.5s ease;
}

.timer-digit-display {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

/* Preset grids */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* --- Fullscreen styles --- */
.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.fullscreen-mode .progress-ring-container {
  width: 450px;
  height: 450px;
}

@media (max-width: 576px) {
  .fullscreen-mode .progress-ring-container {
    width: 280px;
    height: 280px;
  }
}

.fullscreen-exit-btn {
  position: absolute;
  top: 2rem;
  right: 2rem;
  z-index: 10000;
}

/* --- Advertising Ad Slots --- */
.ad-slot {
  display: none !important;
}

.ad-slot::before {
  content: 'ADVERTISEMENT';
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ad-text);
  margin-bottom: 0.25rem;
}

.ad-slot-horizontal {
  width: 100%;
  max-width: 728px;
  margin-left: auto;
  margin-right: auto;
}

.ad-slot-vertical {
  min-height: 250px;
  width: 300px;
}

/* Editorial content section */
.editorial-section {
  border-top: 1px solid var(--glass-border);
  margin-top: 4rem;
  padding-top: 3rem;
}

.editorial-section h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.editorial-section p, .editorial-section li {
  color: var(--text-secondary);
  line-height: 1.7;
}

.editorial-section h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

/* Animations for timer completion */
@keyframes flash-alert {
  0%, 100% { background-color: var(--bg-primary); }
  50% { background-color: rgba(255, 94, 98, 0.2); }
}

.timer-completed-flash {
  animation: flash-alert 0.8s infinite;
}

/* Focus ring accessibility */
*:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 4px;
}

/* Fluid transition for Timer configuration panel pushing layout */
.timer-config-col {
  transition: max-width 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
              flex-basis 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.4s ease, 
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.6s ease,
              margin 0.6s ease;
  max-width: 500px;
  opacity: 1;
  transform: scale(1) translateX(0);
  overflow: hidden;
  flex-grow: 0;
}

.timer-config-col.collapsed {
  max-width: 0 !important;
  flex-basis: 0 !important;
  opacity: 0 !important;
  transform: scale(0.9) translateX(30px);
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none;
}

/* Space Pollution / Orbital Station Dashboard aesthetic overrides */
.space-grid-bg {
  background-image: 
    radial-gradient(rgba(0, 242, 254, 0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 24px 24px, 48px 48px, 48px 48px;
  background-position: center center;
  position: relative;
}

.theme-light .space-grid-bg {
  background-image: 
    radial-gradient(rgba(3, 105, 161, 0.04) 1px, transparent 1px),
    linear-gradient(to right, rgba(15, 23, 42, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.015) 1px, transparent 1px);
}

.dashboard-ticker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 242, 254, 0.15);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  overflow: hidden;
  white-space: nowrap;
}

.theme-light .dashboard-ticker {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(3, 105, 161, 0.15);
  color: #0369a1;
}

.dashboard-ticker-content {
  display: inline-block;
  animation: ticker-slide 30s infinite linear;
}

@keyframes ticker-slide {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

.telemetry-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

.theme-light .telemetry-value {
  text-shadow: none;
}

.module-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--accent-cyan);
}

.theme-light .module-badge {
  background: rgba(3, 105, 161, 0.05);
  border: 1px solid rgba(3, 105, 161, 0.15);
}

.module-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 4px;
}

.module-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
  box-shadow: 0 0 6px var(--accent-green);
}

.orbital-radar-container {
  max-width: 300px;
  margin: 0 auto;
}

/* Radar rotation styles */
@keyframes radar-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-sweep {
  transform-origin: 150px 150px;
  animation: radar-rotate 10s infinite linear;
}

@keyframes satellite-orbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.orbit-sat {
  transform-origin: 150px 150px;
  animation: satellite-orbit 25s infinite linear;
}

@keyframes ping-scale {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

.ping-ring {
  transform-origin: 210px 150px;
  animation: ping-scale 2.5s infinite ease-out;
}
