@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-warm: #f5f5f0;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --header-blue: #004bb5;
  --header-blue-hover: #003a8c;
  --accent-blue: #3b82f6;
  --accent-blue-light: #93c5fd;
  --text-main: #111827;
  --text-body: #334155;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --border-input: #cbd5e1;
  --border-card: #d1d5db;
  --glass-border: #e2e8f0;
  --primary: #004bb5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-warm);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   BREADCRUMBS / TOP PILLS (TRANG CHỦ / CÔNG CỤ)
   ========================================================================== */
.breadcrumb-container {
  padding: 24px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-pill-btn {
  display: inline-block;
  background: #e6e5df;
  color: #4b5563;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-pill-btn:hover {
  background: #dad8cf;
  color: #111827;
}

.nav-pill-btn.active {
  background: #d4d2c8;
  color: #111827;
}

/* ==========================================================================
   DIRECTORY HERO BANNER (Image 1)
   ========================================================================== */
.tools-hero-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 20px 0 40px;
  text-align: center;
}

.tools-hero-title {
  font-size: 4rem;
  font-weight: 900;
  color: #111827;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.1;
  margin: 0 10px;
}

.doodle-icon {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   CATEGORY GRID DIRECTORY (Image 1)
   ========================================================================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  padding-bottom: 60px;
}

.category-card {
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.category-header {
  background: var(--header-blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 13px 18px;
}

.category-list {
  list-style: none;
  padding: 10px 0;
  flex: 1;
}

.category-list li a {
  display: block;
  padding: 7px 18px;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.45;
  transition: background 0.15s ease, color 0.15s ease;
}

.category-list li a:hover {
  background: #f1f5f9;
  color: var(--header-blue);
}

/* ==========================================================================
   TOOL DETAIL PAGE LAYOUT (Image 2)
   ========================================================================== */
.tool-page-wrapper {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  padding-top: 10px;
  padding-bottom: 60px;
  align-items: start;
}

.tool-main-content {
  min-width: 0;
}

/* Tool Input Container (White Box with thin border) */
.tool-card-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 1rem;
  color: #111827;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

/* Pill Button */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid var(--accent-blue-light);
  color: var(--accent-blue);
  background: #ffffff;
  border-radius: 50px;
  padding: 7px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-pill:hover {
  background: #eff6ff;
  border-color: var(--accent-blue);
  color: #2563eb;
}

/* Article / Explanation Typography (Image 2) */
.tool-explanation {
  color: #1e293b;
}

.tool-explanation h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 18px;
  line-height: 1.3;
}

.tool-explanation h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: #111827;
  margin: 24px 0 12px;
  line-height: 1.35;
}

.tool-explanation h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 16px 0 8px;
}

.tool-explanation p {
  font-size: 0.95rem;
  color: #334155;
  margin-bottom: 10px;
}

/* Blue Diamond Bullets (◆) */
.bullet-diamond-list {
  list-style: none;
  margin: 12px 0 20px;
}

.bullet-diamond-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 0.94rem;
  color: #334155;
  line-height: 1.6;
}

.bullet-diamond-list li::before {
  content: "◆";
  position: absolute;
  left: 0;
  color: var(--accent-blue);
  font-size: 0.82rem;
  top: 1px;
}

/* Large Formula Block */
.formula-display {
  font-size: 1.85rem;
  font-weight: 700;
  color: #111827;
  margin: 14px 0 20px;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   TOOL SIDEBAR (Right Column) (Image 2)
   ========================================================================== */
.tool-category-sidebar {
  position: sticky;
  top: 24px;
}

.tool-sidebar-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
  line-height: 1.2;
}

.tool-sidebar-links {
  list-style: none;
}

.tool-sidebar-links li a {
  display: block;
  padding: 7px 0;
  color: #334155;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.5;
  transition: color 0.15s ease;
}

.tool-sidebar-links li a:hover {
  color: var(--header-blue);
  text-decoration: underline;
}

.tool-sidebar-links li a.active {
  color: var(--header-blue);
  font-weight: 700;
}

/* ==========================================================================
   LEGACY / TOOL COMPATIBILITY UTILITIES
   ========================================================================== */
