/* ===== HNL Growth — Production Styles v3.0 — Mobile-First Audit ===== */

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

:root {
  --bg-primary: #060d1f;
  --bg-card: #0e1e42;
  --bg-elevated: #16284f;
  --accent-purple: #3b8eff;
  --accent-green: #00D26A;
  --accent-gold: #3b8eff;
  --accent-red: #EF4444;
  --accent-blue: #00B4D8;
  --text-primary: #e6f0ff;
  --text-secondary: #9fb3d4;
  --border: #22365f;
  --border-accent: #3b8eff;
  --radius: 16px;
  --nav-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* ===== Design tokens — thetrustedprop-style (token-driven) ===== */
  /* Accent scale */
  --accent: #3b8eff;
  --accent-strong: #2f6bff;
  /* --accent-btn: solid background for buttons with WHITE text.
     White on #2f6bff = 4.5 → passes WCAG 2.2 AA for normal text.
     Use --accent (#3b8eff) for borders/glows/icon-on-dark (5.99:1 on navy). */
  --accent-btn: #2f6bff;
  --accent-btn-hover: #2356d6;
  --accent-soft: rgba(59, 142, 255, 0.12);
  /* Radius tokens */
  --radius-xs: 10px;
  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  /* Shadow tokens — soft + blue glow */
  --shadow-1: rgba(30, 144, 255, 0.15) 0px 4px 16px 0px, rgba(255, 255, 255, 0.06) 0px 1px 0px 0px inset;
  --shadow-2: rgba(47, 107, 255, 0.45) 0px 2px 12px 0px;
  --shadow-glow: rgba(59, 130, 246, 0.6) 0px 0px 12px 0px;
  --shadow-soft: rgba(0, 0, 0, 0.12) 0px 2px 16px 0px, rgba(255, 255, 255, 0.04) 0px 0px 0px 1px inset;
  /* Motion tokens */
  --motion-instant: 150ms;
  --motion-fast: 200ms;
  --motion-normal: 300ms;
  --motion-slow: 380ms;
  /* Focus ring */
  --focus-ring: rgba(59, 130, 246, 0.55);
}

@media (min-width: 1024px) { :root { --nav-height: 72px; } }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Onest', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100dvh;
  /* Prevent iOS bounce showing white background */
  overscroll-behavior-y: none;
}

