/* ==========================================================================
   CRAISTO - PDF SaaS Platform Stylesheet
   Version: 3.2 - Ultra-Polished SaaS Edition
   Architecture: CSS Custom Properties + Mobile-First Components
   ========================================================================== */

/* ==========================================================================
   1. ROOT VARIABLES & THEME TOKENS
   ========================================================================== */
:root {
  /* Background palette */
  --bg0: #F8FBFF;
  --bg1: #EFF6FF;
  --bg2: #E8F1FF;
  --bg3: #DBEAFE;
  --white: #FFFFFF;

  /* Text colors */
  --text: #1E293B;
  --muted: #64748B;
  --line: #DBE7F5;

  /* Accent colors */
  --accent: #3B82F6;
  --accent2: #2563EB;
  --accent-soft: #E5F0FF;

  /* Status colors */
  --success: #059669;
  --danger: #DC2626;

  /* Shadows & effects */
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(37, 99, 235, .08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .12);
  --shadow-hover: 0 24px 50px rgba(37, 99, 235, .16);
  --shadow-3d: 0 10px 20px rgba(15, 23, 42, 0.12), 0 6px 8px rgba(15, 23, 42, 0.08);

  /* Geometry */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Layout */
  --nav-h: 68px;
  --max: 1160px;

  /* Typography */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-blur: 18px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --speed: 0.3s;
  --speed-fast: 0.2s;
  --speed-slow: 0.45s;
}

/* ==========================================================================
   2. DARK MODE
   ========================================================================== */
html[data-theme="dark"] {
  --bg0: #0F172A;
  --bg1: #111827;
  --bg2: #1E293B;
  --bg3: #334155;
  --white: #1E293B;

  --text: #F1F5F9;
  --muted: #94A3B8;
  --line: #334155;

  --accent: #3B82F6;
  --accent2: #60A5FA;
  --accent-soft: #1E293B;

  --success: #10B981;
  --danger: #EF4444;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  --shadow-hover: 0 24px 50px rgba(0, 0, 0, .6);
  --shadow-3d: 0 10px 20px rgba(0,0,0,0.4), 0 6px 8px rgba(0,0,0,0.3);

  --glass-bg: rgba(17, 24, 39, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   3. BASE RESET & GLOBAL STYLES
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg0), var(--bg1) 40%, var(--white));
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   4. BACKGROUND DECORATION
   ========================================================================== */
.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.42;
  will-change: transform;
  animation: float 22s ease-in-out infinite;
}

