/* ===========================
   LUXURY LIGHT SAGE THEME
   =========================== */

/* 1. TYPOGRAPHY & COLOR VARIABLES */
:root {
  --bg-primary: #cce0d0; /* Deeper sage green for more body */
  --bg-secondary: #eef4ed; /* Creamy white/green */
  --bg-card: rgba(255, 255, 255, 0.98);
  --bg-card-hover: #ffffff;
  
  --gold: #b87a1f; /* Richer bronze-gold for better contrast */
  --gold-light: #d69e3a;
  --gold-glow: rgba(184, 122, 31, 0.15);
  --gold-glow-hover: rgba(184, 122, 31, 0.3);
  --gold-gradient: linear-gradient(135deg, #c8900a 0%, #e6a72e 40%, #d4960f 60%, #c8900a 100%);
  
  --text-primary: #0f172a; /* Deepest blue-black */
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --green: #047857; /* Deep emerald */
  --red: #e11d48; /* Vibrant crimson red */
  --blue: #2563eb;

  --border-glass: rgba(0, 0, 0, 0.05);
  
  --shadow-base: 0 4px 20px rgba(0,0,0,0.04);
  --shadow-elevation: inset 0 1px 0 rgba(255,255,255,1), 0 8px 30px rgba(0,0,0,0.06);
  --shadow-elevation-hover: inset 0 1px 0 rgba(255,255,255,1), 0 16px 40px rgba(0,0,0,0.1);
  
  /* Cursors */
  cursor: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="6" stroke="%23b28a50" stroke-width="1.5"/></svg>') 12 12, auto;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', 'Be Vietnam Pro', sans-serif;
  line-height: 1.7;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

h1, h2, h3, .hero-title, .modal-title, .section-header h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Micro-details */
::selection {
  background: rgba(178, 138, 80, 0.3);
  color: var(--text-primary);
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}

a, button, .btn {
  cursor: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="6" stroke="%23b28a50" stroke-width="1.5" fill="rgba(178,138,80,0.2)"/></svg>') 12 12, pointer !important;
}

/* BUTTON ACCENTS (Nét chấm phá) */
.btn-primary {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%) !important;
  box-shadow: 0 4px 15px rgba(4, 120, 87, 0.3) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%) !important;
  box-shadow: 0 6px 20px rgba(4, 120, 87, 0.4) !important;
  transform: translateY(-2px);
}

.nav-cta {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.3) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  padding: 10px 24px !important;
  border-radius: 30px !important;
}
.nav-cta:hover {
  background: linear-gradient(135deg, #be123c 0%, #9f1239 100%) !important;
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4) !important;
}

/* Base Elevation Card */
.elevation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-elevation);
  border-radius: 16px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.elevation-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-elevation-hover);
}

.section-divider {
  text-align: center;
  margin-bottom: 40px;
  opacity: 0.4;
}
.section-divider::after {
  content: "❧";
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--gold);
}


/* 2. HERO SECTION */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding-top: 80px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, #c4d8c6 50%, #a3c2a6 100%);
}
.hero-bg .line-art {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 100px 100px;
  opacity: 0.5;
  mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 80%);
}

.hero-title {
  font-size: clamp(2.8rem, 8vw, 5.5rem) !important;
  color: #c8900a !important;
  -webkit-text-fill-color: #c8900a !important;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  animation: fadeInUp 0.6s ease 0.1s both !important;
  word-break: keep-all;
  overflow-wrap: normal;
}

.hero-image {
  margin: 0 auto 3rem auto;
  max-width: 320px;
  position: relative;
  border-radius: 50%; /* Make it perfectly circular */
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0,0,0,0.15), 0 0 0 6px var(--bg-card); /* Thick ring around avatar */
}
.hero-cover-img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-slogan {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 4rem;
}
.slogan-line {
  opacity: 0;
  animation: fadeInUp 1s ease forwards;
}
.slogan-line:nth-child(1) { animation-delay: 0.2s; }
.slogan-line:nth-child(2) { animation-delay: 0.4s; }
.slogan-line:nth-child(3) { animation-delay: 0.6s; }
.slogan-line span {
  color: var(--gold);
  margin-right: 8px;
}