/* Body scroll lock for overlays */
body.no-scroll {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.font-jakarta { font-family: 'Onest', system-ui, sans-serif; }
.font-inter { font-family: 'Onest', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

/* Skip to content — accessibility */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  padding: 8px 20px;
  background: var(--accent-purple);
  color: #0e1e42;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  font-weight: 600;
  transition: top 0.2s;
  text-decoration: none;
}
.skip-to-content:focus { top: 0; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ===== Selection ===== */
::selection { background: rgba(59, 142, 255, 0.35); color: #0e1e42; }

/* ===== Focus States — Accessibility ===== */
*:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
  border-radius: 4px;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
  border-radius: 8px;
}

/* ===== Touch targets — min 44px ===== */
@media (pointer: coarse) {
  button, a, select, input[type="checkbox"], .filter-pill, .nav-link, .mobile-nav-link {
    min-height: 44px;
    min-width: 44px;
  }
  .filter-pill { min-width: unset; padding: 0.5rem 1rem; }
  select { min-width: unset; }
}

/* ===== NAVBAR ===== */
#navbar {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
#navbar.scrolled {
  background: rgba(0, 0, 0, 0.95);
  border-bottom-color: var(--border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: color 0.2s, background-color 0.2s;
  white-space: nowrap;
  position: relative;
}
.nav-link:hover { color: var(--text-primary); background-color: rgba(255,255,255,0.06); }
.nav-link.nav-active { color: var(--text-primary); }
.nav-link.nav-active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: linear-gradient(to right, #3b8eff, #2f6bff);
  border-radius: 1px;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0.75rem;
  transition: color 0.2s, background-color 0.2s, transform 0.15s;
}
.mobile-nav-link:hover, .mobile-nav-link:active {
  color: var(--text-primary);
  background-color: rgba(255,255,255,0.06);
  transform: translateX(4px);
}

/* Mobile menu animation */
#mobile-menu {
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-height: calc(100dvh - var(--nav-height));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Search overlay */
#search-overlay {
  animation: slideDown 0.2s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
#search-results a { transition: background 0.15s; }
#search-results .search-category {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 0.5rem 1rem 0.25rem;
  font-weight: 600;
}

/* ===== HERO STATS — overflow-safe compact cards ===== */
.hero-stats {
  width: 100%;
}
.hero-stat-card {
  min-width: 0;
  overflow: hidden;
  text-align: center;
}
.hero-stat-value {
  display: block;
  max-width: 100%;
  font-size: clamp(1.05rem, 5.2vw, 1.875rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hero-stat-label {
  display: block;
  font-size: clamp(0.62rem, 2.5vw, 0.75rem);
  line-height: 1.18;
  overflow-wrap: anywhere;
}
@media (max-width: 360px) {
  .hero-stats { gap: 0.375rem !important; }
  .hero-stat-card { padding: 0.625rem 0.375rem !important; }
  .hero-stat-value { font-size: clamp(0.95rem, 5vw, 1.125rem); }
  .hero-stat-label { font-size: 0.58rem; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}
@keyframes floatDelayed {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 30px) scale(0.95); }
  66% { transform: translate(20px, -20px) scale(1.05); }
}
@keyframes scrollX {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 142, 255, 0.2); }
  50% { box-shadow: 0 0 20px 5px rgba(59, 142, 255, 0.1); }
}
@keyframes barGrow {
  from { transform: scaleX(0); transform-origin: left; }
  to   { transform: scaleX(1); transform-origin: left; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}
@keyframes slideUpIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.animate-fade-in { animation: fadeIn 0.6s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.7s ease-out; }
.animate-fade-in-up-delay { animation: fadeInUp 0.7s ease-out 0.15s both; }
.animate-fade-in-up-delay2 { animation: fadeInUp 0.7s ease-out 0.3s both; }
.animate-float { animation: float 20s ease-in-out infinite; }
.animate-float-delayed { animation: floatDelayed 25s ease-in-out infinite; }
.animate-scroll-x {
  animation: scrollX 40s linear infinite;
  display: flex;
  width: max-content;
}
.animate-scroll-x:hover { animation-play-state: paused; }
/* Animate bằng transform thay vì width: bar luôn giữ đúng width (inline style),
   chỉ scaleX để tạo hiệu ứng → không bao giờ bị 'kẹt vô hình'. */
.animate-bar { transform-origin: left; animation: barGrow 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* Bounce for rank badges */
.firm-card .absolute.-top-3 { animation: bounceIn 0.5s ease; }

/* ===== CARD EFFECTS ===== */
.firm-card, .deal-card {
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition: transform var(--motion-normal) cubic-bezier(0.4, 0, 0.2, 1), box-shadow var(--motion-normal), border-color var(--motion-normal), opacity var(--motion-normal);
}
.firm-card:hover, .deal-card:hover {
  border-color: var(--accent) !important;
  box-shadow: var(--shadow-1);
}
.firm-card::before, .deal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(59, 142, 255, 0.08), transparent 40%);
  pointer-events: none;
  z-index: 0;
}
.firm-card:hover::before, .deal-card:hover::before { opacity: 1; }
.firm-card > *, .deal-card > * { position: relative; z-index: 1; }

/* Card hide/show animation for filters */
.firm-card.card-hidden, .deal-card.card-hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* ===== CHECKBOX ===== */
.compare-checkbox:checked + .checkbox-visual {
  background-color: var(--accent-purple);
  border-color: var(--accent-purple);
}
.compare-checkbox:checked + .checkbox-visual i { color: #0e1e42; }

/* ===== SCROLLBAR HIDE ===== */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ===== LINE CLAMP ===== */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== FILTER CHECKBOX ===== */
.filter-cb {
  width: 1.125rem;
  height: 1.125rem;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--border);
  border-radius: 0.25rem;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
}
.filter-cb:hover { border-color: var(--accent-purple); }
.filter-cb:checked {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}
.filter-cb:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  color: #0e1e42;
  font-weight: bold;
}