.conversion-result-card,
.result-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 20px;
  margin-top: 18px;
  text-align: center;
}

.result-value,
.res-val {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--accent-blue);
  margin: 6px 0;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-primary { background: #dbeafe; color: #1e40af; }

.data-table-container {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  background: #ffffff;
}

.data-table th, .data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}

.data-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #475569;
}

/* Callout */
.callout {
  padding: 14px 18px;
  border-radius: 6px;
  margin: 16px 0;
  font-size: 0.92rem;
}

.callout-info {
  background: #eff6ff;
  border-left: 4px solid var(--accent-blue);
  color: #1e40af;
}

/* Math Fraction Display */
.math-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.3rem;
  padding: 16px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  margin: 16px 0;
}

.fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 4px;
}

.numerator {
  border-bottom: 2px solid #111827;
  padding-bottom: 2px;
}

.denominator {
  padding-top: 2px;
}

/* ==========================================================================
   CONVERTER INTERACTIVE FLOW & PRESETS (Clean Minimal)
   ========================================================================== */
.converter-flow {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.converter-input-group {
  flex: 1;
}

.swap-btn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 14px;
}

.btn-swap {
  background: #ffffff;
  border: 1px solid var(--border-input);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-blue);
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.btn-swap:hover {
  background: #eff6ff;
  border-color: var(--accent-blue);
  transform: rotate(180deg);
}

.presets-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.preset-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.conversion-result-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  margin-top: 20px;
}

.conversion-formula-box {
  font-size: 0.95rem;
  color: #475569;
  margin-top: 8px;
  font-weight: 500;
}

.multi-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.multi-unit-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.multi-unit-card:hover {
  border-color: var(--accent-blue);
  background: #f8fafc;
}

.multi-unit-name {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

.multi-unit-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
}

.copy-mini-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
}

.copy-mini-btn:hover {
  color: var(--accent-blue);
}

/* ==========================================================================
   GLOBAL SUBPAGE COMPATIBILITY OVERRIDES (Transforms ALL pages to Image 2)
   ========================================================================== */
.navbar {
  background: transparent !important;
  border-bottom: 1px solid #e5e5dc !important;
  padding: 12px 0 !important;
}

.navbar .logo {
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  color: #111827 !important;
}

.navbar .nav-link {
  background: #e6e5df;
  color: #4b5563 !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 4px;
}

.navbar .nav-link:hover {
  background: #dad8cf;
  color: #111827 !important;
}

/* 2-Column Grid Layout: Main on LEFT, Sidebar on RIGHT */
.layout-wrapper {
  display: grid !important;
  grid-template-columns: 1fr 340px !important;
  gap: 48px !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 20px 24px 60px !important;
  align-items: start !important;
}

.main-content {
  order: 1 !important;
  min-width: 0 !important;
}

.sidebar {
  order: 2 !important;
  width: 100% !important;
  position: sticky !important;
  top: 24px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
}

/* Transform Sidebar Box to Clean Minimal List (Image 2) */
.sidebar-box {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
}

.sidebar-header {
  background: transparent !important;
  color: #111827 !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  padding: 0 0 12px 0 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  text-transform: capitalize !important;
}

.sidebar-menu {
  list-style: none !important;
  padding: 8px 0 !important;
}

.sidebar-menu li a {
  display: block !important;
  padding: 6px 0 !important;
  color: #334155 !important;
  font-size: 0.92rem !important;
  line-height: 1.5 !important;
  border-left: none !important;
  background: transparent !important;
  transition: color 0.15s ease !important;
}

.sidebar-menu li a:hover {
  color: var(--header-blue) !important;
  text-decoration: underline !important;
  background: transparent !important;
}

.sidebar-menu li a.active {
  color: var(--header-blue) !important;
  font-weight: 700 !important;
  background: transparent !important;
}

/* Tool container transforms into clean white card */
.tool-container,
.glass-panel {
  background: #ffffff !important;
  border: 1px solid var(--border-card) !important;
  border-radius: 8px !important;
  padding: 26px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
  backdrop-filter: none !important;
  color: #111827 !important;
}

