/* ============================================
   THEME VARIABLES (5 Glass Themes)
   ============================================ */
:root {
  --bg-primary: #0a1628;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --accent-1: #4fc3f7;
  --accent-2: #81d4fa;
  --accent-glow: rgba(79, 195, 247, 0.4);
  --blob-1: #1a237e;
  --blob-2: #0d47a1;
  --blob-3: #01579b;
  --blob-4: #006064;
  --binary-on: #4fc3f7;
  --binary-off: rgba(255, 255, 255, 0.1);
  --card-radius: 24px;
}

[data-theme="ocean"] {
  --bg-primary: #0a1628;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(100, 180, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(200, 230, 255, 0.7);
  --accent-1: #4fc3f7;
  --accent-2: #81d4fa;
  --accent-glow: rgba(79, 195, 247, 0.4);
  --blob-1: #0d47a1;
  --blob-2: #1565c0;
  --blob-3: #0288d1;
  --blob-4: #0097a7;
  --binary-on: #4fc3f7;
  --binary-off: rgba(255, 255, 255, 0.08);
}

[data-theme="sunset"] {
  --bg-primary: #1a0a0a;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 140, 80, 0.15);
  --text-primary: #fff5ee;
  --text-secondary: rgba(255, 200, 160, 0.7);
  --accent-1: #ff7043;
  --accent-2: #ffab91;
  --accent-glow: rgba(255, 112, 67, 0.4);
  --blob-1: #bf360c;
  --blob-2: #d84315;
  --blob-3: #e65100;
  --blob-4: #ff6f00;
  --binary-on: #ff7043;
  --binary-off: rgba(255, 255, 255, 0.08);
}

[data-theme="forest"] {
  --bg-primary: #0a1a0f;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(100, 255, 140, 0.12);
  --text-primary: #e8f5e9;
  --text-secondary: rgba(160, 230, 170, 0.7);
  --accent-1: #66bb6a;
  --accent-2: #a5d6a7;
  --accent-glow: rgba(102, 187, 106, 0.4);
  --blob-1: #1b5e20;
  --blob-2: #2e7d32;
  --blob-3: #388e3c;
  --blob-4: #00695c;
  --binary-on: #66bb6a;
  --binary-off: rgba(255, 255, 255, 0.08);
}

[data-theme="aurora"] {
  --bg-primary: #120824;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(180, 100, 255, 0.15);
  --text-primary: #f3e5f5;
  --text-secondary: rgba(220, 180, 255, 0.7);
  --accent-1: #ab47bc;
  --accent-2: #ce93d8;
  --accent-glow: rgba(171, 71, 188, 0.4);
  --blob-1: #6a1b9a;
  --blob-2: #7b1fa2;
  --blob-3: #9c27b0;
  --blob-4: #e040fb;
  --binary-on: #ab47bc;
  --binary-off: rgba(255, 255, 255, 0.08);
}

[data-theme="midnight"] {
  --bg-primary: #0d0d1a;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(140, 160, 220, 0.12);
  --text-primary: #e0e7ff;
  --text-secondary: rgba(180, 195, 230, 0.7);
  --accent-1: #7c8cf5;
  --accent-2: #a5b4fc;
  --accent-glow: rgba(124, 140, 245, 0.35);
  --blob-1: #1e1b4b;
  --blob-2: #312e81;
  --blob-3: #3730a3;
  --blob-4: #4338ca;
  --binary-on: #7c8cf5;
  --binary-off: rgba(255, 255, 255, 0.06);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: all 0.6s ease;
}

/* ============================================
   ANIMATED BACKGROUND BLOBS
   ============================================ */
.bg-animation {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  overflow: hidden;
}

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

.blob-1 {
  width: 300px; height: 300px;
  background: var(--blob-1);
  top: -5%; left: -10%;
  animation-delay: 0s;
}

