/* ==========================================================================
   Ukraine Weather Web Application - Design System & Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Dynamic Light Theme Palette */
  --bg-gradient-clear-day: linear-gradient(135deg, #2b5876 0%, #4e4376 100%);
  --bg-gradient-main: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-hover: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #60a5fa;
  --accent-amber: #fbbf24;
  --accent-emerald: #34d399;
  --accent-purple: #c084fc;
  --accent-rose: #f43f5e;
  
  --card-radius: 24px;
  --pill-radius: 9999px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
body.light-theme {
  --bg-gradient-main: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 50%, #e0e7ff 100%);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-bg-hover: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
}

/* Reset & Core */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: var(--bg-gradient-main);
  color: var(--text-main);
  position: relative;
  transition: var(--transition-smooth);
}

/* Canvas Weather Background (Disabled) */
#weather-canvas {
  display: none;
}

/* Main Layout Wrapper */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem 1rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Navigation & Search Bar */
header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-cyan), #2563eb);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.3);
}

.brand-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-theme .brand-text h1 {
  background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Search Box Container */
.search-container {
  position: relative;
  flex: 1;
  max-width: 540px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.9rem 3.2rem 0.9rem 3.2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--pill-radius);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  transition: var(--transition-smooth);
  box-shadow: var(--glass-shadow);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
  background: var(--glass-bg-hover);
}

.geo-btn {
  position: absolute;
  right: 0.75rem;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition-smooth);
}

.geo-btn:hover {
  background: var(--accent-cyan);
  color: #fff;
  transform: scale(1.05);
}

/* Autocomplete Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: none;
  max-height: 360px;
  overflow-y: auto;
}

body.light-theme .search-dropdown {
  background: rgba(255, 255, 255, 0.95);
}

.search-dropdown.active {
  display: block;
  animation: fadeInDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-item {
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: rgba(56, 189, 248, 0.15);
}

.dropdown-item .city-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.dropdown-item .city-region {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Header Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.action-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.7rem 1.1rem;
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  box-shadow: var(--glass-shadow);
}

.action-btn:hover, .lang-select:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
}

.lang-select {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.65rem 0.9rem;
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-smooth);
  box-shadow: var(--glass-shadow);
}

.lang-select option {
  background: #0f172a;
  color: #fff;
  font-weight: 600;
}

body.light-theme .lang-select option {
  background: #fff;
  color: #0f172a;
}

/* Regional Center Selector */
.city-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.25rem;
  overflow: visible;
}

.city-selector-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.city-selector-control {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, 360px);
}

.city-selector-control > .fa-city {
  position: absolute;
  left: 1rem;
  color: var(--accent-cyan);
  pointer-events: none;
  z-index: 1;
}

.regional-city-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 0.72rem 2.8rem 0.72rem 2.65rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--pill-radius);
  background: var(--glass-bg);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.regional-city-select:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(56, 189, 248, 0.55);
}

.regional-city-select:focus-visible {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), var(--glass-shadow);
}

.regional-city-select option,
.regional-city-select optgroup {
  background: #0f172a;
  color: #fff;
}

body.light-theme .regional-city-select option,
body.light-theme .regional-city-select optgroup {
  background: #fff;
  color: #0f172a;
}

.city-selector-chevron {
  position: absolute;
  right: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

@media (max-width: 600px) {
  .city-selector-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.45rem;
  }

  .city-selector-control {
    width: 100%;
  }
}

/* Main Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
}

@media (max-width: 1080px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Glass Card Base */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* Current Weather Hero Card */
.hero-weather-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 100%);
  padding: 1.2rem 1.4rem;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.location-info h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
}

.location-info p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.1rem;
}

.favorite-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.favorite-btn.active, .favorite-btn:hover {
  color: var(--accent-amber);
  background: rgba(251, 191, 36, 0.15);
  border-color: var(--accent-amber);
}

.hero-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.temp-large {
  display: flex;
  align-items: flex-start;
}

.temp-val {
  font-family: 'Outfit', sans-serif;
  font-size: 3.8rem;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -1.5px;
}

.temp-unit {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-top: 0.25rem;
}

.weather-status-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.weather-icon-large {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.2));
}

