/* ─── WEATHER COMPONENTS — CSS ───────────────────────────────────────────────
   Dark, premium, iOS-like glassmorphism.
   Import once in your main stylesheet or index.html.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --w-bg-base:       #0f1114;
  --w-bg-sheet:      #16191e;
  --w-bg-card:       #1e2229;
  --w-bg-card-hover: #252b34;
  --w-border:        rgba(255,255,255,0.07);
  --w-green:         #4ade80;
  --w-green-dim:     #22c55e;
  --w-text-primary:  #f0f4f8;
  --w-text-secondary:#8b95a1;
  --w-text-muted:    #4e5a65;
  --w-radius-sm:     10px;
  --w-radius-md:     16px;
  --w-radius-lg:     24px;
  --w-shadow-sheet:  0 -8px 48px rgba(0,0,0,0.55), 0 -2px 12px rgba(0,0,0,0.3);
  --w-font:          'Manrope', 'SF Pro Display', system-ui, sans-serif;
  --w-ease:          cubic-bezier(0.32, 0.72, 0, 1);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOP BAR
══════════════════════════════════════════════════════════════════════════════ */

.wtb {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             8px;
  width:           100%;
  height:          52px;
  padding:         0 16px;
  background:      rgba(15, 17, 20, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom:   1px solid var(--w-border);
  cursor:          pointer;
  user-select:     none;
  font-family:     var(--w-font);
  position:        relative;
  z-index:         900;
  transition:      background 0.2s ease;
}

.wtb:hover  { background: rgba(22, 25, 30, 0.92); }
.wtb:active { background: rgba(30, 34, 41, 0.95); }

/* Left — location */
.wtb__left {
  display:     flex;
  align-items: center;
  gap:         5px;
  flex:        1;
  min-width:   0;
}
.wtb__pin      { font-size: 13px; flex-shrink: 0; }
.wtb__location {
  font-size:     13px;
  font-weight:   500;
  color:         var(--w-text-secondary);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

/* Center — logo */
.wtb__center {
  display:         flex;
  align-items:     center;
  gap:             6px;
  flex-shrink:     0;
}
.wtb__brand {
  font-size:   15px;
  font-weight: 800;
  color:       var(--w-text-primary);
  letter-spacing: -0.02em;
}

/* Right — weather */
.wtb__right {
  display:     flex;
  align-items: center;
  gap:         5px;
  flex:        1;
  justify-content: flex-end;
  min-width:   0;
}
.wtb__wicon { font-size: 18px; flex-shrink: 0; }
.wtb__temp  {
  font-size:   14px;
  font-weight: 700;
  color:       var(--w-text-primary);
  flex-shrink: 0;
}
.wtb__desc  {
  font-size:     12px;
  color:         var(--w-text-secondary);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

/* Hide description on very small screens */
@media (max-width: 380px) {
  .wtb__desc     { display: none; }
  .wtb__location { max-width: 90px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   MODAL OVERLAY
══════════════════════════════════════════════════════════════════════════════ */

.wm-overlay {
  position:   fixed;
  inset:      0;
  z-index:    2000;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.3s ease;
}

.wm-overlay--visible {
  background:     rgba(0, 0, 0, 0.6);
  pointer-events: all;
}

/* ── Bottom sheet ──────────────────────────────────────────────────────────── */

.wm-sheet {
  position:        absolute;
  bottom:          0;
  left:            0;
  right:           0;
  max-height:      92dvh;
  background:      var(--w-bg-sheet);
  border-radius:   var(--w-radius-lg) var(--w-radius-lg) 0 0;
  box-shadow:      var(--w-shadow-sheet);
  transform:       translateY(100%);
  transition:      transform 0.38s var(--w-ease);
  display:         flex;
  flex-direction:  column;
  overflow:        hidden;
  font-family:     var(--w-font);
  will-change:     transform;
}

.wm-sheet--open {
  transform: translateY(0);
}

/* Handle */
.wm-handle {
  width:         40px;
  height:        4px;
  background:    var(--w-text-muted);
  border-radius: 2px;
  margin:        12px auto 0;
  flex-shrink:   0;
  cursor:        grab;
}
.wm-handle:active { cursor: grabbing; }

/* ── Header ────────────────────────────────────────────────────────────────── */

.wm-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             8px;
  padding:         14px 18px 14px;
  border-bottom:   1px solid var(--w-border);
  flex-shrink:     0;
  position:        relative;
}

.wm-header__location {
  display:     flex;
  align-items: center;
  gap:         5px;
  flex:        1;
  min-width:   0;
}
.wm-header__pin  { font-size: 13px; flex-shrink: 0; }
.wm-header__city {
  font-size:     13px;
  font-weight:   500;
  color:         var(--w-text-secondary);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.wm-header__logo {
  display:     flex;
  align-items: center;
  gap:         6px;
  flex-shrink: 0;
}
.wm-header__brand {
  font-size:      16px;
  font-weight:    800;
  color:          var(--w-text-primary);
  letter-spacing: -0.02em;
}

.wm-header__weather {
  display:     flex;
  align-items: center;
  gap:         5px;
  flex:        1;
  justify-content: flex-end;
  min-width:   0;
}
.wm-header__wicon { font-size: 22px; flex-shrink: 0; }
.wm-header__temp  {
  font-size:   18px;
  font-weight: 800;
  color:       var(--w-text-primary);
  flex-shrink: 0;
}
.wm-header__desc  {
  font-size:     12px;
  color:         var(--w-text-secondary);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.wm-close {
  position:   absolute;
  top:        10px;
  right:      14px;
  background: var(--w-bg-card);
  border:     none;
  color:      var(--w-text-secondary);
  font-size:  14px;
  width:      28px;
  height:     28px;
  border-radius: 50%;
  cursor:     pointer;
  display:    flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.wm-close:hover { background: var(--w-bg-card-hover); color: var(--w-text-primary); }

/* ── Scrollable body ───────────────────────────────────────────────────────── */

.wm-body {
  overflow-y:  auto;
  flex:        1;
  padding:     0 0 env(safe-area-inset-bottom, 16px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wm-body::-webkit-scrollbar { display: none; }

/* ── Section wrapper ───────────────────────────────────────────────────────── */

.wm-section {
  padding:       16px 18px;
  border-bottom: 1px solid var(--w-border);
}
.wm-section:last-child { border-bottom: none; }

.wm-section__title {
  font-size:      11px;
  font-weight:    600;
  color:          var(--w-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin:         0 0 12px;
}

/* ── Stats grid ────────────────────────────────────────────────────────────── */

.wm-stats { display: flex; flex-direction: column; gap: 2px; }

.wm-stats__row {
  display:         grid;
  grid-template-columns: 24px 1fr auto;
  align-items:     center;
  gap:             10px;
  padding:         10px 14px;
  background:      var(--w-bg-card);
  border-radius:   var(--w-radius-sm);
  transition:      background 0.15s;
}
.wm-stats__row:hover { background: var(--w-bg-card-hover); }

.wm-stats__icon  { font-size: 16px; text-align: center; }
.wm-stats__label {
  font-size:   13px;
  font-weight: 500;
  color:       var(--w-text-secondary);
}
.wm-stats__value {
  font-size:   13px;
  font-weight: 700;
  color:       var(--w-text-primary);
  text-align:  right;
}

/* ── Hourly forecast ───────────────────────────────────────────────────────── */

.wm-hourly {
  display:    flex;
  gap:        8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.wm-hourly::-webkit-scrollbar { display: none; }

.wm-hourly__item {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            6px;
  padding:        12px 14px;
  background:     var(--w-bg-card);
  border-radius:  var(--w-radius-md);
  min-width:      62px;
  flex-shrink:    0;
  transition:     background 0.15s;
}
.wm-hourly__item:hover { background: var(--w-bg-card-hover); }

.wm-hourly__time { font-size: 11px; font-weight: 600; color: var(--w-text-muted); }
.wm-hourly__icon { font-size: 22px; }
.wm-hourly__temp { font-size: 14px; font-weight: 700; color: var(--w-text-primary); }

/* ── Daily forecast ────────────────────────────────────────────────────────── */

.wm-daily { display: flex; flex-direction: column; gap: 4px; }

.wm-daily__row {
  display:         grid;
  grid-template-columns: 48px 1fr auto;
  align-items:     center;
  gap:             12px;
  padding:         11px 14px;
  background:      var(--w-bg-card);
  border-radius:   var(--w-radius-sm);
  transition:      background 0.15s;
}
.wm-daily__row:hover { background: var(--w-bg-card-hover); }

.wm-daily__day  { font-size: 13px; font-weight: 600; color: var(--w-text-secondary); }
.wm-daily__icon { font-size: 20px; text-align: center; }

.wm-daily__range { display: flex; align-items: center; gap: 3px; justify-content: flex-end; }
.wm-daily__max   { font-size: 14px; font-weight: 700; color: var(--w-text-primary); }
.wm-daily__sep   { font-size: 12px; color: var(--w-text-muted); }
.wm-daily__min   { font-size: 14px; font-weight: 500; color: var(--w-text-muted); }

/* ── Sunrise / Sunset bar ──────────────────────────────────────────────────── */

.wm-sun {
  display:     flex;
  align-items: center;
  gap:         12px;
}

.wm-sun__time {
  font-size:   13px;
  font-weight: 600;
  color:       var(--w-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.wm-sun__bar  { flex: 1; padding: 8px 0; }

.wm-sun__track {
  height:        4px;
  background:    var(--w-bg-card);
  border-radius: 2px;
  position:      relative;
  overflow:      visible;
}

.wm-sun__dot {
  position:     absolute;
  top:          50%;
  transform:    translate(-50%, -50%);
  width:        14px;
  height:       14px;
  background:   linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 50%;
  box-shadow:   0 0 10px rgba(251,191,36,0.6);
  transition:   left 0.5s var(--w-ease);
  /* Keep dot within the track */
  left: clamp(7px, var(--left, 50%), calc(100% - 7px));
}

/* ── Run advice ────────────────────────────────────────────────────────────── */

.wm-advice {
  padding:       14px 16px;
  border-radius: var(--w-radius-md);
  border-left:   3px solid transparent;
}

.wm-advice--ideal {
  background:   rgba(74, 222, 128, 0.08);
  border-color: var(--w-green);
}
.wm-advice--warn {
  background:   rgba(251, 191, 36, 0.08);
  border-color: #fbbf24;
}

.wm-advice__title {
  font-size:   14px;
  font-weight: 700;
  color:       var(--w-text-primary);
  margin:      0 0 4px;
}
.wm-advice__detail {
  font-size:   13px;
  color:       var(--w-text-secondary);
  margin:      0;
  line-height: 1.5;
}

/* ── Responsive adjustments ────────────────────────────────────────────────── */

@media (max-width: 380px) {
  .wm-header__desc { display: none; }
  .wm-header__city { max-width: 80px; }
  .wm-header__brand { display: none; }
}

@media (min-width: 600px) {
  .wm-sheet     { max-width: 540px; margin: 0 auto; border-radius: var(--w-radius-lg); bottom: 24px; }
  .wm-stats     { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
}

.wm-hourly__icon--svg { font-size: 22px !important; line-height: 1; }

/* img SVG night icons — proper sizing */
.wm-hourly__icon--img img {
  width:  28px;
  height: 28px;
  display: inline-block;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════════════════════
   WEATHER TILES — 2×3 iOS-style grid
══════════════════════════════════════════════════════════════════════════════ */

.wm-tiles {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   10px;
}
.wm-tile {
  background:     var(--w-bg-card);
  border-radius:  var(--w-radius-md);
  padding:        14px 14px 12px;
  display:        flex;
  flex-direction: column;
  gap:            4px;
  min-height:     110px;
  overflow:       hidden;
  transition:     background 0.15s;
}
.wm-tile:hover { background: var(--w-bg-card-hover); }

.wm-tile__header { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.wm-tile__icon   { font-size: 13px; opacity: 0.7; }
.wm-tile__label  { font-size: 10px; font-weight: 700; color: var(--w-text-muted); text-transform: uppercase; letter-spacing: 0.07em; }

.wm-tile__main   { font-size: 36px; font-weight: 800; color: var(--w-text-primary); line-height: 1; letter-spacing: -0.03em; }
.wm-tile__main--sm { font-size: 28px; }
.wm-tile__unit   { font-size: 18px; font-weight: 600; color: var(--w-text-secondary); margin-left: 1px; }
.wm-tile__sub    { font-size: 13px; font-weight: 500; color: var(--w-text-secondary); }

.wm-tile__uv-bar   { margin-top: auto; padding-top: 8px; }
.wm-tile__uv-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, #22c55e, #84cc16, #eab308, #f97316, #dc2626, #7c3aed); position: relative; }
.wm-tile__uv-dot   { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 12px; height: 12px; background: white; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }

.wm-tile__bar-wrap  { margin-top: auto; padding-top: 8px; }
.wm-tile__bar-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.wm-tile__bar-fill  { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.wm-tile__bar-fill--blue { background: linear-gradient(to right, #38bdf8, #0ea5e9); }

.wm-tile__compass        { margin-top: 4px; display: flex; justify-content: center; }
.wm-tile__compass-ring   { width: 72px; height: 72px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.12); position: relative; display: flex; align-items: center; justify-content: center; }
.wm-tile__compass-n, .wm-tile__compass-s, .wm-tile__compass-e, .wm-tile__compass-w { position: absolute; font-size: 9px; font-weight: 700; color: var(--w-text-muted); }
.wm-tile__compass-n { top: 4px;    left: 50%; transform: translateX(-50%); color: #ef4444; }
.wm-tile__compass-s { bottom: 4px; left: 50%; transform: translateX(-50%); }
.wm-tile__compass-e { right: 5px;  top: 50%;  transform: translateY(-50%); }
.wm-tile__compass-w { left: 5px;   top: 50%;  transform: translateY(-50%); }
.wm-tile__compass-center { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.wm-tile__compass-val    { font-size: 16px; font-weight: 800; color: var(--w-text-primary); }
.wm-tile__compass-unit   { font-size: 9px;  font-weight: 600; color: var(--w-text-muted); }

.wm-tile__pressure-arc     { margin-top: auto; }
.wm-tile__pressure-arc svg { width: 100%; height: auto; }

/* Sunset / Sunrise hourly cards */
.wm-hourly__item--sunset  { background: rgba(251,146,60,0.12); border: 1px solid rgba(251,146,60,0.4); border-radius: var(--w-radius-md); }
.wm-hourly__item--sunrise { background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.5); border-radius: var(--w-radius-md); }
.wm-hourly__sun-lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.wm-hourly__sun-lbl--sunset  { color: #fb923c; }
.wm-hourly__sun-lbl--sunrise { color: #fbbf24; }

/* SVG night icon sizing */
.wm-hourly__icon--img img { width: 28px; height: 28px; display: inline-block; vertical-align: middle; }

/* Wind direction arrow inside compass */
.wm-tile__compass-arrow {
  position: absolute;
  width:    40px;
  height:   40px;
  top:      50%;
  left:     50%;
  transform-origin: center center;
  transform: translate(-50%, -50%) rotate(0deg);
  pointer-events: none;
}

/* Tiles grid (always include) */
.wm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wm-tile { background: var(--w-bg-card); border-radius: var(--w-radius-md); padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 4px; min-height: 110px; overflow: hidden; transition: background 0.15s; }
.wm-tile:hover { background: var(--w-bg-card-hover); }
.wm-tile__header { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.wm-tile__icon   { font-size: 13px; opacity: 0.7; }
.wm-tile__label  { font-size: 10px; font-weight: 700; color: var(--w-text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.wm-tile__main   { font-size: 36px; font-weight: 800; color: var(--w-text-primary); line-height: 1; letter-spacing: -0.03em; }
.wm-tile__main--sm { font-size: 28px; }
.wm-tile__unit   { font-size: 18px; font-weight: 600; color: var(--w-text-secondary); margin-left: 1px; }
.wm-tile__sub    { font-size: 13px; font-weight: 500; color: var(--w-text-secondary); }
.wm-tile__uv-bar { margin-top: auto; padding-top: 8px; }
.wm-tile__uv-track { height: 6px; border-radius: 3px; background: linear-gradient(to right,#22c55e,#84cc16,#eab308,#f97316,#dc2626,#7c3aed); position: relative; }
.wm-tile__uv-dot { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 12px; height: 12px; background: white; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.wm-tile__bar-wrap { margin-top: auto; padding-top: 8px; }
.wm-tile__bar-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.wm-tile__bar-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
.wm-tile__bar-fill--blue { background: linear-gradient(to right,#38bdf8,#0ea5e9); }
.wm-tile__compass { margin-top: 4px; display: flex; justify-content: center; }
.wm-tile__compass-ring { width: 72px; height: 72px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.12); position: relative; display: flex; align-items: center; justify-content: center; }
.wm-tile__compass-n,.wm-tile__compass-s,.wm-tile__compass-e,.wm-tile__compass-w { position: absolute; font-size: 9px; font-weight: 700; color: var(--w-text-muted); }
.wm-tile__compass-n { top: 4px; left: 50%; transform: translateX(-50%); color: #ef4444; }
.wm-tile__compass-s { bottom: 4px; left: 50%; transform: translateX(-50%); }
.wm-tile__compass-e { right: 5px; top: 50%; transform: translateY(-50%); }
.wm-tile__compass-w { left: 5px; top: 50%; transform: translateY(-50%); }
.wm-tile__compass-center { display: flex; flex-direction: column; align-items: center; line-height: 1.1; position: relative; z-index: 1; }
.wm-tile__compass-val  { font-size: 16px; font-weight: 800; color: var(--w-text-primary); }
.wm-tile__compass-unit { font-size: 9px; font-weight: 600; color: var(--w-text-muted); }
.wm-tile__pressure-arc { margin-top: auto; }
.wm-tile__pressure-arc svg { width: 100%; height: auto; }
.wm-hourly__item--sunset  { background: rgba(251,146,60,.12); border: 1px solid rgba(251,146,60,.4); border-radius: var(--w-radius-md); }
.wm-hourly__item--sunrise { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.5); border-radius: var(--w-radius-md); }
.wm-hourly__sun-lbl { font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.wm-hourly__sun-lbl--sunset  { color: #fb923c; }
.wm-hourly__sun-lbl--sunrise { color: #fbbf24; }
.wm-hourly__icon--img img { width: 28px; height: 28px; display: inline-block; vertical-align: middle; }
.wm-hero { display: flex; flex-direction: column; align-items: center; padding: 28px 18px 20px; border-bottom: 1px solid var(--w-border); text-align: center; }
.wm-hero__icon { font-size: 52px; line-height: 1; margin-bottom: 8px; }
.wm-hero__icon img { width: 52px; height: 52px; }
.wm-hero__temp { font-size: 72px; font-weight: 800; color: var(--w-text-primary); line-height: 1; letter-spacing: -0.04em; margin-bottom: 6px; }
.wm-hero__desc { font-size: 18px; font-weight: 500; color: var(--w-text-secondary); margin-bottom: 10px; text-transform: capitalize; }
.wm-hero__meta { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--w-text-muted); }
.wm-hero__sep { opacity: .4; }
