/* ══════════════════════════════════════════════════
   CSS 변수 — 다크 모드 (기본)
══════════════════════════════════════════════════ */
:root {
  --bg:           #0f0f0f;
  --bg-card:      #1a1a1a;
  --bg-deep:      #080e1a;
  --bg-mid:       #0f172a;
  --bg-surface:   #1e293b;
  --bg-hover:     #222;
  --border:       #2a2a2a;
  --border-mid:   #1e293b;
  --border-sub:   #334155;
  --text-primary: #e0e0e0;
  --text-bright:  #f1f5f9;
  --text-sec:     #94a3b8;
  --text-muted:   #64748b;
  --text-dim:     #475569;
  --text-faint:   #334155;
  --navbar-bg:    #141414;
  --navbar-border:#222;
  --tab-active-bg:#222;
  --tab-color:    #888;
  --input-bg:     #1e293b;
  --input-border: #334155;
}

/* ══════════════════════════════════════════════════
   CSS 변수 — 라이트 모드
══════════════════════════════════════════════════ */
html[data-theme="light"] {
  --bg:           #f0f4f8;
  --bg-card:      #ffffff;
  --bg-deep:      #e8edf3;
  --bg-mid:       #f8fafc;
  --bg-surface:   #ffffff;
  --bg-hover:     #f1f5f9;
  --border:       #e2e8f0;
  --border-mid:   #e2e8f0;
  --border-sub:   #94a3b8;
  --text-primary: #1e293b;
  --text-bright:  #0f172a;
  --text-sec:     #334155;
  --text-muted:   #475569;
  --text-dim:     #64748b;
  --text-faint:   #94a3b8;
  --navbar-bg:    #1e293b;
  --navbar-border:#334155;
  --tab-active-bg:#334155;
  --tab-color:    #94a3b8;
  --input-bg:     #f8fafc;
  --input-border: #e2e8f0;
}

/* ══════════════════════════════════════════════════
   리셋
══════════════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

/* ══════════════════════════════════════════════════
   로그인
══════════════════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  width: 360px;
}
.login-container h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.subtitle {
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 0.9rem;
}
.kakao-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #FEE500;
  color: #000;
  padding: 14px 28px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.2s;
}
.kakao-btn:hover { opacity: 0.85; }

/* ══════════════════════════════════════════════════
   네비게이션
══════════════════════════════════════════════════ */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-right: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--tab-color);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover, .tab.active {
  background: var(--tab-active-bg);
  color: #fff;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 8px;
}
.welcome { color: #888; font-size: 0.85rem; white-space: nowrap; }
.logout-btn {
  color: #666;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
  white-space: nowrap;
}
.logout-btn:hover { color: #fff; }

/* 테마 토글 버튼 */
.theme-toggle {
  background: none;
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.75rem;
  color: #94a3b8;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}
.theme-toggle:hover { border-color: #64748b; color: #fff; }

/* ══════════════════════════════════════════════════
   콘텐츠
══════════════════════════════════════════════════ */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ══════════════════════════════════════════════════
   모바일
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .navbar { padding: 0 12px; height: 52px; }
  .nav-logo { font-size: 0.95rem; margin-right: 10px; }
  .tab { font-size: 0.8rem; padding: 6px 10px; }
  .welcome { display: none; }
  .logout-btn {
    font-size: 0.78rem; padding: 6px 10px;
    background: #1e293b; border-radius: 6px; color: #94a3b8;
  }
  .content { padding: 16px 14px; }
  .news-grid { grid-template-columns: 1fr; gap: 10px; }
  .news-card { padding: 14px; }
  .news-title { font-size: 0.9rem; }
  .login-container { width: 90vw; padding: 40px 24px; }
  button, .kakao-btn, .scrape-btn, .generate-btn, .send-btn, .start-btn { min-height: 44px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .briefing-body { padding: 20px 16px; font-size: 0.88rem; }
  .briefing-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .chat-wrap { height: calc(100vh - 100px); }
  .msg-bubble { font-size: 0.85rem; max-width: 95%; }
  .chat-input { font-size: 16px; }
  .mosa-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  #percent { font-size: 1.6rem !important; }
  .pagination { flex-wrap: wrap; gap: 6px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════
   탭 콘텐츠
══════════════════════════════════════════════════ */
.tab-content { display: none; }
.tab-content.active { display: block; }

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 24px;
}

/* ══════════════════════════════════════════════════
   뉴스 카드
══════════════════════════════════════════════════ */
.news-section { margin-bottom: 40px; }
.category-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s;
  display: block;
}
.news-card:hover { border-color: #444; transform: translateY(-2px); }
.news-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
  line-height: 1.4;
}
.news-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}
.news-date { font-size: 0.75rem; color: var(--text-faint); }
.no-news { color: var(--text-faint); font-size: 0.9rem; }
