/* ===================================================
   ชีวิตดี — Design System & Global Styles
   =================================================== */

/* Fonts (Sarabun, Noto Sans Thai) are loaded by <link> in each page's <head> */

/* ===== CSS Variables ===== */
:root {
  /* Brand Colors */
  --primary: #7C3AED;
  --primary-light: #A78BFA;
  --primary-dark: #5B21B6;
  --secondary: #EC4899;
  --secondary-light: #F472B6;
  --accent-gold: #F59E0B;
  --accent-green: #10B981;
  --accent-blue: #3B82F6;
  --accent-orange: #F97316;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
  --grad-money: linear-gradient(135deg, #10B981 0%, #3B82F6 100%);
  --grad-health: linear-gradient(135deg, #F97316 0%, #EC4899 100%);
  --grad-habit: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
  --grad-dashboard: linear-gradient(135deg, #F59E0B 0%, #EC4899 100%);
  --grad-dark: linear-gradient(135deg, #0F0720 0%, #1A0533 50%, #0D1117 100%);

  /* Dark Theme Colors */
  --bg-base: #080B14;
  --bg-surface: #0F1422;
  --bg-elevated: #161D2F;
  --bg-card: #1C2540;
  --bg-card-hover: #222D4A;
  --bg-input: #1A2035;

  /* Text */
  --text-primary: #F0F4FF;
  --text-secondary: #A0AECF;
  --text-muted: #6B7A9B;
  --text-placeholder: #4A5568;

  /* Border */
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(124, 58, 237, 0.4);
  --border-focus: rgba(124, 58, 237, 0.8);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.3);
  --shadow-glow-strong: 0 0 60px rgba(124, 58, 237, 0.5);

  /* Typography */
  --font-thai: 'Sarabun', 'Noto Sans Thai', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;
  --font-size-6xl: 3.75rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-thai);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--grad-primary);
  color: white;
  font-family: var(--font-thai);
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn-primary:hover::before {
  background: rgba(255,255,255,0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  color: var(--primary-light);
  font-family: var(--font-thai);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 2px solid rgba(124, 58, 237, 0.5);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
  transform: translateY(-2px);
}

.btn-sm {
  padding: var(--space-2) var(--space-5);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-base);
}

.btn-glow {
  box-shadow: var(--shadow-glow);
}

.btn-glow:hover {
  box-shadow: var(--shadow-glow-strong);
}

.btn-emoji {
  font-size: 1.2em;
}

/* ===== Gradient Text ===== */
.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Navigation ===== */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-4) 0;
  transition: all var(--transition);
}

.nav-bar.scrolled {
  background: rgba(8, 11, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xl);
  font-weight: 800;
}

.logo-icon {
  font-size: 1.5em;
  filter: drop-shadow(0 0 10px rgba(236, 72, 153, 0.5));
}

.logo-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
}

/* ===== Hero Section ===== */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 100px;
  padding-bottom: var(--space-20);
  position: relative;
  overflow: hidden;
}

.hero-bg-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--primary);
  top: -200px;
  left: -200px;
  animation: orbFloat1 8s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: var(--secondary);
  top: 200px;
  right: -100px;
  animation: orbFloat2 10s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: var(--accent-gold);
  bottom: -100px;
  left: 40%;
  animation: orbFloat3 12s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 40px) scale(1.1); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 30px) scale(0.9); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -20px) scale(1.2); }
}

.hero-section .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--primary-light);
  width: fit-content;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.8); }
}

.hero-title {
  font-size: var(--font-size-5xl);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  line-height: 1.8;
}