.condition-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.feels-like {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Quick Metrics Row */
.hero-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-metric {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quick-metric i {
  font-size: 1.4rem;
  color: var(--accent-cyan);
}

.metric-meta span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.metric-meta strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i {
  color: var(--accent-cyan);
}

/* Hourly Forecast Section */
.hourly-forecast-card {
  margin-top: 1.25rem;
  overflow: visible;
}

.hourly-scroll-container {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.35rem 0 0.55rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  max-width: 100%;
  box-sizing: border-box;
}

.hourly-scroll-container::-webkit-scrollbar {
  height: 4px;
}

.hourly-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.hourly-item {
  min-width: 76px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.65rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

.hourly-item:hover, .hourly-item.now {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.hourly-item .h-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hourly-item img {
  width: 32px;
  height: 32px;
}

.hourly-item .h-temp {
  font-size: 0.9rem;
  font-weight: 700;
}

.hourly-item .h-pop {
  font-size: 0.65rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Hourly Chart Box */
.chart-wrapper {
  position: relative;
  height: 225px;
  width: 100%;
  max-width: 100%;
  margin-top: 0.7rem;
  overflow-x: hidden;
  overflow-y: visible;
}

#hourlyChart {
  display: block;
  height: 225px;
  max-width: none !important;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 112px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-size: 0.76rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.12s ease;
  white-space: nowrap;
}

.chart-tooltip.visible {
  opacity: 1;
}

body.light-theme .chart-tooltip {
  background: rgba(255, 255, 255, 0.97);
  color: #0f172a;
}

/* Grid of Weather Detail Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 115px;
  padding: 0.9rem 1rem;
}

.metric-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-card-head span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-card-head i {
  font-size: 1.2rem;
  color: var(--accent-cyan);
}

.metric-card-body {
  margin-top: 0.75rem;
}

.metric-card-body .value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
}

.metric-card-body .subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Compass Widget */
.compass-widget {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  position: relative;
  display: grid;
  place-items: center;
  margin-top: 0.5rem;
}

.compass-pointer {
  width: 4px;
  height: 28px;
  background: linear-gradient(to top, var(--accent-cyan), #ef4444);
  border-radius: 2px;
  transform-origin: center center;
  transition: transform 0.6s ease;
}

/* Progress bar for Humidity & UV */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.6rem;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Air Quality Card Badge */
.aqi-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--pill-radius);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

.aqi-good { background: rgba(52, 211, 153, 0.2); color: var(--accent-emerald); }
.aqi-moderate { background: rgba(251, 191, 36, 0.2); color: var(--accent-amber); }
.aqi-unhealthy { background: rgba(244, 63, 94, 0.2); color: var(--accent-rose); }

/* Sun Arc Curve Widget */
.sun-arc-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.sun-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sun-item i {
  font-size: 1.5rem;
  color: var(--accent-amber);
}

.sun-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sun-meta strong {
  font-size: 1rem;
  font-weight: 700;
}

/* Sidebar Columns (7-Day Forecast & Interactive Map) */
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* 7-Day Forecast Card */
.daily-forecast-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.daily-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  transition: var(--transition-smooth);
}

.daily-row:hover {
  background: rgba(255, 255, 255, 0.09);
}

.daily-row .day-name {
  width: 90px;
  font-weight: 600;
  font-size: 0.9rem;
}

.daily-row .day-icon-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.daily-row img {
  width: 32px;
  height: 32px;
}

.daily-row .pop-text {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  width: 35px;
  font-weight: 600;
}

.daily-row .temp-range-bar {
  flex: 1;
  max-width: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0.5rem;
}

.daily-row .t-min {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.daily-row .t-max {
  font-size: 0.85rem;
  font-weight: 700;
}

/* Map Container */
.map-card {
  overflow: visible;
}

#ukraine-map {
  height: 380px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

#weather-map-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.35);
}

/* Footer Styling */
.city-selector-bar { display: none; }

.recent-cities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.recent-city {
  border: 0;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.recent-city:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.16); }

footer.app-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.app-footer {
  position: relative;
}

.app-footer p:first-child {
  align-self: stretch;
  text-align: left;
  padding-right: 260px;
}

.footer-creator {
  position: absolute;
  right: 0;
  top: 16px;
  white-space: nowrap;
  color: var(--text-dim);
}

footer.app-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Keyframe Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Loading Spinner Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  z-index: 999;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

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

/* Version 3: local static SVG images and lightweight map */
.weather-icon-large, .hourly-item img, .daily-row img { animation: none !important; }