/* Countdown Typographic */
.countdown-wrapper {
  margin: 0 auto 3rem;
  max-width: 800px;
}
.countdown-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: 1rem;
}
.countdown-timer {
  display: flex;
  justify-content: center;
  gap: 2rem;
}
.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}
.countdown-number {
  font-family: 'Playfair Display', serif;
  font-size: clamp(4rem, 10vw, 8rem);
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.05em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.countdown-text {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.countdown-info {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.gold-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 6px;
  vertical-align: middle;
}

/* 3. LEADERBOARD BIA ĐÁ */
.leaderboard-top {
  display: flex;
  justify-content: center;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 40px;
}
.lb-top-card {
  flex: 1;
  max-width: 250px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-elevation);
  border-radius: 24px 24px 8px 8px;
  padding: 32px 24px;
  text-align: center;
  position: relative;
  transition: transform 0.3s;
}
.lb-top-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevation-hover);
}
.lb-top-card.rank-1 { min-height: 280px; }
.lb-top-card.rank-2 { min-height: 240px; }
.lb-top-card.rank-3 { min-height: 220px; }

.lb-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 16px;
  background: var(--bg-secondary);
}
.lb-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.lb-points {
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.streak-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin: 0 2px;
}

.leaderboard-list {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lb-list-item {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.lb-list-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(197, 151, 91, 0.08);
  z-index: 0;
}
.lb-list-content {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  align-items: center;
}
.lb-rank { width: 40px; color: var(--text-muted); font-family: 'Playfair Display', serif; font-size: 1.2rem;}
.lb-list-content .lb-name { flex: 1; font-family: 'Inter', sans-serif; font-size: 1rem; margin:0;}
.lb-list-content .lb-points { font-weight: 600; color: var(--text-secondary); }


/* 4. FUND DASHBOARD */
.fund-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 768px) {
  .fund-dashboard { grid-template-columns: 1fr; }
}
.fund-visuals {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.fund-sparkline-card, .fund-donut-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-elevation);
  border-radius: 16px;
  padding: 32px;
}
.fund-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.fund-balance-amount {
  font-size: 2.5rem;
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  margin-bottom: 24px;
}
.sparkline-wrapper {
  height: 40px;
  width: 100%;
  position: relative;
  border-bottom: 1px solid var(--border-glass);
}
.sparkline {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  /* Fake sparkline */
  clip-path: polygon(0 100%, 20% 80%, 40% 90%, 60% 40%, 80% 50%, 100% 0, 100% 100%);
  background: linear-gradient(180deg, rgba(197,151,91,0.5) 0%, transparent 100%);
  height: 100%;
}
.sparkline::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--gold);
  clip-path: polygon(0 100%, 20% 80%, 40% 90%, 60% 40%, 80% 50%, 100% 0, 100% 2px, 80% 52px, 60% 42px, 40% 92px, 20% 82px, 0 102%);
}
.sparkline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.donut-chart-container {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-top: 16px;
}
.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0% 70%, var(--red) 70% 100%);
  position: relative;
}
.donut-chart::after {
  content: '';
  position: absolute;
  inset: 15px;
  background: var(--bg-card);
  border-radius: 50%;
}
.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.legend-dot {
  width: 12px; height: 12px; border-radius: 50%; margin-right: 8px;
}
.legend-dot.income { background: var(--green); }
.legend-dot.expense { background: var(--red); }