.tool-page-header h1 {
  font-size: 1.8rem !important;
  font-weight: 800 !important;
  color: #111827 !important;
  margin-bottom: 8px !important;
}

.tool-page-header p {
  color: #64748b !important;
  font-size: 0.95rem !important;
  margin-bottom: 24px !important;
}

/* Buttons into Minimal Pill Buttons */
.btn-primary {
  border: 1.5px solid var(--accent-blue-light) !important;
  color: var(--accent-blue) !important;
  background: #ffffff !important;
  border-radius: 50px !important;
  padding: 8px 26px !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
}

.btn-primary:hover {
  background: #eff6ff !important;
  border-color: var(--accent-blue) !important;
  color: #2563eb !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Health Tabs Clean Minimal */
.health-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.health-tab-link {
  padding: 6px 14px;
  border-radius: 20px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.health-tab-link.active {
  background: var(--header-blue);
  color: #ffffff;
}

/* Result Displays */
.result-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  color: #111827 !important;
}

.result-box .result-value,
#bmiValDisplay,
#bmrValDisplay,
#tdeeValDisplay,
#calResultVal {
  color: var(--header-blue) !important;
}

/* BMI Meter Gauge */
.bmi-meter-wrapper {
  margin: 20px 0 10px;
}

.bmi-meter-track {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #38bdf8 0%, #10b981 35%, #f59e0b 70%, #ef4444 100%);
  position: relative;
}

.bmi-needle {
  width: 4px;
  height: 20px;
  background: #111827;
  position: absolute;
  top: -4px;
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left 0.3s ease;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.bmi-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 6px;
}

/* ==========================================================================
   MISSING UTILITY & COMPONENT CLASSES
   ========================================================================== */

/* Flex Layout Utilities */
.flex {
  display: flex;
}

.gap-4 {
  gap: 16px;
}

/* Typography Utility */
.text-muted {
  color: var(--text-muted);
}

/* Tab Component */
.tabs-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0;
}

.tab-btn {
  padding: 8px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--header-blue);
  border-bottom-color: var(--header-blue);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Footer */
.minimal-footer {
  text-align: center;
  padding: 32px 0;
  margin-top: 20px;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* BMI Badge Pill */
.bmi-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 992px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tool-page-wrapper,
  .layout-wrapper {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }
  
  .tool-category-sidebar,
  .sidebar {
    position: static !important;
    margin-top: 20px !important;
    border-top: 1px solid var(--border-light) !important;
    padding-top: 24px !important;
    order: 2 !important;
  }
}

@media (max-width: 640px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  .tools-hero-title {
    font-size: 2.6rem;
  }

  .doodle-icon {
    width: 80px;
    height: 80px;
  }

  .form-row,
  .converter-flow {
    flex-direction: column;
  }
}

/* ==========================================================================
   SITE NAVBAR & GLOBAL HEADER
   ========================================================================== */
.site-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  text-decoration: none;
}

.navbar-brand svg {
  flex-shrink: 0;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.navbar-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4b5563;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--primary);
  background: #f1f5f9;
}

.navbar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 1.4rem;
  color: #374151;
  cursor: pointer;
}

@media (max-width: 768px) {
  .navbar-toggle {
    display: block;
  }
  .navbar-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    gap: 8px;
    align-items: stretch;
  }
  .navbar-links.active {
    display: flex;
  }
}

/* ── Navbar Auth & User Dropdown ── */
.navbar-auth {
  display: flex;
  align-items: center;
  margin-left: 6px;
}

.nav-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #004bb5;
  color: #ffffff !important;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 75, 181, 0.2);
  text-decoration: none;
}

.nav-login-btn:hover {
  background: #003685;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 75, 181, 0.3);
  transform: translateY(-1px);
}

.nav-login-btn i {
  font-size: 1.15rem;
}

.nav-user-menu {
  position: relative;
}

.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  padding: 4px 12px 4px 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #1e293b;
  font-size: 0.88rem;
  font-weight: 600;
}

.nav-user-trigger:hover,
.nav-user-trigger.active {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.user-avatar-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #004bb5 0%, #3b82f6 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.84rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 75, 181, 0.2);
}

.user-name-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chevron {
  font-size: 1.1rem;
  color: #64748b;
  transition: transform 0.2s ease;
}