.bg-blobs span:nth-child(1) { width: 480px; height: 480px; background: #DBEAFE; top: -100px; left: -80px; }
.bg-blobs span:nth-child(2) { width: 400px; height: 400px; background: #E0E7FF; top: 18%; right: -100px; animation-delay: -7s; }
.bg-blobs span:nth-child(3) { width: 340px; height: 340px; background: #EFF6FF; bottom: 8%; left: 28%; animation-delay: -14s; }
.bg-blobs span:nth-child(4) { width: 260px; height: 260px; background: #F0F9FF; top: 55%; left: 8%; opacity: 0.35; animation-delay: -4s; }
.bg-blobs span:nth-child(5) { width: 300px; height: 300px; background: #EEF2FF; bottom: -40px; right: 15%; opacity: 0.38; animation-delay: -11s; }

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(18px, -16px, 0) scale(1.04); }
}

html[data-theme="dark"] .bg-blobs span {
  opacity: 0.25;
}

/* ==========================================================================
   5. API BANNER
   ========================================================================== */
.api-banner {
  display: none;
  margin: 0;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.api-banner.show { display: block; }

.api-banner.ok { background: #ECFDF5; color: #047857; }
.api-banner.bad { background: #FEF2F2; color: #B91C1C; }

html[data-theme="dark"] .api-banner.ok { background: rgba(16, 185, 129, 0.12); color: #10B981; }
html[data-theme="dark"] .api-banner.bad { background: rgba(239, 68, 68, 0.12); color: #EF4444; }

/* ==========================================================================
   6. UTILITY CLASSES
   ========================================================================== */
.mono {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.vault-box {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.illu {
  width: 100%;
  height: 180px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #F8FBFF, #DBEAFE 55%, #fff);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--accent2);
}

.illu svg {
  width: 92px;
  height: 92px;
  opacity: 0.9;
}

.app-shell {
  position: relative;
  z-index: 1;
}

.container {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

/* ==========================================================================
   7. NAVBAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background var(--speed) var(--ease), box-shadow var(--speed) var(--ease), backdrop-filter var(--speed) var(--ease);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.navbar.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  letter-spacing: -0.02em;
  transition: transform var(--speed) var(--ease);
}

.brand:hover { transform: scale(1.04); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
  transition: transform 0.35s var(--ease);
  background: transparent;
}

.brand:hover .brand-mark { transform: rotate(10deg) scale(1.08); }

.brand-mark svg { width: 100%; height: 100%; }

/* Navigation links */
.nav-center {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--speed-fast) var(--ease), color var(--speed-fast) var(--ease);
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  background: #2563EB;
  border-radius: 20px;
  transform: scaleX(0);
  transition: transform var(--speed) var(--ease);
}

.nav-link:hover::after { transform: scaleX(1); }

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--accent-soft);
  color: var(--accent2);
  outline: none;
}

/* Nav right section */
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   8. BUTTONS & RIPPLE
   ========================================================================== */
.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow var(--speed) var(--ease), background var(--speed-fast) var(--ease), color var(--speed-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent2); }

.btn-primary {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover { box-shadow: 0 12px 24px rgba(37, 99, 235, 0.3); }

.btn-secondary {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-secondary:hover {
  border-color: #BFDBFE;
  box-shadow: var(--shadow);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-ripple .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

.btn-secondary .ripple-effect {
  background: rgba(59, 130, 246, 0.2);
}

@keyframes ripple {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ==========================================================================
   9. ICON BUTTONS & THEME TOGGLE
   ========================================================================== */
.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--speed) var(--ease), background var(--speed-fast) var(--ease), border-color var(--speed-fast) var(--ease), color var(--speed-fast) var(--ease);
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: #BFDBFE;
  color: var(--accent2);
  transform: translateY(-1px);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Theme toggle */
.theme-btn .theme-icon {
  position: absolute;
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
}

.theme-btn .sun { opacity: 1; transform: rotate(0deg); }
.theme-btn .moon { opacity: 0; transform: rotate(90deg); }

html[data-theme="dark"] .theme-btn .sun { opacity: 0; transform: rotate(-90deg); }
html[data-theme="dark"] .theme-btn .moon { opacity: 1; transform: rotate(0deg); }

/* Upgrade button */
.btn-upgrade {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  padding: 8px 14px;
  min-height: 38px;
  font-size: 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow var(--speed) var(--ease);
}

.btn-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.pro-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

/* ==========================================================================
   10. PROFILE & DROPDOWN
   ========================================================================== */
.profile-wrap { position: relative; }

.profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: var(--bg2);
  transition: border-color var(--speed-fast) var(--ease), transform var(--speed-fast) var(--ease);
}

.profile-btn:hover { border-color: var(--accent); transform: scale(1.05); }
.profile-btn img { width: 100%; height: 100%; object-fit: cover; }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 220px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  z-index: 60;
}

.dropdown-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  transition: background var(--speed-fast) var(--ease), color var(--speed-fast) var(--ease);
}

.dropdown-item:hover { background: var(--accent-soft); color: var(--accent2); }

.dropdown-divider { height: 1px; background: var(--line); margin: 6px 0; }

.hamburger { display: none; }
.mobile-nav { display: none; }

/* ==========================================================================
   11. MEGA MENU
   ========================================================================== */
.mega-wrap { position: relative; }

.mega-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: min(860px, calc(100vw - 24px));
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  z-index: 60;
}

.mega-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.mega-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.mega-col h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mega-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--speed-fast) var(--ease), color var(--speed-fast) var(--ease);
}

.mega-item:hover,
.mega-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent2);
  outline: none;
}

.mega-item .mi {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg1);
  display: grid;
  place-items: center;
  color: var(--accent2);
  flex: 0 0 auto;
}

.mega-item .mi svg { width: 100%; height: 100%; }

.mega-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 55;
  display: none;
}

