/* EUNACLASS(duon.ai.kr) 디자인 토큰 — css/common.css의 라이트 모드와 같은 값.
   날씨 앱은 배경 영상이 화면을 채우므로 라이트 한 가지로 고정한다 (다크 모드 없음). */
:root {
  /* 브랜드 원본 토큰 (라이트) */
  --color-bg: #faf8f4;
  --color-surface: #ffffff;
  --color-surface-hover: #f3efe8;
  --color-surface-dim: #efeae1;
  --color-text: #1c1b1a;
  --color-text-muted: #55524c;
  --color-primary: #7c4dff;
  --color-primary-dim: #6234cc;
  --color-on-primary: #ffffff;
  --color-tertiary: #0d9488;
  --color-tertiary-dim: #0f766e;
  --color-border: #dcd7cc;
  --color-outline: #6b6760;

  /* 날씨 앱 내부에서 쓰는 이름 (위 브랜드 토큰에 연결) */
  --background: var(--color-bg);
  --foreground: var(--color-text);
  --card: var(--color-surface);
  --card-foreground: var(--color-text);
  --muted: var(--color-surface-hover);
  --muted-foreground: var(--color-text-muted);
  --border: var(--color-border);
  --input: var(--color-border);
  --primary: var(--color-primary);
  --primary-foreground: var(--color-on-primary);
  --accent: var(--color-surface-hover);
  --ring: var(--color-primary);
  --info: var(--color-tertiary);
  --radius: 0.75rem;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);

  /* EUNACLASS와 동일한 글꼴 체계 */
  --font-headline: 'Space Grotesk', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Manrope', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-label: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}


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

[hidden] { display: none !important; }

/* ---------- 날씨 배경 영상 ---------- */
.bg-video {
  position: fixed; inset: 0; z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* 영상이 잘 보이도록 옅게. 글자는 카드 배경 위에 있어 가독성은 유지된다 */
.bg-scrim {
  position: fixed; inset: 0; z-index: -1;
  background: rgb(250 248 244 / 0.38);
}
/* 움직임 최소화 설정 사용자는 영상 대신 기존 배경색 */
@media (prefers-reduced-motion: reduce) {
  .bg-video, .bg-scrim { display: none; }
}

/* 영상 배경 위에서 카드가 살짝 비치는 유리 느낌 */
@supports (backdrop-filter: blur(8px)) {
  body.has-video .card:not(.current-card) {
    background: color-mix(in srgb, var(--card) 86%, transparent);
    backdrop-filter: blur(10px);
  }
}

body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  word-break: keep-all; /* 한글 낱말이 중간에서 꺾이지 않게 */
  -webkit-font-smoothing: antialiased;
}

/* EUNACLASS(duon.ai.kr)와 동일한 본문 폭·여백: 960px + 좌우 1.5rem */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
}

@media (max-width: 640px) {
  .container { padding: 1.25rem 1rem 2rem; }
}

/* 아이콘 규격을 메인 사이트 icons.js와 통일 (24×24, currentColor, 굵기 1.75) */
svg.lucide {
  width: 1.1em; height: 1.1em; vertical-align: -0.15em;
  stroke-width: 1.75;
}

/* ---------- 헤더 ---------- */
.header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.brand { display: flex; align-items: center; gap: 0.5rem; }
.brand h1 { font-family: var(--font-headline); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.brand-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary); color: var(--primary-foreground);
}
.brand-icon svg { width: 1.25rem; height: 1.25rem; }

.search { position: relative; flex: 1 1 240px; max-width: 420px; }
.search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  width: 1rem; height: 1rem; color: var(--muted-foreground); pointer-events: none;
}
.search input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem 0 2.25rem;
  font: inherit; font-size: 0.9rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--muted-foreground); }
.search input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px hsl(240 5.9% 10% / 0.1); }

.search-results {
  position: absolute; top: calc(100% + 0.375rem); left: 0; right: 0; z-index: 20;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  overflow: hidden;
}
.search-results li {
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; gap: 0.5rem;
}
.search-results li svg { width: 0.9rem; height: 0.9rem; color: var(--muted-foreground); flex: none; }
.search-results li:hover, .search-results li.focused { background: var(--accent); }
.search-results li .sub { color: var(--muted-foreground); font-size: 0.8rem; }
.search-results li.empty { color: var(--muted-foreground); cursor: default; }

.unit-toggle {
  display: inline-flex;
  padding: 0.2rem;
  background: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  margin-left: auto;
}
.unit-btn {
  border: 0; background: transparent;
  font: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--muted-foreground);
  padding: 0.3rem 0.8rem;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.unit-btn.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow); }

/* ---------- 즐겨찾기 ---------- */
.fav-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 1rem;
}
.fav-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font: inherit; font-size: 0.85rem; font-weight: 500;
  color: var(--foreground);
  background: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.fav-chip svg { width: 0.85rem; height: 0.85rem; color: var(--muted-foreground); }
.fav-chip:hover { background: var(--accent); border-color: var(--border); }
.fav-chip.active { background: var(--primary); color: var(--primary-foreground); }
.fav-chip.active svg { color: inherit; }

