/* ============================================================
   날씨 위젯 — panel.css
   ============================================================
   톤: 뉴스 브리핑 정합 (다크 그레이 #374151 + Gray-50 toolbar)
   SVG line-art currentColor (박제 §"이모지 = 유아틱" 정합)
   ============================================================ */

.weather-section {
  --wx-text-1: #1f2937;
  --wx-text-2: #374151;
  --wx-text-3: #6b7280;
  --wx-text-4: #9ca3af;
  --wx-line: #e5e7eb;
  --wx-bg: #fafafa;
  --wx-bg-soft: #f3f4f6;
  --wx-accent: #2563eb;        /* sky-blue, 본진 톤 정합 */
  --wx-warn: #d97706;
  --wx-bad: #dc2626;
  --wx-good: #059669;
  color: var(--wx-text-2);
  font-size: 13px;
  line-height: 1.5;
}

/* ─── 검색 + 즐겨찾기 ─── */
.wx-toolbar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--wx-bg-soft);
  border-bottom: 1px solid var(--wx-line);
}

.wx-search-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.wx-search-row .wx-search { flex: 1; }

.wx-refresh-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: auto;
  background: #fff;
  border: 1px solid var(--wx-line);
  border-radius: 6px;
  color: var(--wx-text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.wx-refresh-btn:hover {
  background: var(--wx-accent);
  border-color: var(--wx-accent);
  color: #fff;
}
.wx-refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}
.wx-refresh-btn.spinning svg {
  animation: wx-spin 0.9s linear infinite;
}
@keyframes wx-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.wx-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--wx-line);
  border-radius: 6px;
  padding: 6px 10px;
}
.wx-search:focus-within {
  border-color: var(--wx-accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.wx-search-icon {
  color: var(--wx-text-3);
  flex-shrink: 0;
}
.wx-search-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--wx-text-1);
}
.wx-search-input::placeholder { color: var(--wx-text-4); }

.wx-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--wx-line);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  max-height: 280px;
  overflow-y: auto;
  z-index: 5;
}
.wx-search-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--wx-line);
  padding: 8px 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.wx-search-item:last-child { border-bottom: 0; }
.wx-search-item:hover { background: var(--wx-bg-soft); }
.wx-search-item strong { color: var(--wx-text-1); font-weight: 600; }
.wx-search-sub { color: var(--wx-text-3); font-size: 12px; }
.wx-search-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--wx-text-3);
  text-align: center;
}