/* ===== FAQ ===== */
.faq-toggle i { transition: transform 0.3s ease; }
.faq-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.faq-item .faq-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s;
  padding: 0 1.25rem;
}
.faq-item .faq-content.open {
  max-height: 500px;
  padding: 0 1.25rem 1rem;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ===== TOAST ===== */
.hnl-toast {
  position: fixed;
  bottom: 80px;
  right: 16px;
  left: 16px;
  z-index: 9999;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  font-family: 'Onest', system-ui, sans-serif;
  max-width: 360px;
  animation: slideInRight 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}
@media (min-width: 640px) {
  .hnl-toast {
    left: auto;
    right: 20px;
    bottom: 80px;
  }
}
.hnl-toast.exit {
  animation: slideOutRight 0.35s cubic-bezier(0.4,0,0.2,1) forwards;
}

/* ===== TOOLTIP ===== */
.copy-tooltip {
  position: absolute;
  top: -2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.75rem;
  background: var(--accent-green);
  color: #0A2818;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  animation: fadeInUp 0.3s ease;
}

/* ===== GRADIENT TEXT UTILITY ===== */
.text-gradient {
  background: linear-gradient(to right, #3b8eff, #2f6bff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== BUTTON HOVER STATES ===== */
a[class*="bg-gradient"], button[class*="bg-gradient"] {
  position: relative;
  overflow: hidden;
}
a[class*="bg-gradient"]::after, button[class*="bg-gradient"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s;
}
a[class*="bg-gradient"]:hover::after, button[class*="bg-gradient"]:hover::after {
  background: rgba(255, 255, 255, 0.08);
}

/* ===== BADGE PULSE for "Exclusive" / "Limited Time" ===== */
span[class*="border-\\[#3b8eff\\]"] {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* ===== TABLE OF CONTENTS — active state ===== */
aside nav a {
  transition: color 0.2s, padding-left 0.2s;
  border-left: 2px solid transparent;
  padding-left: 0;
}
aside nav a.toc-active {
  color: var(--accent-purple) !important;
  font-weight: 600;
  border-left-color: var(--accent-purple);
  padding-left: 8px;
}

/* ===== FILTER PILLS — active state ===== */
.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  user-select: none;
  white-space: nowrap;
}
.filter-pill:hover { color: var(--text-primary); border-color: var(--accent-purple); }
.filter-pill.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #0e1e42;
}

/* ===== COMPARISON TABLE ===== */
#comparison-table .grid > div,
#comparison-default .grid > div {
  transition: background 0.15s;
}

/* ===== BACK TO TOP ===== */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b8eff, #2f6bff);
  color: #0e1e42;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 20px rgba(59, 142, 255,0.3);
}
#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
#back-to-top:hover {
  box-shadow: 0 6px 30px rgba(59, 142, 255,0.5);
  transform: translateY(-2px);
}

/* ===== MOBILE FILTER DRAWER ===== */
.filter-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.filter-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.filter-drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 61;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
}
.filter-drawer.open { transform: translateX(0); }

/* ===== COMPARE SLOT ===== */
.compare-slot {
  transition: border-color 0.3s, transform 0.2s;
}
.compare-slot.has-firm {
  border-style: solid;
  border-color: var(--accent-purple);
  background: rgba(59, 142, 255, 0.05);
}

/* ===== COOKIE BANNER ===== */
#cookie-banner {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: calc(1rem + var(--safe-bottom));
}
#cookie-banner.cookie-hidden {
  transform: translateY(100%);
}

/* ===== RESULTS COUNT ===== */
.results-count .count-value {
  transition: all 0.3s;
}

/* ============================================================
   RESPONSIVE — MOBILE-FIRST COMPREHENSIVE FIXES
   ============================================================ */