.blob-2 {
  width: 250px; height: 250px;
  background: var(--blob-2);
  top: 30%; right: -8%;
  animation-delay: -5s;
  animation-duration: 25s;
}

.blob-3 {
  width: 280px; height: 280px;
  background: var(--blob-3);
  bottom: -5%; left: 20%;
  animation-delay: -10s;
  animation-duration: 22s;
}

.blob-4 {
  width: 200px; height: 200px;
  background: var(--blob-4);
  top: 60%; left: -5%;
  animation-delay: -15s;
  animation-duration: 28s;
}

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

/* ============================================
   GLASS CARD MIXIN
   ============================================ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: 0 8px 32px var(--glass-shadow),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.4s ease;
}

/* ============================================
   THEME SWITCHER
   ============================================ */
.theme-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 50px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-btn:hover {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.2);
}

.theme-btn.active {
  border-color: var(--accent-1);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(1.1);
}

/* ============================================
   LOCATION BAR
   ============================================ */
.location-bar {
  position: relative;
  z-index: 10;
  margin: 80px auto 16px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  max-width: 360px;
  width: calc(100% - 32px);
  border-radius: 50px;
}

#location-icon { font-size: 1.1rem; }
#location-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================
   CLOCK SECTION
   ============================================ */
.clock-section {
  position: relative;
  z-index: 10;
  max-width: 420px;
  width: calc(100% - 32px);
  margin: 0 auto 40px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================
   TIME DISPLAY
   ============================================ */
.time-display {
  padding: 32px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.time-display::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 60%);
  opacity: 0.3;
  animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.05); }
}

.date-display {
  position: relative;
  z-index: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.digital-time {
  position: relative;
  z-index: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.2rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-primary);
  text-shadow: 0 0 20px var(--accent-glow);
}

.seconds-bar {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.seconds-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ============================================
   BINARY CLOCK
   ============================================ */
.binary-clock {
  padding: 24px 20px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
}

.binary-columns {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.binary-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.group-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.binary-digits {
  display: flex;
  gap: 8px;
}

.binary-bit {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--binary-off);
  transition: all 0.4s ease;
  position: relative;
}

.binary-bit.on {
  background: var(--binary-on);
  box-shadow: 0 0 12px var(--accent-glow),
              0 0 24px var(--accent-glow);
  animation: bitPulse 0.4s ease;
}

@keyframes bitPulse {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ============================================
   CURRENT WEATHER
   ============================================ */
.weather-current {
  padding: 24px;
}

.current-weather-content {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}

.weather-icon-large {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.weather-temp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.temp-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.weather-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.weather-details {
  display: flex;
  justify-content: space-around;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-icon { font-size: 1.3rem; }

.detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   FORECAST SECTION
   ============================================ */
.forecast-section {
  padding: 24px 20px;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
}

.forecast-day:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.forecast-day-name {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.forecast-icon { font-size: 1.4rem; }

.forecast-temps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.temp-high {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.temp-low {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.forecast-precip {
  font-size: 0.6rem;
  color: #64b5f6;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loader-ring {
  width: 50px; height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 380px) {
  .digital-time { font-size: 2.6rem; }
  .temp-value { font-size: 2rem; }
  .binary-bit { width: 14px; height: 14px; }
  .forecast-grid { gap: 4px; }
}

@media (min-width: 768px) {
  .clock-section { max-width: 500px; }
  .digital-time { font-size: 3.8rem; }
  .binary-bit { width: 20px; height: 20px; }
}

/* ============================================
   ANIMATIONS ON LOAD
   ============================================ */
.glass-card {
  animation: cardSlideUp 0.6s ease backwards;
}

.clock-section > *:nth-child(1) { animation-delay: 0.1s; }
.clock-section > *:nth-child(2) { animation-delay: 0.2s; }
.clock-section > *:nth-child(3) { animation-delay: 0.3s; }
.clock-section > *:nth-child(4) { animation-delay: 0.4s; }

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