.fav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.15rem; margin-left: 0.15rem;
  border-radius: 50%;
  transition: color 0.15s;
}
.fav-btn svg { width: 1.05rem; height: 1.05rem; }
.fav-btn:hover { color: #fff; }
.fav-btn.active { color: #ffd166; }
.fav-btn.active svg { fill: currentColor; }

/* ---------- 상태 표시 ---------- */
.status {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.95rem;
}
.retry-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.5rem 1.4rem;
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--primary-foreground);
  background: var(--primary);
  border: 0; border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.15s;
}
.retry-btn:hover { background: var(--color-primary-dim); }

/* ---------- 그리드 배치 ---------- */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.grid > * { min-width: 0; }

@media (min-width: 960px) {
  .grid {
    grid-template-columns: 340px 1fr;
    grid-template-rows: auto 1fr;
  }
  .current-card { grid-row: 1 / 3; }
}

/* ---------- 카드 공통 ---------- */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.card-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  margin-bottom: 1rem;
}
.card-header h2 {
  font-family: var(--font-headline);
  font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.45rem;
}
.card-header h2 svg { width: 1rem; height: 1rem; color: var(--muted-foreground); }
.card-sub { font-family: var(--font-label); font-size: 0.8rem; color: var(--muted-foreground); white-space: nowrap; }