.wx-favorites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wx-fav-hint {
  font-size: 11px;
  color: var(--wx-text-3);
}
.wx-fav-chip {
  background: #fff;
  border: 1px solid var(--wx-line);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--wx-text-2);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.wx-fav-chip:hover { background: var(--wx-bg-soft); border-color: #cfd5dc; }
.wx-fav-chip.active {
  background: var(--wx-accent);
  border-color: var(--wx-accent);
  color: #fff;
  font-weight: 600;
}

/* ─── 메인 본문 ─── */
.wx-main {
  padding: 14px 14px 18px;
}

.wx-loading, .wx-error {
  padding: 40px 16px;
  text-align: center;
  color: var(--wx-text-3);
  font-size: 13px;
}
.wx-error { color: var(--wx-bad); }

/* ─── 현재 날씨 카드 ─── */
.wx-current {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--wx-line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.wx-current-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.wx-current-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wx-current-name strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--wx-text-1);
}
.wx-current-sub {
  font-size: 11px;
  color: var(--wx-text-3);
}
.wx-fav-toggle {
  background: transparent;
  border: 0;
  color: var(--wx-text-4);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.12s;
}
.wx-fav-toggle:hover { color: var(--wx-warn); }
.wx-fav-toggle.on { color: #f59e0b; }

.wx-current-body {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
  margin-bottom: 12px;
}
.wx-current-ico {
  color: var(--wx-text-2);
  flex-shrink: 0;
}
.wx-current-temp {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wx-temp-now {
  font-size: 38px;
  font-weight: 300;
  color: var(--wx-text-1);
  line-height: 1;
  letter-spacing: -1px;
}
.wx-temp-unit {
  font-size: 18px;
  font-weight: 400;
  color: var(--wx-text-3);
  margin-left: 2px;
}
.wx-temp-feel {
  font-size: 12px;
  color: var(--wx-text-3);
}
.wx-temp-label {
  font-size: 13px;
  color: var(--wx-text-2);
  font-weight: 500;
}

.wx-current-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--wx-line);
}
.wx-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 6px;
}
.wx-stat-k {
  font-size: 11px;
  color: var(--wx-text-3);
}
.wx-stat-v {
  font-size: 13px;
  color: var(--wx-text-1);
  font-weight: 600;
}
.wx-stat-sub {
  font-size: 10px;
  color: var(--wx-text-4);
}
.wx-pm-good   .wx-stat-v { color: var(--wx-good); }
.wx-pm-fair   .wx-stat-v { color: #0891b2; }
.wx-pm-soso   .wx-stat-v { color: var(--wx-warn); }
.wx-pm-bad    .wx-stat-v { color: var(--wx-bad); }

/* ─── 작업 등급 ─── */
.wx-advisory {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 12px;
}
.wx-adv-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.wx-adv-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.wx-adv-label {
  margin-left: auto;
  font-weight: 700;
  font-size: 13px;
}
.wx-adv-reasons {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
  color: var(--wx-text-2);
  line-height: 1.6;
}
.wx-adv-reasons li + li { margin-top: 2px; }

.wx-adv-safe    { background: #ecfdf5; border: 1px solid #a7f3d0; }
.wx-adv-safe    .wx-adv-dot { background: var(--wx-good); }
.wx-adv-safe    .wx-adv-label { color: var(--wx-good); }

.wx-adv-caution { background: #fffbeb; border: 1px solid #fde68a; }
.wx-adv-caution .wx-adv-dot { background: var(--wx-warn); }
.wx-adv-caution .wx-adv-label { color: var(--wx-warn); }

.wx-adv-warning { background: #fff1f2; border: 1px solid #fecaca; }
.wx-adv-warning .wx-adv-dot { background: var(--wx-bad); }
.wx-adv-warning .wx-adv-label { color: var(--wx-bad); }

.wx-adv-halt    { background: #fef2f2; border: 1px solid #fca5a5; }
.wx-adv-halt    .wx-adv-dot { background: var(--wx-bad); }
.wx-adv-halt    .wx-adv-label { color: var(--wx-bad); }

/* ─── 섹션 ─── */
.wx-section {
  margin-bottom: 14px;
}
.wx-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--wx-text-2);
  margin-bottom: 6px;
  padding-left: 2px;
}

/* ─── 시간별 ─── */
.wx-hourly {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.wx-hourly::-webkit-scrollbar { height: 6px; }
.wx-hourly::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.wx-hour {
  flex: 0 0 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: #fff;
  border: 1px solid var(--wx-line);
  border-radius: 6px;
}
.wx-hour-time {
  font-size: 11px;
  color: var(--wx-text-3);
}
.wx-hour-ico {
  color: var(--wx-text-2);
  margin: 2px 0;
}
.wx-hour-temp {
  font-size: 14px;
  font-weight: 600;
  color: var(--wx-text-1);
}
.wx-hour-rain {
  font-size: 10px;
  color: var(--wx-text-4);
}
.wx-hour-rain.mid  { color: var(--wx-accent); font-weight: 600; }
.wx-hour-rain.high { color: var(--wx-bad);    font-weight: 700; }

/* ─── 일별 ─── */
.wx-daily {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--wx-line);
  border-radius: 6px;
  overflow: hidden;
}
.wx-day {
  display: grid;
  grid-template-columns: 64px 28px 1fr 50px 90px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--wx-line);
}
.wx-day:last-child { border-bottom: 0; }
.wx-day-date {
  color: var(--wx-text-2);
  font-weight: 500;
}
.wx-day-ico {
  color: var(--wx-text-2);
  display: flex;
  justify-content: center;
}
.wx-day-label {
  color: var(--wx-text-3);
  font-size: 11px;
}
.wx-day-rain {
  color: var(--wx-text-4);
  font-size: 11px;
  text-align: right;
}
.wx-day-rain.high { color: var(--wx-bad); font-weight: 700; }
.wx-day-temp {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.wx-tmin { color: var(--wx-text-3); }
.wx-tsep { color: var(--wx-text-4); margin: 0 4px; }
.wx-tmax { color: var(--wx-text-1); font-weight: 600; }

/* ─── footer ─── */
.wx-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--wx-text-4);
  padding-top: 8px;
  border-top: 1px solid var(--wx-line);
}
.wx-source { font-style: italic; }

/* ─── 좁은 너비 대응 ─── */
@media (max-width: 420px) {
  .wx-day {
    grid-template-columns: 60px 24px 1fr 44px 80px;
    font-size: 11px;
  }
  .wx-current-body { gap: 12px; }
  .wx-temp-now { font-size: 34px; }
}