.mega-backdrop.show { display: block; }

/* ==========================================================================
   12. HERO SECTION
   ========================================================================== */
.hero {
  padding: 36px 0 18px;
  text-align: center;
  animation: pageIn var(--speed-slow) var(--ease) both;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.4vw, 2.55rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  margin: 0 auto;
  max-width: 640px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
}

.hero-badges {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  margin-bottom: 0;
}

.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.badge:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   13. HERO V2 (Landing Page)
   ========================================================================== */
.hero-v2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px; /* Compacted from 80px */
  min-height: auto;
  padding: 40px 0; /* Compacted from 60px */
}

.hero-v2.hero {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-left {
  max-width: 650px;
  text-align: left;
}

.hero-left h1 {
  font-size: clamp(2rem, 4vw, 3.2rem); /* Fluid typography */
  line-height: 1.1;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-left p {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 22px;
}

.hero-image {
  width: 100%;
  max-width: 680px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  object-fit: contain;
  filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.15));
  animation: floatImage 4s ease-in-out infinite both;
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.hero-image:hover {
  animation-play-state: paused;
  filter: drop-shadow(0 32px 55px rgba(0, 0, 0, 0.2));
}

@keyframes floatImage {
  0% { transform: translateY(0) translateZ(0); }
  50% { transform: translateY(-14px) translateZ(0); }
  100% { transform: translateY(0) translateZ(0); }
}

.hero-actions {
  display: flex;
  gap: 18px;
  margin-top: 16px;
}

.hero-trust {
  margin-top: 16px;
  font-size: 14px;
  color: #666;
}

.hero-trust span {
  margin-left: 8px;
  font-weight: 600;
}

html[data-theme="dark"] .hero-trust {
  color: var(--muted);
}

/* ==========================================================================
   14. PREMIUM SEARCH BAR
   ========================================================================== */
.home-search-section {
  margin-top: 20px; /* Compacted from 32px */
  margin-bottom: 24px; /* Compacted from 32px */
}

.premium-search {
  margin: 0 auto;
  max-width: 680px; /* Refined max-width */
}

.premium-search .search-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-full);
  padding: 0 24px;
  height: 64px; /* Refined height */
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transition: all 0.3s var(--ease);
}

.premium-search .search-box:hover {
  border-color: rgba(147, 197, 253, 0.6);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.1);
}

.premium-search .search-box:focus-within {
  border-color: #2563EB;
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.premium-search .search-icon {
  font-size: 24px;
  color: var(--muted);
  transition: color 0.3s ease;
}

.premium-search .search-box:focus-within .search-icon {
  color: var(--accent2);
}

.premium-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 500;
}

.premium-search input::placeholder {
  color: #9CA3AF;
  transition: opacity 0.3s ease;
}

.premium-search .search-box:focus-within input::placeholder {
  opacity: 0.5;
}

.premium-search .clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg1);
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: all 0.2s ease;
}

.premium-search .clear-btn:hover {
  background: var(--bg2);
  color: var(--text);
  transform: rotate(90deg);
}

.search-highlight {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent2);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}

html[data-theme="dark"] .premium-search .search-box {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--bg3);
}

/* ==========================================================================
   15. POPULAR TOOLS SECTION
   ========================================================================== */
.popular-tools {
  margin: 0 auto 32px;
}

.section-head {
  text-align: center;
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.section-head p {
  color: var(--muted);
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 0;
}

.popular-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.popular-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.popular-card:hover {
  transform: translateY(-8px);
  border-color: transparent;
  box-shadow: 0 25px 50px rgba(37, 99, 235, 0.15);
}

.popular-card:hover::before {
  transform: scaleX(1);
}

.popular-icon-3d {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  filter: drop-shadow(0 10px 15px rgba(15, 23, 42, 0.15));
  transition: transform 0.3s var(--ease);
}

.popular-card:hover .popular-icon-3d {
  transform: translateY(-4px) scale(1.05);
}

.popular-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
}

