/* === badetemperaturer.no — UX-spec styles === */

:root {
  --brand: #0891B2;
  --brand-rgb: 8, 145, 178;
  --brand-hover: #0E7490;
  --brand-deep: #155E75;
  --brand-light: #ECFEFF;
  --brand-mid: #A5F3FC;
  --temp-cold: #3B82F6;
  --temp-cool: #22C55E;
  --temp-warm: #F97316;
  --temp-hot: #EF4444;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --bg-main: #FAFAFA;
  --bg-secondary: #F3F4F6;
  --surface: #FFFFFF;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-muted: #9CA3AF;
    --border: #374151;
    --bg-main: #111827;
    --bg-secondary: #1F2937;
    --surface: #1F2937;
    --brand-light: #164E63;
  }
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-main);
}

h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-bottom: var(--space-md); }
h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.3; margin-top: var(--space-xl); margin-bottom: var(--space-md); }
h3 { font-size: 1.1rem; font-weight: 600; }

/* === Header === */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(17, 24, 39, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
}

.site-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-deep);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.header-actions { display: flex; gap: var(--space-sm); }

.header-btn {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.header-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--brand);
  color: var(--brand);
}

/* === Breadcrumbs === */
.breadcrumbs {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  position: fixed;
  top: 48px;
  left: 0;
  z-index: 900;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  border-radius: 0 0 var(--radius-sm) 0;
}

.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }

/* === Map === */
.map-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 48px);
  margin-top: 48px;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Search */
.map-search {
  position: absolute;
  top: 12px;
  left: var(--space-md);
  right: var(--space-md);
  z-index: 500;
  max-width: 360px;
}

.map-search__input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  outline: none;
  transition: border-color 0.15s;
}

.map-search__input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.map-search__icon {
  position: absolute;
  left: 12px;
  top: 11px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.map-search__results {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 4px;
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
}

.search-result {
  padding: 10px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-secondary); }