.fund-timeline {
  display: flex;
  flex-direction: column;
}
.fund-timeline-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-glass);
}
.fund-timeline-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  margin-right: 16px;
  font-size: 14px;
}
.fund-timeline-icon.income { color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.fund-timeline-icon.expense { color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.fund-timeline-content {
  flex: 1;
}
.fund-timeline-desc { font-weight: 500; }
.fund-timeline-date { font-size: 0.8rem; color: var(--text-muted); }
.fund-timeline-amount {
  font-weight: 600;
  font-family: 'Playfair Display', serif;
}
.fund-timeline-amount.positive { color: var(--green); }
.fund-timeline-amount.negative { color: var(--text-primary); }


/* 4. LEADERBOARD ENHANCEMENTS (Nổi bật Đại Sảnh) */
.lb-top-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
}
.lb-top-card.rank-1 {
  background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
  border: 2px solid var(--gold);
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 15px 35px rgba(184, 122, 31, 0.15);
  position: relative;
  z-index: 2;
}
.lb-top-card.rank-2, .lb-top-card.rank-3 {
  background: #ffffff;
  border: 1px solid rgba(184, 122, 31, 0.3);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}
.lb-top-card .lb-avatar {
  border: 3px solid var(--gold-light);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}
.lb-top-card.rank-1 .lb-avatar {
  background: var(--gold-gradient);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 5px 15px rgba(184, 122, 31, 0.3);
}

/* 5. LIBRARY SPINE VIEW */
.library-controls {
  text-align: center;
  margin-bottom: 32px;
}
/* 6. THƯ VIỆN SPINE VIEW */
.library-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 20px;
  background: #fdfdfc;
  border-bottom: 8px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: inset 0 10px 20px rgba(0,0,0,0.02);
  min-height: 320px;
  align-items: flex-end;
}
.shelf-month-marker {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 24px;
  margin-bottom: 8px;
}
.shelf-divider {
  width: 100%;
  height: 1px;
  background: var(--border-glass);
  margin: 16px 0;
}
.book-spine-group {
  position: relative;
}
.book-spine {
  height: 280px;
  border-radius: 4px 2px 2px 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -2px 0 5px rgba(0,0,0,0.15), inset 2px 0 2px rgba(255,255,255,0.2);
}
.book-spine:hover {
  transform: translateY(-12px) rotate(2deg);
  z-index: 10;
  box-shadow: -5px 10px 20px rgba(0,0,0,0.2), inset 2px 0 2px rgba(255,255,255,0.3);
}
.spine-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center; /* Centers horizontally across spine width */
  justify-content: flex-start; /* Starts at the "top" of the rotated container */
  padding-top: 20px; /* Becomes padding from the bottom after 180deg rotation */
  writing-mode: vertical-rl; /* Text runs vertically */
  transform: rotate(180deg); /* Flip it so it runs bottom-to-top */
  gap: 12px;
  color: rgba(255,255,255,0.95);
  box-sizing: border-box;
}
.spine-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.spine-author {
  font-size: 0.7rem;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.book-spine-tooltip {
  position: absolute;
  bottom: calc(100% + 15px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 16px;
  border-radius: 8px;
  width: 250px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  box-shadow: var(--shadow-elevation);
  z-index: 20;
}
.book-spine:hover + .book-spine-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Grid View Fallback */
.grid-view {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  background: none;
  border: none;
  padding: 0;
}
.grid-view .book-spine-group { display: none; } /* Would need JS change to render both, but spine view is priority */

/* 6. REVIEWS MASONRY */
.review-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 32px;
  margin-bottom: 40px;
}
.review-quote-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 40px 32px;
  border-radius: 24px;
  position: relative;
  box-shadow: var(--shadow-elevation);
}
.quote-mark {
  position: absolute;
  top: 20px;
  left: 20px;
  font-family: 'Playfair Display', serif;
  font-size: 80px;
  line-height: 1;
  color: var(--gold);
  opacity: 0.2;
}
.review-quote-card .review-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.review-divider {
  width: 40px;
  height: 2px;
  background: var(--gold);
  margin-bottom: 24px;
}
.review-author {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.review-author cite {
  color: var(--gold);
  font-style: italic;
}

/* Modal updates */
.modal-card {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-glass);
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
}
textarea, input[type="text"], select {
  background: inset 0 2px 4px rgba(0,0,0,0.5);
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-glass) !important;
}
::placeholder {
  font-style: italic;
  color: var(--text-muted);
}

/* 7. NAVBAR OVERRIDES */
.navbar {
  background: rgba(243, 247, 241, 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass) !important;
}
.navbar.scrolled {
  box-shadow: var(--shadow-base);
}
.nav-logo span {
  color: var(--text-primary);
  font-family: 'Playfair Display', serif;
}
.nav-links a {
  color: var(--text-secondary);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--gold);
}
.nav-links a::after {
  background-color: var(--gold);
}
.nav-toggle span {
  background-color: var(--text-primary);
}

/* Nav logo force gold for luxury feel */
.nav-logo span {
  color: var(--gold) !important;
  -webkit-text-fill-color: var(--gold) !important;
  font-size: 1.2rem;
}

/* Section-alt for light theme */
.section-alt {
  background: var(--bg-secondary) !important;
}
.section-alt::before {
  background: linear-gradient(90deg, transparent, rgba(178, 138, 80, 0.15), rgba(178, 138, 80, 0.08), transparent) !important;
}

/* Leaderboard section highlight */
#leaderboard {
  background: linear-gradient(180deg, var(--bg-primary) 0%, #b8d4bb 50%, var(--bg-primary) 100%);
}
#leaderboard .section-header h2 {
  font-size: 2.5rem;
  color: var(--gold);
}

/* Responsive hero image */
@media (max-width: 768px) {
  .hero-image { max-width: 90%; }
  .hero-title { font-size: clamp(2rem, 8vw, 3.5rem) !important; }
  .leaderboard-top { flex-direction: column; align-items: center; }
  .lb-top-card.rank-1 { transform: scale(1.05) translateY(0) !important; }
  .fund-dashboard { grid-template-columns: 1fr !important; }
}

/* Navbar compact: balanced sizing */
.nav-links a {
  font-size: 0.88rem !important;
  padding: 8px 10px !important;
  white-space: nowrap;
}
.nav-cta {
  white-space: nowrap;
}