.popular-card span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

html[data-theme="dark"] .popular-card {
  background: var(--bg2);
  border-color: var(--bg3);
}

/* ==========================================================================
   16. UTILITY CARDS ROW
   ========================================================================== */
.utility-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  width: 100%;
}

.utility-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid #E5E7EB;
  border-radius: 18px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.utility-card:hover {
  transform: translateY(-6px);
  border-color: #2563EB;
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.18);
}

.utility-icon-3d {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.12));
  transition: transform var(--speed) var(--ease);
}

.utility-card:hover .utility-icon-3d {
  transform: translateY(-2px) scale(1.06);
}

.utility-card h3 {
  font-size: 16px;
  margin: 0 0 6px;
}

.utility-card p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

html[data-theme="dark"] .utility-card {
  background: var(--bg2);
  border-color: var(--bg3);
}

/* ==========================================================================
   17. FILTERS & TOOL GRID
   ========================================================================== */
#all-tools {
  scroll-margin-top: 80px; /* Offset for sticky navbar */
  padding-top: 16px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 2px 16px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter-btn {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--speed-fast) var(--ease);
}

.filter-btn:hover,
.filter-btn:focus-visible {
  border-color: #BFDBFE;
  color: var(--accent2);
  outline: none;
}

.filter-btn.active {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  padding: 20px 0 40px;
}

.tool-card {
  position: relative;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 26px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), opacity 0.6s var(--ease-out);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.tool-card:hover {
  transform: translateY(-8px);
  border-color: #93C5FD; /* Brighter border */
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.15), 0 0 0 4px rgba(59, 130, 246, 0.05); /* Blue glow */
}

.tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #3B82F6, #60A5FA);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.tool-card:hover::before { transform: scaleX(1); }

.tool-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #93C5FD;
  outline: none;
}

.tool-card:hover .tool-icon-3d,
.tool-card:focus-visible .tool-icon-3d {
  transform: translateY(-6px) scale(1.1) rotate(-2deg);
}

.tool-icon-3d {
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  filter: drop-shadow(0 12px 18px rgba(15, 23, 42, 0.15));
  transition: transform 0.3s var(--ease);
}

.tool-card h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  flex: 1;
}

.tool-card.hidden { display: none; }

.no-tools-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
}

.no-tools-illustration {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  color: var(--accent);
  opacity: 0.6;
}

html[data-theme="dark"] .tool-card {
  background: var(--bg2);
  border-color: var(--bg3);
}

/* ==========================================================================
   18. CONTENT SECTIONS
   ========================================================================== */
.section { padding: 48px 0; }

.section h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  letter-spacing: -0.02em;
}

.section .lead {
  color: var(--muted);
  max-width: 640px;
  margin: 0 0 18px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.feature-card,
.info-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.feature-card:hover,
.info-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feature-card h3,
.info-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--text);
}

.feature-card p,
.info-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: center;
}

.visual-panel {
  min-height: 220px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--bg1), var(--bg2) 50%, var(--white));
  border: 1px solid var(--line);
  position: relative;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
}

.visual-panel::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: var(--radius);
  border: 1px dashed #93C5FD;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

html[data-theme="dark"] .visual-panel::after {
  background: rgba(255, 255, 255, 0.03);
}

.trust-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trust-list li {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  color: var(--muted);
}

.trust-list strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.util-promo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.util-card {
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--white), var(--bg0));
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 170px;
}

.util-card .btn {
  align-self: flex-start;
  margin-top: auto;
}

/* ==========================================================================
   19. TOOL PAGE & UPLOAD EXPERIENCE
   ========================================================================== */
.tool-page {
  padding: 24px 0 48px;
  animation: pageIn 0.4s var(--ease) both;
}

.tool-hero {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}

.tool-hero-icon {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  filter: drop-shadow(0 15px 25px rgba(15, 23, 42, 0.15));
  animation: floatImage 4s ease-in-out infinite;
}