/* ===== EXTRA SMALL: ≤ 400px (iPhone SE, small phones) ===== */
@media (max-width: 400px) {
  /* Hero heading */
  h1 { font-size: 1.75rem !important; line-height: 1.2 !important; }

  /* Tighter padding */
  .max-w-7xl { padding-left: 12px !important; padding-right: 12px !important; }

  /* Cards tighter */
  .firm-card, .deal-card { padding: 0.875rem !important; }

  /* Stats grid stacks fully on tiny screens */
  .grid.grid-cols-2 { grid-template-columns: 1fr !important; gap: 0.5rem !important; }

  /* Footer social icons wrap */
  .flex.gap-3 > a[aria-label] { width: 36px; height: 36px; }

  /* Newsletter input + button stack */
  footer .flex.gap-3:has(input[type="email"]) {
    flex-direction: column;
  }
  footer .flex.gap-3:has(input[type="email"]) button {
    width: 100%;
  }
}

/* ===== SMALL: ≤ 640px (most phones) ===== */
@media (max-width: 640px) {
  /* Hero gradient orbs — scale down and contain */
  .animate-float, .animate-float-delayed {
    width: 200px !important;
    height: 200px !important;
  }

  /* Hero min height — use dvh for mobile address bar */
  section.min-h-\[85vh\] {
    min-height: 80dvh;
    min-height: 80vh; /* fallback */
  }

  /* Hero heading responsive */
  h1.text-4xl { font-size: 2rem !important; }

  /* Stats grid columns */
  .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .grid.grid-cols-2.md\:grid-cols-4 > div {
    padding: 0.75rem !important;
  }

  /* CTA buttons stack */
  .flex.flex-col.sm\:flex-row { flex-direction: column; }
  .flex.flex-col.sm\:flex-row > a { width: 100%; text-align: center; }

  /* Bar chart — firm name shorter */
  .flex.items-center.gap-4 > span.w-28 {
    width: 70px !important;
    font-size: 0.6875rem;
  }

  /* Deal cards — remove min-width to prevent overflow */
  .deal-card {
    min-width: 0 !important;
  }
  /* Deal cards in horizontal scroll */
  .snap-x .deal-card,
  .snap-x .deal-card-wrapper {
    min-width: 280px;
  }

  /* Compare page — slots stack */
  .grid.grid-cols-1.md\:grid-cols-3 .compare-slot {
    min-height: 140px;
  }

  /* Comparison table — ensure scrollable */
  #comparison-default, #comparison-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #comparison-default .grid.grid-cols-4,
  #comparison-table .grid {
    min-width: 640px;
  }

  /* Review page — header flex-col */
  .flex.flex-col.lg\:flex-row.gap-8.items-start {
    flex-direction: column;
  }

  /* Review page — challenge rules grid stacks */
  .grid.grid-cols-2.gap-0 {
    grid-template-columns: 1fr !important;
  }
  .grid.grid-cols-2.gap-0 > div {
    border-right: none !important;
  }

  /* Quick stats — 2 cols on phone */
  .grid.grid-cols-2.md\:grid-cols-3.lg\:grid-cols-6 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Payout process grid */
  .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Trading conditions grid */
  .grid.grid-cols-2.md\:grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  /* Footer grid — 1 col on small screens */
  footer .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  footer .col-span-2 { grid-column: span 1; }

  /* Blog featured post — stack fully */
  .grid.grid-cols-1.lg\:grid-cols-2 > div.h-64 {
    height: 160px;
  }

  /* Lists page items */
  .grid.grid-cols-2.sm\:grid-cols-3 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem;
  }

  /* How It Works — hide connector */
  .hidden.md\:block.absolute.top-24 { display: none !important; }

  /* Deals page — alert banner text wrap */
  .flex.items-center.justify-center.gap-3 {
    flex-wrap: wrap;
    text-align: center;
    gap: 0.5rem;
  }

  /* Review action buttons stack on small */
  .flex.gap-3:has(a[href*="visit"]) {
    flex-direction: column;
  }
  .flex.gap-3:has(a[href*="visit"]) > a {
    width: 100%;
    justify-content: center;
  }

  /* Prop firm card action buttons — stack vertically */
  .firm-card .flex.gap-3:last-child {
    flex-direction: column;
    gap: 0.5rem;
  }
  .firm-card .flex.gap-3:last-child > a {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Cookie banner stack */
  #cookie-banner .flex.flex-col.sm\:flex-row {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  /* Comparison table buttons */
  #comparison-default .grid.grid-cols-4:last-child a,
  #comparison-table a[class*="bg-gradient"] {
    font-size: 0.6875rem;
    padding: 0.375rem 0.5rem;
  }

  /* Sidebar hides on mobile — show inline TOC instead */
  aside.lg\:w-72 { display: none; }
  
  /* Tables */
  table { font-size: 0.8125rem; }
  th, td { padding: 0.5rem 0.375rem !important; }
  
  /* Word break for long text */
  h1, h2, h3 { word-break: break-word; overflow-wrap: break-word; }

  /* Back-to-top position adjusted for mobile */
  #back-to-top {
    bottom: 16px;
    right: 16px;
  }

  /* Section padding reduction */
  section.py-16 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
  section.py-12 { padding-top: 2rem; padding-bottom: 2rem; }
  .lg\:py-20 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
}