.nav-user-trigger.active .user-chevron {
  transform: rotate(180deg);
}

/* User Dropdown Box */
.nav-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 1100;
  overflow: hidden;
  animation: navDropdownFade 0.18s ease-out forwards;
}

.nav-user-dropdown.active {
  display: block;
}

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

.user-dropdown-header {
  padding: 16px;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 12px;
  align-items: center;
}

.dropdown-avatar-large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #004bb5 0%, #3b82f6 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 4px 8px rgba(0, 75, 181, 0.25);
}

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

.dropdown-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.dropdown-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: #dbeafe;
  color: #1d4ed8;
}

.dropdown-plan-badge.pro {
  background: #fef3c7;
  color: #b45309;
}

.dropdown-menu-list {
  padding: 8px;
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu-item:hover {
  background: #f1f5f9;
  color: #004bb5;
}

.dropdown-menu-item i {
  font-size: 1.25rem;
  color: #64748b;
  transition: color 0.15s ease;
}

.dropdown-menu-item:hover i {
  color: #004bb5;
}

.dropdown-menu-item-text {
  flex: 1;
}

.dropdown-menu-item-title {
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.25;
}

.dropdown-menu-item-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

.dropdown-item-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 6px 0;
}

.dropdown-logout-btn {
  color: #dc2626 !important;
}

.dropdown-logout-btn i {
  color: #ef4444 !important;
}

.dropdown-logout-btn:hover {
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

/* ── Global Auth Modal (Site-wide) ── */
.site-auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.site-auth-overlay.active {
  display: flex;
}

.site-auth-box {
  background: #ffffff;
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
  animation: siteModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes siteModalPop {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.site-auth-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.site-auth-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-auth-header-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.site-auth-header-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

.site-auth-close-btn {
  background: #f1f5f9;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.site-auth-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.site-auth-body {
  padding: 20px 24px 24px;
  max-height: 82vh;
  overflow-y: auto;
}

.site-auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}

.site-auth-tab-btn {
  flex: 1;
  padding: 9px;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s ease;
}

.site-auth-tab-btn.active {
  background: #ffffff;
  color: #004bb5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.site-auth-alert {
  display: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  margin-bottom: 16px;
  line-height: 1.4;
}

.site-auth-alert.error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.site-auth-alert.success {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.site-auth-field {
  margin-bottom: 14px;
}

.site-auth-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.site-auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.site-auth-input-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  font-size: 1.15rem;
  pointer-events: none;
}

.site-auth-input {
  width: 100%;
  padding: 10px 38px 10px 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 0.92rem;
  color: #1e293b;
  transition: all 0.18s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.site-auth-input:focus {
  outline: none;
  border-color: #004bb5;
  box-shadow: 0 0 0 3px rgba(0, 75, 181, 0.12);
}

.site-auth-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.site-auth-toggle-pwd:hover {
  color: #334155;
}

.site-auth-submit-btn {
  width: 100%;
  padding: 11px 16px;
  background: #004bb5;
  color: #ffffff;
  border: none;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 3px 8px rgba(0, 75, 181, 0.25);
  margin-top: 18px;
}

.site-auth-submit-btn:hover {
  background: #003685;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 75, 181, 0.35);
}

.site-auth-divider {
  position: relative;
  text-align: center;
  margin: 18px 0;
}

.site-auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e8f0;
}

.site-auth-divider span {
  position: relative;
  background: #ffffff;
  padding: 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}


@media (max-width: 768px) {
  .navbar-auth {
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
  }

  .nav-login-btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
  }

  .nav-user-menu {
    width: 100%;
  }

  .nav-user-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 8px 14px 8px 8px;
  }

  .nav-user-dropdown {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }
}

/* ==========================================================================
   SITE FOOTER (ENHANCED)
   ========================================================================== */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  margin-top: 60px;
  padding: 48px 0 24px;
  border-top: 1px solid #1e293b;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 36px;
}

.footer-about .footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 14px;
}

.footer-about p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #94a3b8;
}

.footer-col h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col ul li {
  margin-bottom: 9px;
}

