/* ============================
   KidWarm – Style v3
   Bright, elegant, human. Not template-y.
   Mobile-first responsive layout.
   ============================ */

:root {
  --bg: #FFFBF5;
  --surface: #ffffff;
  --surface-alt: #FEF6EC;
  --text: #2D2A32;
  --text-muted: #6B6777;
  --text-dim: #8A8694;
  --border: #F0EBE4;
  --accent: #3B82F6;
  --accent-light: #EFF6FF;
  --accent-dark: #1D4ED8;
  --warm: #F97316;
  --warm-light: #FFF7ED;
  --success: #22C55E;
  --warning-bg: #FFFBEB;
  --warning-text: #D97706;
  --alt-badge: #A855F7;
  --alt-badge-bg: #FAF5FF;

  /* Layer accent colors — used only for small touches, not backgrounds */
  --layer-base: #06B6D4;
  --layer-mid: #F59E0B;
  --layer-outer: #6366F1;
  --layer-acc: #EC4899;
  --layer-foot: #10B981;

  --temp-color: #3B82F6;

  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);

  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

img { max-width: 100%; }

/* ---- Layout ---- */
.container {
  max-width: 460px;
  margin: 0 auto;
  padding: var(--sp-md);
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) 0 var(--sp-sm);
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  width: 26px;
  height: 26px;
  color: var(--temp-color);
  transition: color 0.4s;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

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

/* ---- Language Dropdown ---- */
.lang-dropdown {
  position: relative;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  color: var(--text);
}
.lang-toggle:hover { border-color: var(--accent); }

.lang-flag { font-size: 0.85rem; line-height: 1; }
.lang-code { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); }
.lang-chevron { width: 12px; height: 12px; color: var(--text-dim); transition: transform 0.2s; }
.lang-chevron svg { width: 100%; height: 100%; }
.lang-dropdown.open .lang-chevron { transform: rotate(180deg); }

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  min-width: 130px;
  z-index: 100;
  overflow: hidden;
}
.lang-dropdown.open .lang-menu { display: block; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-family: var(--font);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.lang-option:hover { background: var(--accent-light); }
.lang-option.active { background: var(--accent-light); color: var(--accent-dark); }

/* ---- Tagline ---- */
.tagline {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
}

/* ---- Day Selector ---- */
.day-selector {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp-md);
}

.day-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 6px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}
.day-chip:hover { border-color: var(--text-dim); }
.day-chip.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dc-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}
.day-chip.active .dc-label { color: var(--accent-dark); }

.dc-temp {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.day-chip.active .dc-temp { color: var(--accent); }

/* ---- Age Selector ---- */
.age-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: var(--sp-lg);
}

.age-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 4px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.age-btn:hover { border-color: var(--text-dim); }

.age-btn .age-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  margin: 0 auto 4px;
  color: var(--text-dim);
  transition: color 0.2s;
}
.age-btn .age-icon svg { width: 100%; height: 100%; }

.age-btn .age-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
}

.age-btn .age-desc {
  display: block;
  font-size: 0.58rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.age-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.age-btn.active .age-icon { color: var(--accent); }
.age-btn.active .age-label { color: var(--accent-dark); }

/* ---- Weather Bar ---- */
.weather-bar {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-sm) var(--sp-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-md);
}

.wb-main {
  display: flex;
  align-items: baseline;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.wb-icon {
  width: 20px;
  height: 20px;
  color: var(--temp-color);
  display: inline-flex;
  align-self: center;
  flex-shrink: 0;
}
.wb-icon svg { width: 100%; height: 100%; }

.wb-temp {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--temp-color);
  transition: color 0.4s;
}

.wb-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wb-feels {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-left: auto;
}

.wb-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.wb-detail {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.wb-detail svg { width: 12px; height: 12px; }

.wb-loc {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  color: var(--text-muted);
}
.wb-loc svg { width: 11px; height: 11px; }

.icon-btn-sm {
  background: none;
  border: none;
  cursor: pointer;
  width: 13px;
  height: 13px;
  color: var(--text-dim);
  padding: 0;
  margin-left: 2px;
  transition: color 0.2s;
}
.icon-btn-sm:hover { color: var(--accent); }
.icon-btn-sm svg { width: 100%; height: 100%; }

/* ---- Search Panel ---- */
.search-panel {
  display: none;
  margin-top: var(--sp-sm);
}
.search-panel.open { display: block; }

.search-input {
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  background: var(--bg);
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); background: var(--surface); }

.search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--sp-xs);
}

.search-result {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: none;
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-md);
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.search-result:hover { background: var(--accent-light); }

/* ---- Forecast Strip ---- */
.forecast-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-sm) var(--sp-md) var(--sp-xs);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-md);
}

.forecast-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: var(--sp-sm);
}
.forecast-icon { width: 14px; height: 14px; }
.forecast-icon svg { width: 100%; height: 100%; }