.search-result--city { display: flex; flex-direction: column; gap: 1px; }
.search-result__detail { font-size: 0.75rem; color: var(--text-muted); }
.search-result__divider { padding: 4px 14px; font-size: 0.7rem; color: var(--text-muted); background: var(--bg-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

/* Legend */
.map-legend {
  position: absolute;
  bottom: var(--space-lg);
  left: var(--space-md);
  z-index: 500;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.map-legend__item { display: flex; align-items: center; gap: 4px; }
.map-legend__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Filter button */
.map-filter-btn {
  position: absolute;
  bottom: var(--space-lg);
  right: var(--space-md);
  z-index: 500;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.map-filter-btn:hover { border-color: var(--brand); color: var(--brand); }

/* Locate button */
.map-locate-btn {
  position: absolute;
  bottom: calc(var(--space-lg) + 52px);
  right: var(--space-md);
  z-index: 500;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.map-locate-btn:hover { background: var(--brand-light); border-color: var(--brand); }
.map-locate-btn--active { background: var(--brand); border-color: var(--brand); color: white; }
.map-locate-btn--active svg { stroke: white; }

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 0.7rem;
  animation: bounce 2s infinite;
  pointer-events: none;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}

/* Filter sheet */
.filter-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  padding: var(--space-lg);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1100;
}

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

.filter-sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto var(--space-md);
}

.filter-sheet__title {
  margin-bottom: var(--space-md);
}

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

.filter-overlay--open { opacity: 1; pointer-events: auto; }

.filter-group { margin-bottom: var(--space-md); }

.filter-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.filter-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.filter-apply {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: var(--space-sm);
}

.filter-apply:hover { background: var(--brand-hover); }

/* === Leaflet pin styling === */
.temp-pin { background: none !important; border: none !important; }

.temp-pin__value {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.temp-pin__value[data-zone="hot"]  { color: #DC2626; border: 1.5px solid #FCA5A5; }
.temp-pin__value[data-zone="warm"] { color: #EA580C; border: 1.5px solid #FDBA74; }
.temp-pin__value[data-zone="cool"] { color: #16A34A; border: 1.5px solid #86EFAC; }
.temp-pin__value[data-zone="cold"] { color: #2563EB; border: 1.5px solid #93C5FD; }

/* Leaflet popup */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content { margin: 0 !important; }

.popup { padding: var(--space-md); min-width: 200px; }
.popup__name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin: 0 0 var(--space-xs); }
.popup__temp { font-size: 1.5rem; font-weight: 700; margin: 0 0 var(--space-xs); display: flex; align-items: center; gap: var(--space-sm); }

.popup__zone {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}

.popup__zone--hot  { background: #FEE2E2; color: #DC2626; }
.popup__zone--warm { background: #FFF7ED; color: #EA580C; }
.popup__zone--cool { background: #F0FDF4; color: #16A34A; }
.popup__zone--cold { background: #EFF6FF; color: #2563EB; }
.popup__meta { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* === Content section === */
.content-section {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

/* Top list */
.top-list { list-style: none; padding: 0; margin: var(--space-lg) 0; }

.top-list__item {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
  cursor: pointer;
  transition: background 0.15s;
}

.top-list__item:hover { background: var(--bg-secondary); }

.top-list__rank { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); width: 28px; text-align: center; }
.top-list__rank--gold { color: #F59E0B; }
.top-list__rank--silver { color: #9CA3AF; }
.top-list__rank--bronze { color: #D97706; }

.top-list__info { flex: 1; }
.top-list__name { font-weight: 600; font-size: 0.95rem; }
.top-list__location { font-size: 0.8rem; color: var(--text-muted); }

.top-list__temp { font-size: 1.25rem; font-weight: 700; }
.top-list__temp--hot  { color: #EF4444; }
.top-list__temp--warm { color: #F97316; }
.top-list__temp--cool { color: #22C55E; }
.top-list__temp--cold { color: #3B82F6; }

/* Region grid */
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.region-card {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.region-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.region-card__name { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-xs); }
.region-card__temp { font-size: 1.5rem; font-weight: 700; }
.region-card__label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* City nav */
.city-nav { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin: var(--space-lg) 0; }

.city-nav__link {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.city-nav__link:hover { background: var(--brand-light); color: var(--brand); }
.city-nav__link--active { background: var(--brand); color: white; }

/* FAQ */
.faq-list { margin: var(--space-lg) 0; }
.faq-item { border-bottom: 1px solid var(--border); }

.faq-item__question {
  width: 100%;
  text-align: left;
  padding: var(--space-md) 0;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.faq-item__question:hover { color: var(--brand); }

.faq-item__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.faq-item--open .faq-item__icon { transform: rotate(45deg); }

.faq-item__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item--open .faq-item__answer { max-height: 500px; }

.faq-item__answer-inner {
  padding: 0 0 var(--space-md);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Footer === */
.site-footer {
  background: var(--brand-deep);
  color: rgba(255, 255, 255, 0.85);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
}

.footer__ecosystem { margin-bottom: var(--space-lg); }

.footer__ecosystem-title {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: var(--space-md);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
}

.footer__link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.footer__link:hover { color: white; }

.footer__beep {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(254, 190, 16, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid rgba(254, 190, 16, 0.2);
}

.footer__beep-text { font-size: 0.85rem; color: rgba(255, 255, 255, 0.9); }
.footer__beep-link { color: #FEBE10; font-weight: 600; text-decoration: none; }
.footer__copyright { margin-top: var(--space-lg); font-size: 0.75rem; color: rgba(255, 255, 255, 0.4); }

/* === Mobile === */
@media (max-width: 640px) {
  .map-container {
    height: 70vh;
  }

  .map-search {
    top: 8px;
    left: var(--space-sm);
    right: var(--space-sm);
    max-width: none;
  }

  .map-legend {
    bottom: var(--space-md);
    left: var(--space-sm);
    font-size: 0.65rem;
    gap: var(--space-sm);
    padding: 6px 10px;
  }

  .content-section { padding: var(--space-lg) var(--space-sm); }
  .region-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }

  .btn-label { display: none; }

  .leaflet-popup-content-wrapper { max-width: calc(100vw - 48px) !important; }
}

@media (min-width: 641px) {
  .filter-sheet {
    position: fixed;
    bottom: auto;
    top: auto;
    right: var(--space-md);
    left: auto;
    bottom: 80px;
    width: 300px;
    border-radius: var(--radius-lg);
  }
}