.footer-col ul li a {
  color: #94a3b8;
  font-size: 0.88rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-col ul li a:hover {
  color: #38bdf8;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 540px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   AD PLACEHOLDERS (ADSENSE FRIENDLY)
   ========================================================================== */
.ad-slot {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  overflow: hidden;
}

.ad-sidebar-slot {
  min-height: 250px;
  margin-top: 24px;
}

.ad-bottom-slot {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
  min-height: 90px;
}

/* ==========================================================================
   COOKIE CONSENT BANNER
   ========================================================================== */
.cookie-consent {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 600px;
  margin: 0 auto;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.cookie-consent.cookie-hidden {
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
}

.cookie-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cookie-inner p {
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0;
  flex: 1;
  min-width: 240px;
}

.cookie-inner a {
  color: #38bdf8;
  text-decoration: underline;
}

.cookie-actions {
  display: flex;
  gap: 8px;
}

.cookie-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
}

.cookie-accept {
  background: #0284c7;
  color: #ffffff;
}

.cookie-accept:hover {
  background: #0369a1;
}

.cookie-decline {
  background: #334155;
  color: #cbd5e1;
}

.cookie-decline:hover {
  background: #475569;
}

/* ==========================================================================
   LEGAL & EDITORIAL PAGES (ABOUT, PRIVACY, TERMS, CONTACT)
   ========================================================================== */
.legal-page {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  padding: 36px 40px;
  margin: 20px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.legal-page h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 8px;
}

.legal-page .last-updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.legal-page h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin: 28px 0 12px;
}

.legal-page h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #334155;
  margin: 18px 0 8px;
}

.legal-page p, .legal-page li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 12px;
}

.legal-page ul {
  padding-left: 24px;
  margin-bottom: 16px;
}

/* About hero & stats */
.about-hero {
  text-align: center;
  padding: 30px 16px 20px;
}

.about-hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  color: #111827;
  margin-bottom: 10px;
}

.about-hero p {
  font-size: 1.15rem;
  color: #64748b;
  max-width: 650px;
  margin: 0 auto;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0 32px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
}

@media (max-width: 640px) {
  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.about-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 28px 0;
}

.feature-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.feature-card i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 12px;
  display: inline-block;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .about-features {
    grid-template-columns: 1fr;
  }
}

/* Contact Grid */
.contact-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 28px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   TOOL TABS & INTERACTIVE CARDS
   ========================================================================== */
.tool-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 24px;
}

.tool-tab-btn {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s ease;
  position: relative;
}

.tool-tab-btn:hover {
  color: #111827;
}

.tool-tab-btn.active {
  color: var(--primary);
}

.tool-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.tool-tab-content {
  display: none;
}

.tool-tab-content.active {
  display: block;
}

/* Metric summary row */
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.metric-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.metric-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: #111827;
}

.metric-val.primary { color: #0284c7; }
.metric-val.success { color: #10b981; }
.metric-val.warning { color: #f59e0b; }
.metric-val.danger { color: #ef4444; }

/* Progress bar stacked */
.stacked-bar-container {
  height: 24px;
  width: 100%;
  background: #e2e8f0;
  border-radius: 12px;
  display: flex;
  overflow: hidden;
  margin: 14px 0 8px;
}

.stacked-bar-segment {
  height: 100%;
  transition: width 0.3s ease;
}

/* Step-by-step calculation table */
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 16px;
}

.calc-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-light);
}

.calc-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: #1e293b;
}

.calc-table tr:hover {
  background: #f8fafc;
}

/* Tool explanation section for AdSense quality */
.tool-explanation-section {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 32px;
  margin-top: 36px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tool-explanation-section h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-explanation-section h3 {
  font-size: 1.08rem;
  font-weight: 700;
  color: #1e293b;
  margin: 20px 0 8px;
}

.tool-explanation-section p,
.tool-explanation-section li {
  font-size: 0.93rem;
  line-height: 1.7;
  color: #334155;
}

.tool-explanation-section ul,
.tool-explanation-section ol {
  padding-left: 22px;
  margin: 10px 0 16px;
}

.formula-highlight {
  background: #f1f5f9;
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  color: #0f172a;
  margin: 14px 0;
}