.forecast-body {
  position: relative;
  overflow-x: auto;
  padding-bottom: var(--sp-sm);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.forecast-body::-webkit-scrollbar { height: 3px; }
.forecast-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.forecast-strip {
  display: flex;
  gap: 2px;
}

.forecast-hour {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 46px;
  padding: 6px 4px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.forecast-now { background: var(--accent-light); }

.fh-time {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
}

.fh-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.fh-icon svg { width: 100%; height: 100%; }

.fh-temp {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- Alerts ---- */
.alerts {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
}

.alert-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 600;
}

.alert-icon { width: 16px; height: 16px; flex-shrink: 0; }
.alert-icon svg { width: 100%; height: 100%; }

/* ---- Layer Cards ---- */
.layers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: var(--sp-lg);
}

.layer-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-md) 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

/* Subtle colored top bar instead of heavy left border + tinted background */
.layer-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--layer-color, var(--accent));
}

.layer-card[data-layer="base"]        { --layer-color: var(--layer-base); }
.layer-card[data-layer="mid"]         { --layer-color: var(--layer-mid); }
.layer-card[data-layer="outer"]       { --layer-color: var(--layer-outer); }
.layer-card[data-layer="accessories"] { --layer-color: var(--layer-acc); }
.layer-card[data-layer="footwear"]    { --layer-color: var(--layer-foot); }

.layer-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.layer-icon {
  width: 18px;
  height: 18px;
  color: var(--layer-color, var(--accent));
  flex-shrink: 0;
}
.layer-icon svg { width: 100%; height: 100%; }

.layer-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.layer-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 8px;
}

/* Clothing items */
.layer-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clothing-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.clothing-item:hover { background: var(--bg); }

.item-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  line-height: 1.3;
}

.alt-badge {
  background: var(--alt-badge-bg);
  color: var(--alt-badge);
}

.weather-badge {
  width: 13px;
  height: 13px;
  padding: 0;
  color: var(--warning-text);
  flex-shrink: 0;
}
.weather-badge svg { width: 100%; height: 100%; }

.item-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.item-note {
  font-size: 0.58rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.2;
}

/* ---- Tips ---- */
.tips-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  box-shadow: var(--shadow-sm);
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.tips-icon {
  width: 16px;
  height: 16px;
  color: var(--warm);
}
.tips-icon svg { width: 100%; height: 100%; }

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tips-list li {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}

.tips-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
}

/* ---- Loading & Error ---- */
.loading-state {
  text-align: center;
  padding: var(--sp-2xl) 0;
  color: var(--text-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto var(--sp-md);
  animation: spin 0.8s linear infinite;
}

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

.error-state {
  text-align: center;
  padding: var(--sp-xl) 0;
}

.btn-retry {
  margin-top: var(--sp-md);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-lg);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s;
}
.btn-retry:hover { background: var(--accent-dark); }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: var(--sp-xl) 0;
  font-size: 0.65rem;
  color: var(--text-dim);
}
.disclaimer {
  margin-top: var(--sp-xs);
  font-size: 0.58rem;
  opacity: 0.65;
  line-height: 1.4;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Responsive ---- */
@media (min-width: 520px) {
  .container { max-width: 500px; padding: var(--sp-lg); }
  .age-selector { gap: var(--sp-sm); }
  .item-name { font-size: 0.86rem; }
}

@media (min-width: 768px) {
  .container { max-width: 560px; }
}

/* ---- Precipitation Area Chart ---- */
.precip-row {
  display: flex;
  align-items: flex-end;
  margin-top: 2px;
}
.precip-badge {
  position: sticky;
  left: 2px;
  width: 10px;
  height: 10px;
  margin-right: -10px;
  color: #60A5FA;
  opacity: 0.7;
  flex-shrink: 0;
  z-index: 2;
  align-self: center;
}
.precip-badge svg { width: 100%; height: 100%; }
.precip-chart {
  display: block;
  flex-shrink: 0;
}

/* ---- Activity Suggestion Card ---- */
.activity-card {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--warm-light);
  border-radius: var(--r-md);
  padding: var(--sp-sm) var(--sp-md);
  margin-bottom: var(--sp-md);
}

.activity-icon {
  width: 18px;
  height: 18px;
  color: var(--warm);
  flex-shrink: 0;
}
.activity-icon svg { width: 100%; height: 100%; }

.activity-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

/* ---- Period Selector (Morning / Afternoon) ---- */
.period-selector {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp-md);
}

.period-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 4px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}
.period-chip:hover { border-color: var(--text-dim); }
.period-chip.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
}

/* ---- UV Alert Variants ---- */
.alert-uv {
  background: #FFFBEB;
  color: #B45309;
}
.alert-uv-mod {
  background: #FEFCE8;
  color: #A16207;
}

/* ---- Weather Animations ---- */
.weather-bar {
  position: relative;
  overflow: hidden;
  z-index: 0;
}