/* ===== MEDIUM: ≤ 768px (landscape phones, small tablets) ===== */
@media (max-width: 768px) {
  .firm-card, .deal-card { min-width: 0 !important; }
  .compare-slot { min-height: 140px; }

  /* Filter sidebar hidden on mobile, shown via drawer */
  aside.lg\:w-72 { display: none; }
  aside.filter-visible { display: block; }

  /* Rankings controls — wrap */
  .flex.flex-col.sm\:flex-row.items-start.sm\:items-center.justify-between {
    gap: 0.75rem;
  }
}

/* ===== LARGE-ISH: ≤ 1024px (tablets, small laptops) ===== */
@media (max-width: 1024px) {
  /* Review page sidebar → horizontal on tablet */
  .flex.flex-col.lg\:flex-row {
    flex-direction: column;
  }
  aside.lg\:w-72 {
    width: 100%;
  }
  /* Unstick sidebar on tablet */
  .lg\:sticky { position: relative !important; top: auto !important; }
}

/* ===== HOVER DISABLE ON TOUCH ===== */
@media (hover: none) {
  .firm-card:hover, .deal-card:hover {
    transform: none;
    box-shadow: none;
  }
  .firm-card::before, .deal-card::before {
    display: none;
  }
}

/* ===== SOCIAL PROOF TOAST — removed ===== */
/* ===== EXIT INTENT POPUP — removed ===== */

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 80;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b8eff, #2f6bff);
  color: #0e1e42;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(59, 142, 255, 0.3);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover { transform: translateY(-3px); box-shadow: 0 6px 30px rgba(59, 142, 255, 0.5); }