.tool-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.02em;
}

.tool-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 680px;
}

.upload-panel {
  background: var(--glass-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.upload-stage {
  display: none;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.4s var(--ease);
}

.upload-stage.active {
  display: flex;
}

/* Stage 1: Idle */
.upload-card {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 32px;
  border-radius: 24px;
  border: 2px dashed #93C5FD;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.upload-card.dragover {
  border-color: var(--accent2);
  background: rgba(219, 234, 254, 0.8);
  transform: scale(1.02);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.upload-card.mini {
  padding: 24px;
  max-width: 100%;
}

.upload-card.mini .upload-illustration {
  width: 48px;
  height: 48px;
  margin-bottom: 0;
}

.upload-card.mini h2 {
  font-size: 1.2rem;
  margin: 0;
}

.upload-card.mini p {
  display: none;
}

.upload-illustration {
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.12));
  animation: floatImage 4s ease-in-out infinite;
}

.upload-card h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}

.upload-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.upload-meta {
  margin-top: 16px;
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.upload-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.upload-meta span::before {
  content: "•";
  color: var(--accent);
  font-size: 1.2rem;
}

/* File List */
.file-list-premium {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.file-card-premium {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: slideIn 0.3s var(--ease);
}

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

.file-icon-mini {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg1);
}

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

.file-info strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-info span {
  color: var(--muted);
  font-size: 0.85rem;
}

.file-actions {
  display: flex;
  gap: 6px;
}

.file-actions .btn {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 0.85rem;
}

/* Tool Options */
.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

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

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--white);
  color: var(--text);
  transition: border-color var(--speed-fast) var(--ease), box-shadow var(--speed-fast) var(--ease);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #60A5FA;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  justify-content: center;
}

/* Stage 2: Processing */
.processing-anim {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
}

.processing-anim svg {
  transform: rotate(-90deg);
}

.processing-anim circle {
  transition: stroke-dashoffset 0.4s ease;
}

.floating-doc {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
  animation: floatImage 2s ease-in-out infinite;
}

.stage-processing h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.proc-status {
  color: var(--accent2);
  font-weight: 600;
  margin: 0 0 8px;
}

