/* === Global Styles | BursaryBuddy | elite-web-designer === */

/* ---- CSS Variables ---- */
:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #D1FAE5;
  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --brand: #F59E0B;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --border: #E2E8F0;
  --shadow: 0 4px 24px rgba(0,0,0,0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 200ms cubic-bezier(0.4,0,0.2,1);
}

.dark {
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --bg: #0F172A;
  --card-bg: #1E293B;
  --border: #334155;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Page Entry Animation ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  50%  { transform: scale(1.08); opacity: 0.4; }
  100% { transform: scale(1); opacity: 0.8; }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up  { animation: fadeInUp 0.6s ease-out forwards; }
.animate-fade-in     { animation: fadeIn 0.4s ease-out forwards; }
.animate-slide-right { animation: slideInRight 0.5s ease-out forwards; }
.animate-float       { animation: float 3s ease-in-out infinite; }

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ---- Hero entrance ----
   Self-contained: `both` fill keeps each element hidden only for its own
   delay, so nothing depends on Tailwind's opacity-0 class loading first. */
@keyframes heroIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.hero-reveal {
  animation: heroIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--d, 0s);
}

/* Gentle shine across the gradient headline (replaces the bobbing float) */
@keyframes textShine {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.text-shine {
  background-size: 200% auto;
  animation: textShine 6s ease-in-out infinite;
}

/* ---- Gradient Orbs ---- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  pointer-events: none;
}
.orb-green  { background: radial-gradient(circle, rgba(5,150,105,0.25), transparent 70%); }
.orb-indigo { background: radial-gradient(circle, rgba(99,102,241,0.2), transparent 70%); }
.orb-amber  { background: radial-gradient(circle, rgba(245,158,11,0.2), transparent 70%); }

/* ---- Step Progress Bar ---- */
.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 2px;
}
.step-bar::-webkit-scrollbar { height: 0; }

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 48px;
  cursor: pointer;
  transition: var(--transition);
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s ease;
  border: 2px solid #CBD5E1;
  background: white;
  color: #94A3B8;
  position: relative;
  z-index: 1;
}
.dark .step-circle {
  background: #1E293B;
  border-color: #334155;
  color: #64748B;
}
.step-circle.active {
  border-color: #059669;
  background: linear-gradient(135deg, #059669, #0D9488);
  color: white;
  box-shadow: 0 0 0 4px rgba(5,150,105,0.2);
  animation: pulse-ring 2s ease-in-out infinite;
}
.step-circle.done {
  border-color: #059669;
  background: #059669;
  color: white;
}
.step-label {
  font-size: 11px;
  font-weight: 500;
  color: #94A3B8;
  text-align: center;
  white-space: nowrap;
}
.step-item.active .step-label { color: #059669; font-weight: 700; }
.step-item.done  .step-label  { color: #059669; }

.step-connector {
  flex: 1;
  height: 2px;
  background: #E2E8F0;
  margin-bottom: 22px;
  min-width: 16px;
  transition: background 0.3s ease;
}
.dark .step-connector { background: #334155; }
.step-connector.done { background: #059669; }

/* ---- Calculator Card ---- */
.calc-card {
  background: white;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: var(--transition);
}
.dark .calc-card {
  background: #1E293B;
  border-color: #334155;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ---- Option Cards (choice buttons) ---- */
.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid #E2E8F0;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: #334155;
}
.dark .option-card {
  border-color: #334155;
  background: #0F172A;
  color: #CBD5E1;
}
.option-card:hover {
  border-color: #059669;
  background: #F0FDF4;
  transform: translateX(4px);
}
.dark .option-card:hover {
  background: #064E3B20;
  border-color: #059669;
}
.option-card.selected {
  border-color: #059669;
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  color: #065F46;
  box-shadow: 0 4px 16px rgba(5,150,105,0.15);
  transform: translateX(4px);
}
.dark .option-card.selected {
  background: linear-gradient(135deg, #064E3B40, #065F4620);
  color: #6EE7B7;
}
.option-card.danger:hover, .option-card.danger.selected {
  border-color: #EF4444;
  background: #FEF2F2;
  color: #7F1D1D;
}
.dark .option-card.danger:hover, .dark .option-card.danger.selected {
  background: #7F1D1D20;
  color: #FCA5A5;
}
.option-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s;
}
.option-card:hover .option-icon { transform: scale(1.1); }
.option-card.selected .option-icon { background: white; }

/* ---- Input Styles ---- */
.bb-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid #E2E8F0;
  background: #F8FAFC;
  color: #0F172A;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  outline: none;
}
.dark .bb-input {
  border-color: #334155;
  background: #0F172A;
  color: #F1F5F9;
}
.bb-input:focus {
  border-color: #059669;
  background: white;
  box-shadow: 0 0 0 4px rgba(5,150,105,0.1);
}
.dark .bb-input:focus {
  background: #0F172A;
}
.bb-input.error { border-color: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,0.1); }
.bb-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.dark .bb-label { color: #D1D5DB; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #059669, #0D9488);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(5,150,105,0.3);
  text-decoration: none;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #047857, #0F766E);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5,150,105,0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  background: white;
  border: 2px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dark .btn-secondary {
  background: #0F172A;
  color: #CBD5E1;
  border-color: #334155;
}
.btn-secondary:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  transform: translateY(-1px);
}
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ---- Result Verdict Cards ---- */
.verdict-eligible {
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  border: 2px solid #86EFAC;
  border-radius: 20px;
  padding: 28px;
}
.dark .verdict-eligible {
  background: linear-gradient(135deg, #064E3B30, #065F4620);
  border-color: #059669;
}
.verdict-likely {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 2px solid #FCD34D;
  border-radius: 20px;
  padding: 28px;
}
.dark .verdict-likely {
  background: linear-gradient(135deg, #78350F30, #92400E20);
  border-color: #F59E0B;
}
.verdict-ineligible {
  background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
  border: 2px solid #FCA5A5;
  border-radius: 20px;
  padding: 28px;
}
.dark .verdict-ineligible {
  background: linear-gradient(135deg, #7F1D1D30, #991B1B20);
  border-color: #EF4444;
}

/* ---- Allowance Badge ---- */
.allowance-badge {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: white;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s;
}
.dark .allowance-badge {
  background: #0F172A;
  border-color: #334155;
}
.allowance-badge:hover { transform: translateY(-2px); }

/* ---- Stat Counter ---- */
.stat-number {
  font-size: 2.25rem;
  font-weight: 900;
  background: linear-gradient(135deg, #059669, #6366F1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- How-it-works steps ---- */
.how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 20px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
}
.dark .how-step {
  background: #1E293B;
  border-color: #334155;
}
.how-step:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.1);
}
.how-step-num {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669, #0D9488);
  color: white;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(5,150,105,0.4);
}

/* ---- Toast ---- */
.bb-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transform: translateY(12px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  max-width: 340px;
}
.bb-toast.show { transform: translateY(0); opacity: 1; }
.bb-toast.success { background: linear-gradient(135deg, #059669, #0D9488); }
.bb-toast.error   { background: linear-gradient(135deg, #EF4444, #DC2626); }
.bb-toast.info    { background: linear-gradient(135deg, #6366F1, #4F46E5); }
.bb-toast.warning { background: linear-gradient(135deg, #F59E0B, #D97706); }

/* ---- Range Slider ---- */
.bb-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(to right, #059669 0%, #059669 var(--val, 0%), #E2E8F0 var(--val, 0%), #E2E8F0 100%);
  outline: none;
}
.bb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669, #0D9488);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(5,150,105,0.4);
  transition: transform 0.2s;
}
.bb-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ---- Section transition ---- */
.section-fade { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.section-fade.visible { opacity: 1; transform: translateY(0); }

/* ---- Mobile touch improvements ---- */
@media (hover: none) {
  .option-card:hover { transform: none; }
  .how-step:hover { transform: none; }
}

/* ---- Income Hint Box ---- */
.income-hint {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.income-hint.info    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.income-hint.success { background: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }
.income-hint.error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.dark .income-hint.info    { background: #1E3A5F; color: #93C5FD; border-color: #1D4ED8; }
.dark .income-hint.success { background: #064E3B; color: #6EE7B7; border-color: #059669; }
.dark .income-hint.error   { background: #450A0A; color: #FCA5A5; border-color: #EF4444; }

/* ---- Step headings receive focus on step change; keep the ring subtle ---- */
.step-panel h3:focus { outline: none; }
.step-panel h3:focus-visible { outline: 2px solid #059669; outline-offset: 4px; border-radius: 6px; }
.option-card:focus-visible { outline: 2px solid #059669; outline-offset: 2px; }

/* ---- Respect reduced-motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .section-fade { opacity: 1; transform: none; }
  .hero-reveal, .text-shine { animation: none !important; }
}

/* ---- Hide the number spinner on the income box ---- */
#incomeInput::-webkit-outer-spin-button, #incomeInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#incomeInput { -moz-appearance: textfield; }

/* ---- Print: only the calculator result ---- */
@media print {
  nav, footer, #toastContainer, .btn-secondary, .btn-primary, .adsbygoogle, .bb-ad { display: none !important; }
  body.printing-result main > section:not(#calculator) { display: none !important; }
  body.printing-result #calculator > div > .text-center:first-child, body.printing-result #stepBar { display: none !important; }
  .calc-card { box-shadow: none; border: 1px solid #ccc; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #64748b; }
}

/* ============================================================
   GUIDES / ARTICLE STYLES
   ============================================================ */

/* Breadcrumb */
.bb-breadcrumb { font-size: 0.8rem; color: var(--text-secondary); }
.bb-breadcrumb a { color: var(--primary); text-decoration: none; }
.bb-breadcrumb a:hover { text-decoration: underline; }
.dark .bb-breadcrumb { color: #94A3B8; }

/* Article meta row */
.bb-article-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.dark .bb-article-meta { color: #94A3B8; }

/* Reading-typography for article body */
.prose-bb { color: #334155; font-size: 1.05rem; line-height: 1.8; }
.dark .prose-bb { color: #CBD5E1; }
.prose-bb h2 {
  font-size: 1.6rem; font-weight: 800; color: #0F172A;
  margin: 2.4rem 0 1rem; scroll-margin-top: 90px; line-height: 1.25;
}
.dark .prose-bb h2 { color: #F1F5F9; }
.prose-bb h3 {
  font-size: 1.2rem; font-weight: 700; color: #0F172A; margin: 1.8rem 0 0.7rem;
}
.dark .prose-bb h3 { color: #F1F5F9; }
.prose-bb p { margin: 0 0 1.15rem; }
.prose-bb a { color: var(--primary); font-weight: 600; text-decoration: none; }
.prose-bb a:hover { text-decoration: underline; }
.prose-bb strong { color: #0F172A; font-weight: 700; }
.dark .prose-bb strong { color: #F8FAFC; }
.prose-bb ul, .prose-bb ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.prose-bb li { margin-bottom: 0.55rem; }
.prose-bb ul li { list-style: none; position: relative; padding-left: 1.4rem; }
.prose-bb ul li::before {
  content: "\2713"; position: absolute; left: 0; top: 0;
  color: var(--primary); font-weight: 800;
}
.prose-bb ol { list-style: decimal; }
.prose-bb ol li { padding-left: 0.3rem; }
.prose-bb blockquote {
  border-left: 4px solid var(--primary); background: var(--primary-light);
  padding: 1rem 1.25rem; border-radius: 0 12px 12px 0; margin: 1.5rem 0;
  color: #065F46; font-style: normal;
}
.dark .prose-bb blockquote { background: rgba(5,150,105,0.12); color: #6EE7B7; }

/* Data tables inside articles */
.prose-bb table {
  width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem;
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
}
.prose-bb thead { background: linear-gradient(135deg, #059669, #0d9488); color: #fff; }
.prose-bb th, .prose-bb td { padding: 0.8rem 1rem; text-align: left; }
.prose-bb tbody tr { border-bottom: 1px solid var(--border); background: var(--card-bg); }
.prose-bb tbody tr:nth-child(even) { background: #F8FAFC; }
.dark .prose-bb tbody tr { background: #1E293B; border-color: #334155; }
.dark .prose-bb tbody tr:nth-child(even) { background: #172033; }

/* Callout boxes */
.bb-callout { padding: 1.1rem 1.25rem; border-radius: 14px; margin: 1.6rem 0; font-size: 0.98rem; line-height: 1.65; }
.bb-callout .bb-callout-title { font-weight: 800; display: block; margin-bottom: 0.35rem; }
.bb-callout.tip     { background: #ECFDF5; border: 1px solid #6EE7B7; color: #065F46; }
.bb-callout.warn    { background: #FFFBEB; border: 1px solid #FCD34D; color: #92400E; }
.bb-callout.info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.dark .bb-callout.tip  { background: rgba(5,150,105,0.12); border-color: #059669; color: #6EE7B7; }
.dark .bb-callout.warn { background: rgba(245,158,11,0.12); border-color: #B45309; color: #FCD34D; }
.dark .bb-callout.info { background: rgba(59,130,246,0.12); border-color: #1D4ED8; color: #93C5FD; }

/* Table of contents */
.bb-toc { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem 1.5rem; margin: 1.5rem 0 2rem; box-shadow: var(--shadow); }
.dark .bb-toc { background: #1E293B; border-color: #334155; }
.bb-toc h4 { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--primary); font-weight: 800; margin: 0 0 0.75rem; }
.bb-toc ol { margin: 0; padding-left: 1.2rem; }
.bb-toc li { margin-bottom: 0.4rem; }
.bb-toc a { color: var(--text-secondary); text-decoration: none; font-size: 0.95rem; }
.bb-toc a:hover { color: var(--primary); }
.dark .bb-toc a { color: #94A3B8; }

/* In-content ad slot (invisible until a real ad loads inside it) */
.bb-ad {
  margin: 1.5rem 0; text-align: center;
}
.bb-ad small { display: block; font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; color: #94A3B8; margin-bottom: 0.4rem; }

/* Guide card (index + related) */
.guide-card {
  display: flex; flex-direction: column; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem;
  box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition);
  height: 100%; text-decoration: none;
}
.guide-card:hover { transform: translateY(-4px); box-shadow: 0 12px 34px rgba(5,150,105,0.16); }
.dark .guide-card { background: #1E293B; border-color: #334155; }
.guide-card .guide-emoji { font-size: 1.9rem; margin-bottom: 0.75rem; }
.guide-card h3 { font-size: 1.1rem; font-weight: 800; color: #0F172A; margin: 0 0 0.5rem; line-height: 1.3; }
.dark .guide-card h3 { color: #F1F5F9; }
.guide-card p { font-size: 0.9rem; color: var(--text-secondary); margin: 0 0 1rem; line-height: 1.6; flex: 1; }
.dark .guide-card p { color: #94A3B8; }
.guide-card .guide-read { font-size: 0.82rem; font-weight: 700; color: var(--primary); }