/* ===== SKELETON LOADER ===== */
.skeleton {
  background: linear-gradient(90deg, #16284f 25%, #22365f 50%, #16284f 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== QUIZ STYLES ===== */
.quiz-option { cursor: pointer; transition: all 0.2s; }
.quiz-option:hover { transform: translateY(-2px); }
.quiz-option.border-\[\#3b8eff\] { box-shadow: 0 0 20px rgba(59, 142, 255, 0.2); }

/* ===== STICKY DEAL BAR ===== */
.sticky-deal-bar {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 40;
  background: linear-gradient(90deg, #3b8eff, #2f6bff);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
.sticky-deal-bar.visible { transform: translateY(0); }

/* ===== LINE CLAMP ===== */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== PRINT ===== */
@media print {
  nav, footer, #cookie-banner, #back-to-top, .no-print { display: none !important; }
  body { background: white; color: black; }
  .firm-card, .deal-card { break-inside: avoid; border: 1px solid #ccc; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .animate-scroll-x { animation: none; }
  .animate-float, .animate-float-delayed { animation: none; }
  /* FIX: ngăn bar chart bị kẹt ở width:0 khi tắt animation.
     barGrow chỉ có from{width:0}, nếu animation gần như tức thời + fill 'both'
     thì bar có thể đứng ở 0 → vô hình. Tắt hẳn animate-bar để dùng inline width thật. */
  .animate-bar { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ===== SAFE AREA INSETS (notch phones) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  #cookie-banner {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  #compare-bar {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  #back-to-top {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .filter-drawer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }
}

/* ===== HIDE SCROLLBAR (cross-browser) ===== */
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* ===== FAQ – details/summary open state (native CSS, no Tailwind group-open needed) ===== */
details.faq-card[open] > summary .faq-title        { color: #7ab0ff; }
details.faq-card[open] > summary .faq-icon-wrap    { background-color: rgba(47,128,237,0.15); }
details.faq-card[open] > summary .faq-icon         { color: #7ab0ff; transform: rotate(180deg); }

/* ===== SECTION NAV – correct sticky offset so it sits below navbar ===== */
#section-nav { top: 64px; }   /* navbar is h-16 = 64px */

/* ============================================================================
   MD-PROSE — style ĐỒNG NHẤT cho mọi bài viết Markdown (content/blog/*.md).
   Dùng design tokens navy để bài mới luôn khớp giao diện toàn site.
   ============================================================================ */
.md-prose {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.8;
  word-break: break-word;
}
.md-prose > * + * { margin-top: 1.25rem; }

/* Tiêu đề */
.md-prose h1, .md-prose h2, .md-prose h3, .md-prose h4 {
  color: var(--text-primary);
  font-family: 'Onest', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 80px;
}
.md-prose h2 {
  font-size: 1.6rem;
  margin-top: 2.5rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.md-prose h3 { font-size: 1.3rem; margin-top: 2rem; }
.md-prose h4 { font-size: 1.1rem; margin-top: 1.5rem; }

/* Đoạn văn + inline */
.md-prose p { color: var(--text-secondary); }
.md-prose strong { color: var(--text-primary); font-weight: 700; }
.md-prose em { color: var(--text-primary); }
.md-prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(59, 142, 255, 0.4);
  transition: color var(--motion-fast, 200ms), border-color var(--motion-fast, 200ms);
}
.md-prose a:hover { color: #7ab0ff; border-bottom-color: #7ab0ff; }

/* =====================================================================
   CTA Button — markdown [**Text →**](url) → gradient button với animation
   Giống hệt hh-cta trong blog.tsx: glow pulse + shimmer + arrow bounce
   ===================================================================== */
@keyframes mdCtaGlow {
  0%, 100% { box-shadow: 0 8px 24px rgba(37,99,235,0.28), 0 0 0 rgba(37,99,235,0); }
  50%       { box-shadow: 0 10px 34px rgba(37,99,235,0.55), 0 0 22px rgba(37,99,235,0.35); }
}
@keyframes mdCtaShimmer {
  0%        { transform: translateX(-130%) skewX(-18deg); }
  60%, 100% { transform: translateX(230%) skewX(-18deg); }
}
@keyframes mdCtaArrow {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(5px); }
}

/* Wrapper paragraph */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) {
  margin: 2.25rem 0 1rem;
  text-align: left;
}

/* The button itself */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) > a {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 1.85rem;
  border-radius: 0.75rem;
  background: linear-gradient(to right, #2f6bff, #2356d6);
  color: #fff !important;
  font-weight: 800;
  font-size: 0.925rem;
  letter-spacing: 0.02em;
  border-bottom: none !important;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: mdCtaGlow 2.6s ease-in-out infinite;
}

/* Shimmer sweep */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) > a::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 45%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.52), transparent);
  animation: mdCtaShimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}

/* Rocket icon before text */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) > a::after {
  content: "\f135";           /* fa-rocket unicode */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.85rem;
  order: -1;                  /* icon trước text */
  color: #fff;
}

/* Hover */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) > a:hover {
  transform: translateY(-2px) scale(1.03);
  animation-play-state: paused;
  box-shadow: 0 14px 40px rgba(37,99,235,0.6), 0 0 26px rgba(37,99,235,0.4);
  color: #fff !important;
  border-bottom: none !important;
}

/* Strong text inside */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) > a strong {
  color: #fff !important;
  font-weight: 800;
  position: relative; /* above shimmer */
  z-index: 1;
}

/* Trust tagline dưới button — dùng + hr hoặc p sau CTA */
.md-prose p:has(> a > strong:only-child):has(> a:only-child) + p {
  margin-top: 0.5rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .md-prose p:has(> a > strong:only-child):has(> a:only-child) > a,
  .md-prose p:has(> a > strong:only-child):has(> a:only-child) > a::before {
    animation: none !important;
  }
}

/* Danh sách */
.md-prose ul, .md-prose ol { padding-left: 1.5rem; }
.md-prose ul { list-style: none; }
.md-prose ul > li { position: relative; padding-left: 1.5rem; }
.md-prose ul > li::before {
  content: ""; position: absolute; left: 0; top: 0.7em;
  width: 7px; height: 7px; border-radius: 9999px;
  background: var(--accent);
}
.md-prose ol { list-style: decimal; }
.md-prose ol::marker, .md-prose li::marker { color: var(--accent); }
.md-prose li { margin-top: 0.5rem; color: var(--text-secondary); }
.md-prose li > strong { color: var(--text-primary); }

/* Blockquote — callout navy */
.md-prose blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-md, 14px) var(--radius-md, 14px) 0;
  padding: 1rem 1.25rem;
  color: var(--text-primary);
}
.md-prose blockquote p { color: var(--text-primary); margin: 0; }