.proc-percent {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Stage 3: Success */
.success-checkmark {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.success-checkmark svg {
  width: 100%;
  height: 100%;
}

.success-checkmark circle {
  stroke: #10B981;
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark path {
  stroke: #10B981;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

.stage-success h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  color: #10B981;
}

.stage-success > p {
  color: var(--muted);
  margin: 0 0 24px;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 20px;
  text-align: center;
  min-width: 120px;
}

.stat-item span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-item strong {
  font-size: 1.1rem;
  color: var(--text);
}

.stat-item.highlight strong {
  color: #10B981;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: none; }
}

@keyframes stroke {
  to { stroke-dashoffset: 0; }
}

/* Dropzone fallback (QR/PW) */
.dropzone {
  border: 1.5px dashed #93C5FD;
  background: linear-gradient(180deg, var(--bg0), var(--bg1));
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  transition: border-color var(--speed-fast) var(--ease), background var(--speed-fast) var(--ease), transform 0.15s var(--ease);
  cursor: pointer;
  display: none;
}

/* File list fallback */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.file-meta { min-width: 0; }

.file-meta strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta span { color: var(--muted); font-size: 12px; }

/* Progress bar fallback */
.progress {
  height: 8px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 10px;
  display: none;
}

.progress.show { display: block; }

html[data-theme="dark"] .progress { background: var(--bg3); }

.progress > i {
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #93C5FD, #2563EB, #93C5FD);
  background-size: 200% 100%;
  animation: bar 1.1s linear infinite;
  border-radius: inherit;
}

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

/* Result box fallback */
.result-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg0);
  border: 1px solid var(--line);
  display: none;
}

.result-box.show {
  display: block;
  animation: statusIn 0.25s var(--ease);
}

/* FAQ & How-to */
.faq,
.how { margin-top: 22px; }

.faq details {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color var(--speed-fast) var(--ease);
}

.faq details:hover { border-color: #BFDBFE; }
.faq details[open] { border-color: var(--accent); }

.faq summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "▸";
  float: right;
  transition: transform var(--speed) var(--ease);
}

.faq details[open] summary::after { transform: rotate(90deg); }

.faq details p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Related tools */
.related-wrap { margin-top: 22px; }

.related {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.related a {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  transition: border-color var(--speed-fast) var(--ease), background var(--speed-fast) var(--ease), transform var(--speed-fast) var(--ease);
}

.related a:hover {
  border-color: #93C5FD;
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ==========================================================================
   20. QR CODE & PASSWORD GENERATOR PAGES
   ========================================================================== */
.preview-box {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.preview-box canvas,
.preview-box img,
.preview-box svg {
  max-width: 100%;
  height: auto;
}

.strength {
  height: 8px;
  border-radius: var(--radius-full);
  background: #E2E8F0;
  overflow: hidden;
}

html[data-theme="dark"] .strength { background: var(--bg3); }

.strength > i {
  display: block;
  height: 100%;
  width: 0;
  transition: width var(--speed-fast) var(--ease), background var(--speed-fast) var(--ease);
}

.pw-out {
  font-family: var(--mono);
  font-size: 16px;
  word-break: break-all;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ==========================================================================
   21. FOOTER
   ========================================================================== */
.footer {
  margin-top: 40px;
  padding: 36px 0 24px;
  background: linear-gradient(180deg, transparent, var(--bg1) 30%, var(--bg2));
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 18px;
}

.footer h4 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer a {
  display: block;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 0;
  transition: color var(--speed-fast) var(--ease);
}

.footer a:hover { color: var(--accent2); }

.footer-bottom {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.auth-note a {
  color: var(--accent2);
  font-weight: 600;
}

/* ==========================================================================
   22. SCROLL REVEAL ANIMATION (Enhanced Stagger)
   ========================================================================== */
.reveal .section-head,
.reveal .premium-search,
.reveal .popular-card,
.reveal .filters,
.reveal .tool-card,
.reveal .feature-card,
.reveal .info-card,
.reveal .trust-list li,
.reveal .two-col > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.active .section-head,
.reveal.active .premium-search,
.reveal.active .popular-card,
.reveal.active .filters,
.reveal.active .tool-card,
.reveal.active .feature-card,
.reveal.active .info-card,
.reveal.active .trust-list li,
.reveal.active .two-col > * {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children automatically */
.reveal.active .popular-card:nth-child(1),
.reveal.active .feature-card:nth-child(1),
.reveal.active .info-card:nth-child(1),
.reveal.active .trust-list li:nth-child(1) { transition-delay: 0ms; }

.reveal.active .popular-card:nth-child(2),
.reveal.active .feature-card:nth-child(2),
.reveal.active .info-card:nth-child(2),
.reveal.active .trust-list li:nth-child(2) { transition-delay: 50ms; }

.reveal.active .popular-card:nth-child(3),
.reveal.active .feature-card:nth-child(3),
.reveal.active .info-card:nth-child(3),
.reveal.active .trust-list li:nth-child(3) { transition-delay: 100ms; }

.reveal.active .popular-card:nth-child(4),
.reveal.active .feature-card:nth-child(4),
.reveal.active .info-card:nth-child(4),
.reveal.active .trust-list li:nth-child(4) { transition-delay: 150ms; }

/* ==========================================================================
   23. TOAST NOTIFICATION & BACK TO TOP
   ========================================================================== */
#toast-status {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  max-width: 320px;
}

.status {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  display: none;
}

.status.show {
  display: block;
  animation: statusIn 0.25s var(--ease) both;
}

.status.info {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.status.success {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.status.error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  animation: shake 0.3s var(--ease);
}

html[data-theme="dark"] .status.info {
  background: rgba(59, 130, 246, 0.12);
  color: #60A5FA;
  border-color: rgba(59, 130, 246, 0.25);
}

html[data-theme="dark"] .status.success {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  border-color: rgba(16, 185, 129, 0.25);
}

html[data-theme="dark"] .status.error {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.25);
}

@keyframes statusIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  color: var(--accent2);
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), background 0.3s, color 0.3s;
  z-index: 90;
  overflow: hidden;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent2);
  color: #fff;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.3);
}

.back-to-top .ripple-effect {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   24. SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg1);
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg3) var(--bg1);
}

/* ==========================================================================
   25. SELECTION
   ========================================================================== */
::selection {
  background: rgba(59, 130, 246, 0.2);
  color: var(--text);
}

html[data-theme="dark"] ::selection {
  background: rgba(96, 165, 250, 0.3);
}

/* ==========================================================================
   26. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Large screens (≤ 1100px) */
@media (max-width: 1100px) {
  .tools-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

/* Tablet (≤ 900px) */
@media (max-width: 900px) {
  .nav-center { display: none; }
  .hamburger { display: grid; }

  .tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .feature-grid,
  .trust-list,
  .util-promo,
  .two-col,
  .related,
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .mobile-nav.open {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--nav-h);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--line);
    padding: 12px 16px 16px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    z-index: 48;
  }

  .mega-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 76px;
    width: auto;
  }

  .mobile-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
  }

  /* Hero V2 responsive */
  .hero-v2 {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 40px 25px;
    gap: 30px;
  }

  .hero-left {
    max-width: 100%;
    text-align: center;
  }

  .hero-left h1 { font-size: 46px; }
  .hero-left p { font-size: 18px; }

  .hero-actions,
  .hero-badges,
  .hero-right {
    justify-content: center;
  }

  .hero-image { max-width: 520px; }
  
  .tool-hero {
    flex-direction: column;
    text-align: center;
  }
}

