/* weather-pwa/style.css — 날씨 · 대기질 다크테마 (PWA) */

/* ── 리셋 & 기본 ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%; overflow: hidden;
}
body {
  font-family: -apple-system, 'Malgun Gothic', 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.6;
  color: #d4d4d4; background: #1a1a2e;
  /* 아이폰 safe-area */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
#app {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

/* ── 뷰 탭 (T/N/A/W) ── */
.view-tabs {
  display: flex; gap: 0;
  background: #0f3460;
  border-bottom: 2px solid #16213e;
  flex-shrink: 0;
}
.view-tab {
  flex: 1; padding: 10px 6px;
  text-align: center; font-size: 13px; font-weight: 600;
  color: #8899aa; cursor: pointer;
  border: none; background: transparent;
  transition: color .15s, background .15s;
  /* 터치 타겟 44px 이상 */
  min-height: 44px;
}
.view-tab:hover { color: #ccc; background: rgba(255,255,255,.05); }
.view-tab.active {
  color: #fff; background: #16213e;
  border-bottom: 2px solid #5dade2;
}
.view-tab:focus, .view-tab:focus-visible {
  outline: 2px solid #5dade2; outline-offset: -2px;
}
.view-tab .shortcut {
  font-size: 10px; color: #667; display: block;
}

/* ── 방송 바 (상단) ── */
.broadcast-bar {
  flex-shrink: 0;
  padding: 6px 16px;
  background: #1a1a2e;
}
.broadcast-btn {
  width: 100%;
  padding: 12px 12px;
  background: linear-gradient(135deg, #0f3460 0%, #1a5276 100%);
  border: 1px solid #2a5a8f;
  border-radius: 12px;
  color: #e8e8e8;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
  transition: color .15s, background .15s, transform .1s;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.broadcast-btn:hover, .broadcast-btn:active {
  color: #fff; background: linear-gradient(135deg, #1a5276 0%, #2471a3 100%);
  transform: scale(0.98);
}
.broadcast-btn:focus-visible {
  outline: 2px solid #5dade2; outline-offset: -2px;
}

/* ── 위치 표시 ── */
.loc {
  font-size: 13px; color: #aaa;
  padding: 0 0 4px;
}

/* ── 콘텐츠 영역 ── */
.content-area {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
}

/* ── 오늘/내일/모레 가로 스크롤 snap ── */
.day-scroller {
  display: flex;
  flex: 1;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.day-scroller::-webkit-scrollbar { display: none; }

.day-page {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  overflow-y: auto;
  padding: 8px 16px 12px;
  -webkit-overflow-scrolling: touch;
}

/* 주간 뷰 (스크롤러 없이 단독) */
.weekly-content {
  flex: 1; overflow-y: auto;
  padding: 8px 16px 12px;
  -webkit-overflow-scrolling: touch;
}

/* ── 카드 ── */
.card {
  background: #16213e;
  border-radius: 12px;
  padding: 16px 18px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.card-title {
  font-size: 16px; font-weight: 700;
  margin-bottom: 10px; color: #e8e8e8;
  display: flex; align-items: center; gap: 6px;
}
.card-title .sub {
  font-weight: 400; font-size: 12px; color: #888;
}

/* ── 상세 그리드 ── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px; margin-top: 8px;
}
.detail-item {
  padding: 8px 12px;
  background: #1a1a3e; border-radius: 8px;
}
.detail-item .label {
  font-size: 12px; color: #999;
}
.detail-item .value {
  font-size: 16px; font-weight: 700; color: #e8e8e8;
}

/* ── 히어로 (내일/모레) ── */
.hero {
  display: flex; align-items: center;
  gap: 8px; margin: 4px 0 6px;
}
.hero-emoji { font-size: 42px; }
.hero-temp {
  font-size: 32px; font-weight: 700; color: #e0e0e0;
}
.hero-temp .lo { color: #5dade2; }
.hero-temp .hi { color: #e74c3c; }

/* ── 기온 요약 ── */
.temp-summary {
  font-size: 15px; color: #ccc; margin-top: 8px;
  font-weight: 600; letter-spacing: 0.3px;
}
.temp-summary .lo { color: #5dade2; }
.temp-summary .hi { color: #e74c3c; font-weight: 700; }

/* ── 대기질 배지 ── */
.aqi-badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  font-weight: 700; font-size: 12px; color: #fff;
}
.aqi-good { background: #27ae60; }
.aqi-moderate { background: #f39c12; }
.aqi-bad { background: #e74c3c; }
.aqi-very-bad { background: #8e44ad; }

/* ── 대기질 행 ── */
.aqi-row {
  display: flex; justify-content: space-between;
  align-items: center; padding: 7px 0;
  border-bottom: 1px solid #2a2a4e;
}
.aqi-row:last-child { border-bottom: none; }
.aqi-label { font-size: 13px; color: #d4d4d4; }
.aqi-val { font-weight: 600; font-size: 15px; margin-right: 6px; }

/* ── 시간별 예보 (가로 스크롤) ── */
.hourly-scroll {
  display: flex; gap: 10px;
  overflow-x: auto; padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.hourly-item {
  flex-shrink: 0; text-align: center;
  min-width: 68px; padding: 10px 6px;
  background: #1a1a3e; border-radius: 10px;
}
.hourly-time { font-size: 13px; color: #aaa; font-weight: 600; }
.hourly-emoji { font-size: 22px; margin: 4px 0; }
.hourly-temp { font-size: 15px; font-weight: 700; }
.hourly-pop { font-size: 11px; color: #3498db; }

/* ── 주간 예보 행 ── */
.weekly-row {
  display: flex; align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #2a2a4e;
}
.weekly-row:last-child { border-bottom: none; }
.weekly-day { width: 90px; font-weight: 600; font-size: 14px; }
.weekly-emoji { width: 36px; font-size: 20px; text-align: center; }
.weekly-temp { flex: 1; font-size: 14px; }
.weekly-lo { color: #3498db; }
.weekly-hi { color: #e74c3c; font-weight: 600; }
.weekly-pop { width: 75px; text-align: right; color: #3498db; font-size: 13px; }
.weekly-sky { font-size: 13px; color: #c0c0c0; margin-left: 6px; }

/* ── 하단 버튼 바 (PWA 모바일) ── */
.bottom-bar {
  display: flex; gap: 0;
  background: #0f3460;
  border-top: 1px solid #16213e;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #8899aa;
  font-size: 13px; font-weight: 600;
  padding: 12px 6px;
  cursor: pointer;
  min-height: 48px;
  transition: color .15s, background .15s;
}
.bottom-btn:hover, .bottom-btn:active {
  color: #fff; background: rgba(255,255,255,.08);
}
.bottom-btn:focus-visible {
  outline: 2px solid #5dade2; outline-offset: -2px;
}

/* ── 상태바 ── */
.status-bar {
  padding: 6px 12px; font-size: 11px;
  color: #667; background: #0f3460;
  border-top: 1px solid #16213e;
  flex-shrink: 0;
}

/* ── 로딩/에러 ── */
.loading-card {
  text-align: center; padding: 40px;
}
.error-card {
  padding: 20px;
}

/* ── 숨김 ── */
.hidden { display: none !important; }

/* ── ARIA 포커스 ── */
:focus-visible {
  outline: 2px solid #5dade2;
  outline-offset: 2px;
}

/* ── 모바일 반응형 ── */
@media (max-width: 480px) {
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .weekly-day { width: 80px; font-size: 13px; }
  .status-bar { display: none; }
}