/* Code */
.md-prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  background: var(--bg-elevated);
  color: #7ab0ff;
  padding: 0.15em 0.4em;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.md-prose pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 18px);
  padding: 1.25rem;
  overflow-x: auto;
}
.md-prose pre code { background: none; border: none; color: var(--text-secondary); padding: 0; }

/* Bảng — đồng nhất với card navy */
/* ── Table: responsive outer wrapper ── */
.md-prose .table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid #22365f;
  margin: 1.75rem 0;
  /* scroll hint on mobile */
  scrollbar-width: thin;
  scrollbar-color: #22365f #0a1628;
}
.md-prose .table-wrap::-webkit-scrollbar { height: 6px; }
.md-prose .table-wrap::-webkit-scrollbar-track { background: #0a1628; border-radius: 0 0 12px 12px; }
.md-prose .table-wrap::-webkit-scrollbar-thumb { background: #22365f; border-radius: 3px; }

.md-prose table {
  /* Let table grow as wide as content needs — wrapper handles scroll */
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #0a1628;
  margin: 0;
  display: table;
  table-layout: auto;
}

/* Header row — full-width navy fill */
.md-prose thead tr {
  background: #1a2d5a;
}

.md-prose th {
  color: #e6f0ff;
  font-weight: 700;
  font-size: 0.875rem;
  text-align: left;
  padding: 13px 18px;
  white-space: nowrap;          /* header labels never break */
  border-bottom: 2px solid #22365f;
}
.md-prose th + th { border-left: 1px solid #2a4070; }

.md-prose td {
  padding: 11px 18px;
  border-bottom: 1px solid #1a2d4a;
  color: #c8d8f0;
  font-size: 0.875rem;
  line-height: 1.6;
  vertical-align: top;
  /* allow normal wrapping — cells widen naturally */
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  min-width: 90px;              /* each cell has breathing room */
  max-width: 320px;             /* long text cells don't go crazy wide */
}
.md-prose td + td { border-left: 1px solid #1a2d4a; }

/* remove bottom border on last row */
.md-prose tbody tr:last-child td { border-bottom: none; }

.md-prose tbody tr { background: #0a1628; transition: background 0.12s; }
.md-prose tbody tr:nth-child(even) { background: #0d1e3a; }
.md-prose tbody tr:hover { background: #122348; }

/* First column = label (slightly brighter, nowrap for short labels) */
.md-prose td:first-child {
  color: #dde8ff;
  font-weight: 500;
  white-space: nowrap;   /* Parameter/label column stays on one line */
  max-width: 220px;
}

/* Ảnh trong bài */
.md-prose img {
  border-radius: var(--radius-lg, 18px);
  border: 1px solid var(--border);
  width: 100%;
  height: auto;
}

/* Đường kẻ ngang */
.md-prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