/* Mobile (≤ 640px) */
@media (max-width: 640px) {
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .feature-grid,
  .trust-list,
  .util-promo,
  .two-col,
  .related,
  .footer-grid,
  .mega-grid {
    grid-template-columns: 1fr;
  }

  .nav-right .btn-upgrade span:not(.pro-badge),
  .nav-right .theme-btn {
    display: none;
  }

  .hero { padding-top: 24px; }

  .hero-image {
    max-width: 100%;
    animation-duration: 3.4s;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .tool-card { padding: 20px; min-height: 200px; }
  .tool-card h3 { font-size: 18px; }

  .upload-panel { padding: 16px; }
  
  .upload-card { padding: 32px 16px; }
  .upload-card h2 { font-size: 1.4rem; }
  .upload-card p { font-size: 1rem; }
  .upload-meta { flex-direction: column; gap: 8px; }

  #toast-status {
    left: 16px;
    right: 16px;
    max-width: none;
  }
  
  .back-to-top {
    width: 48px;
    height: 48px;
    bottom: 16px;
    right: 16px;
  }
}

/* Small mobile (≤ 380px) */
@media (max-width: 380px) {
  .tools-grid { grid-template-columns: 1fr; }

  .hero-left h1 { font-size: 36px; }
  .hero-left p { font-size: 16px; }

  .btn {
    padding: 8px 14px;
    font-size: 14px;
  }
}

/* ==========================================================================
   27. ACCESSIBILITY & REDUCED MOTION
   ========================================================================== */
@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;
  }

  .bg-blobs span { animation: none; }
  .hero-image { animation: none; }
  .tool-hero-icon { animation: none; }
  .upload-illustration { animation: none; }
  .floating-doc { animation: none; }
  
  /* Ensure reveal elements are visible immediately */
  .reveal .section-head,
  .reveal .premium-search,
  .reveal .popular-card,
  .reveal .filters,
  .reveal .tool-card,
  .reveal .feature-card,
  .reveal .info-card,
  .reveal .trust-list li,
  .reveal .two-col > * {
    opacity: 1;
    transform: none;
  }
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-contrast: high) {
  .nav-link,
  .btn,
  .tool-card {
    border-width: 2px;
  }

  .status { border-width: 2px; }
}

@media print {
  .navbar,
  .footer,
  .bg-blobs,
  .api-banner,
  .mega-menu,
  .mobile-nav,
  .back-to-top {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}