.hero-subtitle strong {
  color: var(--text-primary);
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.hero-cta-note {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-top: var(--space-4);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-number {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ===== App Preview (Phone Mockup) ===== */
.hero-preview {
  display: flex;
  justify-content: center;
  align-items: center;
}

.preview-phone {
  position: relative;
  animation: phoneFloat 4s ease-in-out infinite;
}

@keyframes phoneFloat {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-20px) rotate(-3deg); }
}

.phone-frame {
  width: 300px;
  height: 600px;
  background: linear-gradient(145deg, #1C2540, #0F1422);
  border-radius: 40px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  padding: 12px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05),
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(124, 58, 237, 0.2);
  position: relative;
  overflow: hidden;
}

.phone-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 30px;
  background: #0F1422;
  border-radius: 0 0 20px 20px;
  z-index: 10;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 30px;
  background: var(--bg-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 40px 14px 14px;
}

.app-mini-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-greeting {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.mini-date {
  font-size: 11px;
  color: var(--text-muted);
}

.mini-score-card {
  background: var(--grad-primary);
  border-radius: 16px;
  padding: 14px;
}

.mini-score-label {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 4px;
}

.mini-score-value {
  font-size: 28px;
  font-weight: 800;
  color: white;
  line-height: 1;
  margin-bottom: 8px;
}

.mini-score-bar {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
}

.mini-score-fill {
  height: 100%;
  background: white;
  border-radius: 3px;
  animation: fillBar 2s ease-out;
}

@keyframes fillBar {
  from { width: 0%; }
}

.mini-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-card {
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-card.money {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.mini-card.health {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.mini-card-icon { font-size: 16px; }
.mini-card-label { font-size: 9px; color: var(--text-muted); }
.mini-card-value { font-size: 12px; font-weight: 700; color: var(--text-primary); }

.mini-habits {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-habit {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
}

.mini-habit.done {
  color: var(--accent-green);
}

/* ===== Section Headers ===== */
.section-header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.section-badge {
  display: inline-block;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: var(--space-4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-title {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* ===== Features Section ===== */
.features-section {
  padding: var(--space-24) 0;
  position: relative;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.feature-money::before { background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), transparent); }
.feature-health::before { background: linear-gradient(135deg, rgba(249, 115, 22, 0.05), transparent); }
.feature-habit::before { background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), transparent); }
.feature-dashboard::before { background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), transparent); }

.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.feature-money .feature-icon-wrap { background: rgba(16, 185, 129, 0.15); }
.feature-health .feature-icon-wrap { background: rgba(249, 115, 22, 0.15); }
.feature-habit .feature-icon-wrap { background: rgba(124, 58, 237, 0.15); }
.feature-dashboard .feature-icon-wrap { background: rgba(245, 158, 11, 0.15); }

.feature-icon {
  font-size: 2rem;
}

.feature-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.feature-desc {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feature-list li {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  padding-left: var(--space-4);
  position: relative;
}

.feature-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary-light);
}

/* ===== Pricing Section ===== */
.pricing-section {
  padding: var(--space-24) 0;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  max-width: 800px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  transition: all var(--transition);
  position: relative;
}

.pricing-recommended {
  border-color: var(--primary);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.2);
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.08), var(--bg-card));
}

.pricing-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--grad-primary);
  color: white;
  font-size: var(--font-size-sm);
  font-weight: 700;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.pricing-header {
  margin-bottom: var(--space-6);
}

.plan-name {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
}

.price-amount {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.price-period {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.plan-subtitle {
  font-size: var(--font-size-xs);
  color: var(--accent-green);
  font-weight: 500;
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.plan-features li {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.feature-included {
  color: var(--text-secondary);
}

.feature-excluded {
  color: var(--text-muted);
  opacity: 0.5;
}

/* ===== CTA Section ===== */
.cta-section {
  padding: var(--space-20) 0;
}

.cta-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-2xl);
  padding: var(--space-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cta-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.2;
}

.cta-orb-1 {
  width: 300px;
  height: 300px;
  background: var(--primary);
  top: -100px;
  left: -100px;
}

.cta-orb-2 {
  width: 200px;
  height: 200px;
  background: var(--secondary);
  bottom: -50px;
  right: -50px;
}

.cta-title {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.cta-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  position: relative;
  z-index: 1;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-12) 0 var(--space-8);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-8);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xl);
  font-weight: 800;
}

