/* ==========================================================================
   PERSISTENT TYPOGRAPHY: IRANYekanX Pro & Kalameh 4
   ========================================================================== */

@font-face {
  font-family: 'IRANYekanX';
  src: url('/fonts/iranyekan/IRANYekanX-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IRANYekanX';
  src: url('/fonts/iranyekan/IRANYekanX-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IRANYekanX';
  src: url('/fonts/iranyekan/IRANYekanX-DemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IRANYekanX';
  src: url('/fonts/iranyekan/IRANYekanX-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IRANYekanX';
  src: url('/fonts/iranyekan/IRANYekanX-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Kalameh Font for Headings, Brand Title & Hero Temperatures */
@font-face {
  font-family: 'Kalameh';
  src: url('/fonts/kalameh/KalamehWeb-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Kalameh';
  src: url('/fonts/kalameh/KalamehWeb-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Kalameh';
  src: url('/fonts/kalameh/KalamehWeb-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Kalameh';
  src: url('/fonts/kalameh/KalamehWeb-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   CSS RESET & ROOT VARIABLES
   ========================================================================== */

:root {
  --font-body: 'IRANYekanX', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Kalameh', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg-primary: #070b14;
  --bg-secondary: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(56, 189, 248, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  direction: rtl;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 0%, #0d1a33 0%, #070b14 70%);
}

/* Atmospheric aurora ambient backdrops */
.atmospheric-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-glow-1 {
  position: absolute;
  top: -15%;
  right: 15%;
  width: 60vw;
  height: 50vh;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.12) 0%, rgba(99, 102, 241, 0.04) 50%, transparent 70%);
  filter: blur(80px);
  transform: translateZ(0);
}

.aurora-glow-2 {
  position: absolute;
  top: 25%;
  left: -10%;
  width: 50vw;
  height: 60vh;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(56, 189, 248, 0.03) 60%, transparent 80%);
  filter: blur(100px);
  transform: translateZ(0);
}

/* Glassmorphism Cards (Glisse & Apple Design Specification) */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 1.5rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

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

/* Global scrollbar customization (page body only) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

/* Weather Hero Temperature Display */
.hero-temp-number {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 3.8rem;
  line-height: 1;
  background: linear-gradient(180deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@media (min-width: 640px) {
  .hero-temp-number {
    font-size: 5.5rem;
  }
}

@media (min-width: 768px) {
  .hero-temp-number {
    font-size: 7.5rem;
  }
}

/* Meteorological Map Layer Nodes & Badges */
.map-layer-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.map-layer-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: translateX(-2px);
}

/* ==========================================================================
   HOURLY FORECAST HORIZONTAL SCROLLER (ZERO SCROLLBAR + DRAG-TO-SCROLL)
   ========================================================================== */

#hourly-forecast-list,
.hourly-scroll-container {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  padding-top: 0.25rem;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE / Edge */
  -webkit-overflow-scrolling: touch; /* Momentum scroll on mobile */
  cursor: grab;
  user-select: none;
}

#hourly-forecast-list:active,
#hourly-forecast-list.cursor-grabbing,
.hourly-scroll-container:active,
.hourly-scroll-container.cursor-grabbing {
  cursor: grabbing !important;
}

#hourly-forecast-list::-webkit-scrollbar,
.hourly-scroll-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.hourly-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-radius: 1rem;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  user-select: none;
}

@media (min-width: 640px) {
  .hourly-item {
    width: 86px;
    padding: 0.875rem 0.5rem;
  }
}

.hourly-item:hover, .hourly-item.current-hour {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

/* Pulsing beacon marker for active location on Leaflet */
.current-location-beacon {
  position: relative;
  width: 32px;
  height: 32px;
}

.beacon-dot {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 12px;
  height: 12px;
  background: #38bdf8;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px #38bdf8;
}

.beacon-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border: 2px solid #38bdf8;
  border-radius: 50%;
  animation: beaconPulse 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

@keyframes beaconPulse {
  0% {
    transform: scale(0.3);
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Quick City Jump Pills & Bar */
#quick-city-chips-bar {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch;
}

#quick-city-chips-bar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.quick-city-chip {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.22);
  color: #94a3b8;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.quick-city-chip:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  border-top-color: rgba(125, 211, 252, 0.6);
  color: #38bdf8;
  transform: translateY(-1px);
}

.quick-city-chip:active {
  transform: scale(0.96);
}

.quick-city-chip.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(99, 102, 241, 0.25)) !important;
  border-color: #38bdf8 !important;
  border-top-color: #7dd3fc !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  transform: scale(1.04);
}

/* Glisse Apple Liquid Glass Layer Switcher Buttons */
.glisse-layer-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.25);
  color: #94a3b8;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  user-select: none;
}

.glisse-layer-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(56, 189, 248, 0.45);
  border-top-color: rgba(125, 211, 252, 0.6);
  color: #f8fafc;
  transform: translateY(-1px);
}

.glisse-layer-btn:active {
  transform: scale(0.95);
}

.glisse-layer-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.4), rgba(99, 102, 241, 0.35)) !important;
  border-color: #38bdf8 !important;
  border-top-color: #7dd3fc !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

/* A11y focus outline */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* ==========================================================================
   LEAFLET POPUP DARK-GLASS THEME & RTL ADAPTATION
   ========================================================================== */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 1rem !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.6) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.5 !important;
}

.leaflet-container a.leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding: 8px !important;
  right: auto !important;
  left: 8px !important;
  top: 8px !important;
  font-size: 16px !important;
  transition: color 0.15s ease !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}

/* High-contrast storm warning node on map */
.custom-lightning-node, .custom-forecast-lightning {
  cursor: pointer;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.storm-warning-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #f59e0b;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
  transition: transform 0.15s ease;
}

.storm-warning-badge:hover {
  transform: scale(1.15);
}