/* ---------- 현재 날씨 ---------- */
/* 날씨에 따라 카드 배경색이 바뀐다 (JS가 theme-* 클래스를 붙임) */
.current-card {
  display: flex; flex-direction: column;
  --g1: #4f8ef7; --g2: #2563eb;
  background: linear-gradient(165deg, var(--g1), var(--g2));
  border-color: transparent;
  color: #fff;
}
/* 날씨 구분은 유지하되 브랜드 퍼플(#7c4dff)·딥네이비(#040a2f)로 색조를 맞췄다 */
.current-card.theme-clear        { --g1: #5b8dff; --g2: #7c4dff; }
.current-card.theme-clear-night  { --g1: #1e2a63; --g2: #040a2f; }
.current-card.theme-partly       { --g1: #6f9bf0; --g2: #8a6bf5; }
.current-card.theme-partly-night { --g1: #24306b; --g2: #0a1038; }
.current-card.theme-cloudy       { --g1: #7b7f9c; --g2: #4d5170; }
.current-card.theme-rain         { --g1: #5573ad; --g2: #364a86; }
.current-card.theme-snow         { --g1: #8fb0e3; --g2: #6d7fd0; }
.current-card.theme-thunder      { --g1: #6234cc; --g2: #2b0065; }

.current-card .card-header h2 svg,
.current-card .card-sub { color: rgba(255, 255, 255, 0.75); }
.current-card .current-icon svg { color: #fff; }
.current-card .current-cond { color: rgba(255, 255, 255, 0.85); }
.current-compare {
  display: block; margin-top: 0.35rem;
  font-size: 0.85rem; color: rgba(255, 255, 255, 0.7);
}
.current-card .stat { background: rgba(255, 255, 255, 0.14); }
.current-card .stat > svg,
.current-card .stat-label { color: rgba(255, 255, 255, 0.75); }
.current-card .sun-row {
  border-top-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.75);
}
.current-card .sun-row b { color: #fff; }
.current-main {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.75rem 0 1.5rem;
  flex: 1;
}
.current-icon svg { width: 5rem; height: 5rem; stroke-width: 1.75; color: #fff; }
.current-temp { font-family: var(--font-headline); font-size: 3.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.current-cond { display: block; margin-top: 0.4rem; color: var(--muted-foreground); font-size: 1rem; }

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
}
.stat {
  display: flex; align-items: center; gap: 0.65rem;
  background: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.7rem 0.85rem;
}
.stat > svg { width: 1.2rem; height: 1.2rem; color: var(--muted-foreground); flex: none; }
.stat-label { display: block; font-family: var(--font-label); font-size: 0.75rem; color: var(--muted-foreground); }
.stat-value { display: block; font-size: 0.95rem; font-weight: 600; }

.sun-row {
  display: flex; justify-content: space-between; gap: 0.5rem;
  margin-top: 0.9rem; padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--muted-foreground);
}
.sun-row span { display: flex; align-items: center; gap: 0.4rem; }
.sun-row b { color: var(--foreground); font-weight: 600; }
.sun-row svg { width: 1rem; height: 1rem; }

/* ---------- 시간별 예보 ---------- */
.hourly-scroll {
  display: flex; gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
}
.hour-item {
  flex: none;
  width: 4.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.75rem 0.25rem;
  background: var(--muted);
  border-radius: calc(var(--radius) - 2px);
}
.hour-item.now { background: var(--primary); color: var(--primary-foreground); }
.hour-item.now .hour-time, .hour-item.now .hour-rain { color: inherit; opacity: 0.8; }
.hour-time { font-family: var(--font-label); font-size: 0.75rem; color: var(--muted-foreground); }
.hour-item svg { width: 1.4rem; height: 1.4rem; stroke-width: 1.75; }
.hour-temp { font-size: 0.9rem; font-weight: 600; }
.hour-rain {
  font-size: 0.72rem; color: var(--info);
  display: flex; align-items: center; gap: 0.15rem;
  min-height: 1em;
}
.hour-rain svg { width: 0.7rem; height: 0.7rem; }

/* ---------- 주간 예보 ---------- */
.daily-list { display: flex; flex-direction: column; }
.day-row {
  display: grid;
  grid-template-columns: 3.2rem 1.6rem minmax(4rem, 8rem) 3.4rem 2.6rem 1fr 2.6rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.day-row:last-child { border-bottom: 0; }
.day-name { font-weight: 600; }
.day-name.today { color: var(--info); }
.day-row > svg { width: 1.3rem; height: 1.3rem; stroke-width: 1.75; }
.day-cond { color: var(--muted-foreground); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-rain {
  font-size: 0.8rem; color: var(--info);
  display: flex; align-items: center; gap: 0.2rem; justify-content: flex-end;
}
.day-rain svg { width: 0.8rem; height: 0.8rem; }
.day-min { text-align: right; color: var(--muted-foreground); }
.day-max { text-align: right; font-weight: 600; }
.temp-bar {
  position: relative; height: 0.3rem;
  background: var(--muted);
  border-radius: 999px;
  overflow: hidden;
}
.temp-bar-fill {
  position: absolute; top: 0; bottom: 0;
  background: linear-gradient(90deg, hsl(200 90% 60%), hsl(35 95% 58%));
  border-radius: 999px;
}

/* ---------- 날씨 챗봇 (플로팅) ---------- */
/* 메인 사이트 FAB(우측 2rem, 44px×3개)와 나란히 놓이도록 왼쪽으로 비켜 세운다 */
.chat-fab {
  position: fixed; right: 2rem; bottom: 2rem; z-index: 91;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: var(--color-primary); color: var(--color-on-primary);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.2);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(124 77 255 / 0.35); }
.chat-fab svg { width: 1.25rem; height: 1.25rem; }
.chat-fab.open { display: none; }

@media (max-width: 520px) {
  .chat-fab { right: 1rem; bottom: 1.25rem; }
}

.chat-panel {
  position: fixed; right: 2rem; bottom: calc(2rem + 44px + 0.75rem); z-index: 95;
  width: 370px; max-width: calc(100vw - 2rem);
  height: 500px; max-height: calc(100vh - 8rem);
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
  overflow: hidden;
}
.chat-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--color-primary); color: var(--color-on-primary);
}
.chat-panel-head h2 {
  font-family: var(--font-headline);
  font-size: 0.95rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.45rem;
}
.chat-panel-head h2 svg { width: 1rem; height: 1rem; }
.chat-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.8rem; height: 1.8rem;
  border: 0; border-radius: 50%;
  background: transparent; color: inherit;
  cursor: pointer; opacity: 0.85;
}
.chat-close:hover { opacity: 1; background: rgb(255 255 255 / 0.15); }
.chat-close svg { width: 1.05rem; height: 1.05rem; }

.chat-messages {
  flex: 1;
  display: flex; flex-direction: column; gap: 0.5rem;
  overflow-y: auto;
  padding: 1rem;
  scrollbar-width: thin;
}
.chat-msg {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.bot {
  align-self: flex-start;
  background: var(--muted);
  color: var(--foreground);
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--primary-foreground);
  border-bottom-right-radius: 4px;
}
.chat-msg.typing { color: var(--muted-foreground); font-style: normal; }
.chat-msg.error { color: var(--muted-foreground); }

.chat-form {
  display: flex; gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  height: 2.6rem;
  padding: 0 0.9rem;
  font: inherit; font-size: 0.9rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  outline: none;
  transition: border-color 0.15s;
}
.chat-form input:focus { border-color: var(--ring); }
.chat-form button {
  width: 2.6rem; height: 2.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: calc(var(--radius) - 2px);
  background: var(--primary); color: var(--primary-foreground);
  cursor: pointer;
  transition: opacity 0.15s;
}
.chat-form button:disabled { opacity: 0.5; cursor: default; }
.chat-form button svg { width: 1.1rem; height: 1.1rem; }

/* ---------- 푸터 ---------- */
.footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}
.footer a { color: inherit; }

/* ---------- 모바일 조정 ---------- */
@media (max-width: 520px) {
  .brand h1 { display: none; }
  .header { gap: 0.5rem; }
  .search { flex: 1 1 140px; }   /* 아이콘·검색·단위 전환이 한 줄에 들어가게 */
  .current-temp { font-size: 3rem; }
  .current-icon svg { width: 4rem; height: 4rem; }
  .day-row { grid-template-columns: 3rem 1.5rem 1fr 3.2rem 2.4rem 2.4rem; }
  .temp-bar { display: none; }
  .chat-panel {
    right: 1rem;
    bottom: calc(1.25rem + 44px + 0.5rem);
    max-height: calc(100vh - 7rem);
  }
}