.footer-tagline {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-links {
  display: flex;
  gap: var(--space-16);
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col h4 {
  font-weight: 700;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col a {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  text-align: center;
}

.footer-bottom p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ===== App Layout (Dashboard) ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xl);
  font-weight: 800;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--font-size-base);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.nav-item-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-profile:hover {
  background: var(--bg-elevated);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-plan {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-content {
  flex: 1;
  padding: var(--space-8);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card-money::after { background: var(--grad-money); }
.stat-card-health::after { background: var(--grad-health); }
.stat-card-habit::after { background: var(--grad-habit); }
.stat-card-score::after { background: var(--grad-primary); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-3);
}

.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-bottom: var(--space-1);
  line-height: 1;
}

.stat-card-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.stat-card-change {
  font-size: var(--font-size-xs);
  margin-top: var(--space-1);
}

.change-positive { color: var(--accent-green); }
.change-negative { color: #EF4444; }

/* ===== Grid Layouts ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

/* ===== Life Score ===== */
.life-score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.score-ring {
  width: 180px;
  height: 180px;
  position: relative;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 12;
}

.score-ring-progress {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease;
}

.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ===== Progress Bars ===== */
.progress-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.progress-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.progress-value {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

/* ===== Habit Tracker UI ===== */
.habit-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.habit-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.habit-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.habit-item.completed {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.habit-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.habit-item.completed .habit-check {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: white;
}

.habit-info {
  flex: 1;
}

.habit-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.habit-streak {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.habit-streak-fire {
  color: var(--accent-orange);
}

.habit-emoji {
  font-size: 1.25rem;
}

/* ===== Transaction List ===== */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.transaction-item:hover {
  background: var(--bg-elevated);
}

.transaction-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.transaction-info {
  flex: 1;
}

.transaction-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.transaction-date {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.transaction-amount {
  font-weight: 700;
  font-size: var(--font-size-base);
}

.amount-income { color: var(--accent-green); }
.amount-expense { color: #EF4444; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 480px;
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ===== Form Controls ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-thai);
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-input::placeholder {
  color: var(--text-placeholder);
}

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-thai);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7A9B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
}

.form-select:focus {
  border-color: var(--primary);
}

.btn-row {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.btn-row .btn-primary,
.btn-row .btn-outline {
  flex: 1;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
}

/* ===== Category Chips ===== */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.chip:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
}

.chip.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ===== Amount Input Big ===== */
.amount-input-big {
  font-size: 2.5rem;
  font-weight: 800;
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 100%;
  text-align: center;
  outline: none;
}

.amount-input-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-input);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.amount-currency {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-muted);
}

/* ===== Toggle ===== */
.toggle-group {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-thai);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.toggle-btn.income.active { color: var(--accent-green); }
.toggle-btn.expense.active { color: #EF4444; }

/* ===== Bar Chart ===== */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 120px;
  padding: var(--space-3) 0;
}

.bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 4px;
  transition: height 0.8s ease;
  position: relative;
}

.bar::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.bar:hover::after {
  opacity: 1;
}

.bar-label {
  font-size: 9px;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hero-section .container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-preview {
    display: none;
  }

  .hero-title {
    font-size: var(--font-size-4xl);
  }

  .hero-stats {
    justify-content: center;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: var(--space-4);
  }

  .section-title {
    font-size: var(--font-size-3xl);
  }
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  animation: toastIn 0.3s ease;
}

.toast.success { border-color: rgba(16, 185, 129, 0.3); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon { font-size: 1.25rem; }
.toast-text { font-size: var(--font-size-sm); font-weight: 500; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-card);
}

/* ===== Loading Animation ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: var(--space-12);
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.empty-desc {
  font-size: var(--font-size-sm);
  line-height: 1.7;
}
