/* ═══════════════════════════════════
   A-Wealth Global Styles
   ═══════════════════════════════════ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #1e293b;
  --sidebar-text: #e2e8f0;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ─── 버튼 ─── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-google {
  display: flex; align-items: center; gap: 10px;
  background: #fff; color: #333; border: 1px solid var(--border);
  padding: 12px 24px; font-size: 16px; width: 100%; justify-content: center;
}
.btn-google:hover { background: #f8fafc; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn-logout {
  background: transparent; color: var(--sidebar-text);
  border: 1px solid rgba(255,255,255,0.2); width: 100%; margin-top: auto;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); }

/* ═══ 로그인 페이지 ═══ */
#login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.login-container {
  background: var(--card-bg); padding: 48px; border-radius: 20px;
  text-align: center; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { font-size: 64px; margin-bottom: 8px; }
.login-container h1 { font-size: 32px; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 32px; }

/* ═══ 온보딩 페이지 ═══ */
#onboarding-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--bg);
}
.onboarding-container {
  background: var(--card-bg); padding: 32px; border-radius: var(--radius);
  width: 600px; max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.onboarding-container h2 { margin-bottom: 8px; }
.onboarding-container > p { color: var(--text-muted); margin-bottom: 16px; }

/* ═══ 대시보드 레이아웃 ═══ */
#dashboard-page { display: flex; min-height: 100vh; }

/* 사이드바 */
.sidebar {
  width: 280px; background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 24px; display: flex; flex-direction: column; gap: 24px;
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto;
}
.sidebar-header .logo { font-size: 20px; font-weight: 700; }
.user-info { border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 16px; }
.user-name { font-size: 18px; font-weight: 600; }
.user-email { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 4px; }
.sidebar-metric { text-align: center; }
.metric-label { display: block; font-size: 13px; color: rgba(255,255,255,0.6); }
.metric-value { display: block; font-size: 24px; font-weight: 700; margin-top: 4px; color: #4ade80; }
.gauge-container { text-align: center; }
.gauge-label { font-size: 13px; color: rgba(255,255,255,0.6); margin-top: 8px; }

/* 메인 콘텐츠 */
.main-content {
  margin-left: 280px; padding: 32px; flex: 1; width: calc(100% - 280px);
}
.page-title { font-size: 28px; margin-bottom: 24px; }
.section-title { font-size: 20px; margin: 24px 0 16px; }

/* 카드 */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* 그리드 */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 8px; }

/* 자산 목록 */
.asset-list { display: flex; flex-direction: column; gap: 12px; }
.asset-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 8px; background: var(--bg);
}
.asset-item .emoji { font-size: 24px; }
.asset-item .info { flex: 1; }
.asset-item .info .name { font-weight: 600; }
.asset-item .info .detail { font-size: 13px; color: var(--text-muted); }
.asset-item .amount { font-weight: 700; text-align: right; }

/* 액션 카드 */
.action-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 24px;
  text-align: center; cursor: pointer; transition: all 0.2s;
  border: 1px solid var(--border);
}
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,0.15); }
.action-icon { font-size: 36px; margin-bottom: 8px; }
.action-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.action-desc { font-size: 13px; color: var(--text-muted); }

/* 광고 배너 */
.ad-banner {
  margin: 20px 0;
  text-align: center;
  min-height: 90px;
}

/* ═══ 상단 네비게이션 ═══ */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 32px; background: var(--sidebar-bg); color: var(--sidebar-text);
  position: sticky; top: 0; z-index: 100;
}
.nav-logo { font-size: 18px; font-weight: 700; color: #fff; text-decoration: none; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 14px; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: #fff; }

/* ═══ 푸터 ═══ */
.site-footer {
  background: var(--sidebar-bg); color: rgba(255,255,255,0.6);
  text-align: center; padding: 32px 24px; margin-top: 48px; font-size: 13px;
}
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,0.7); text-decoration: none; }
.footer-links a:hover { color: #fff; }
.disclaimer { margin-top: 8px; font-size: 11px; color: rgba(255,255,255,0.4); }

/* ═══ 콘텐츠 페이지 (about, guide, privacy 등) ═══ */
.content-page {
  max-width: 800px; margin: 0 auto; padding: 40px 24px;
  line-height: 1.8; color: var(--text);
}
.content-page h1 { font-size: 28px; margin-bottom: 8px; }
.content-page h2 { font-size: 22px; margin: 32px 0 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.content-page h3 { font-size: 18px; margin: 20px 0 8px; }
.content-page p { margin-bottom: 12px; }
.content-page ul { margin: 8px 0 16px 24px; }
.content-page li { margin-bottom: 6px; }
.updated { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* 히어로 섹션 */
.hero-section {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff; text-align: center; padding: 64px 24px;
}
.hero-section h1 { font-size: 48px; margin-bottom: 8px; }
.hero-subtitle { font-size: 20px; color: rgba(255,255,255,0.7); }

/* 기능 카드 그리드 */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }
.feature-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 24px;
  border: 1px solid var(--border);
}
.feature-icon { font-size: 32px; margin-bottom: 8px; }
.feature-card h3 { margin: 0 0 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); margin: 0; }

/* 가이드 테이블 */
.guide-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.guide-table th, .guide-table td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; }
.guide-table th { background: var(--bg); font-weight: 600; }

/* 문의 페이지 */
.contact-info { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }
.contact-card {
  background: var(--card-bg); padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.contact-card h3 { margin-bottom: 8px; }
.contact-card a { color: var(--primary); }
.contact-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* FAQ */
.faq-item { background: var(--card-bg); padding: 20px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--border); }
.faq-item h3 { font-size: 16px; margin-bottom: 8px; color: var(--primary); }
.faq-item p { margin: 0; font-size: 14px; }
.faq-item a { color: var(--primary); }

/* ═══ 채팅 ═══ */
.chat-card { display: flex; flex-direction: column; }
.chat-box {
  flex: 1; min-height: 300px; max-height: 400px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 0; margin-bottom: 12px;
}
.chat-msg {
  max-width: 80%; padding: 12px 16px; border-radius: 16px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end; background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start; background: var(--bg); color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.system {
  align-self: center; background: #fef3c7; color: #92400e;
  font-size: 13px; border-radius: 8px;
}
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; outline: none;
}
.chat-input-row input:focus { border-color: var(--primary); }

/* 로딩 스피너 */
.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; }
.typing-indicator span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
  animation: blink 1.4s infinite both;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:.3} 40%{opacity:1} }

/* 반응형 */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; width: 100%; }
  .grid-2col, .grid-3col { grid-template-columns: 1fr; }
  .login-container { width: 90%; padding: 32px 24px; }
  .onboarding-container { width: 95%; }
  .feature-grid { grid-template-columns: 1fr; }
  .contact-info { grid-template-columns: 1fr; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 12px; }
  .hero-section h1 { font-size: 32px; }
}
