/* ============================================================
   FullCalculators — Global Stylesheet
   Modern, SEO-friendly, AdSense-ready calculator site
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:        #1d4ed8;
  --primary-dark:   #1e3a8a;
  --primary-light:  #dbeafe;
  --accent:         #0ea5e9;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;

  --bg:             #f1f5f9;
  --bg-card:        #ffffff;
  --bg-header:      #0f172a;
  --bg-nav:         #1e293b;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f8fafc;

  --border:         #e2e8f0;
  --border-focus:   #93c5fd;

  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --shadow-lg:      0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --transition:     all .2s ease;
  --font:           'Inter', system-ui, -apple-system, sans-serif;

  --header-h:       64px;
  --nav-h:          48px;
}

[data-theme="dark"] {
  --bg:             #0f172a;
  --bg-card:        #1e293b;
  --bg-header:      #0b1121;
  --bg-nav:         #151d2a;

  --text-primary:   #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  --border:         #334155;
  --border-focus:   #3b82f6;

  --shadow-sm:      0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.2);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.5), 0 2px 4px -2px rgba(0,0,0,.3);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -4px rgba(0,0,0,.4);
  --shadow-lg:      0 20px 25px -5px rgba(0,0,0,.6), 0 8px 10px -6px rgba(0,0,0,.5);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, select, textarea { font-family: var(--font); }

/* ── Layout Utilities ──────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.flex    { display: flex; }
.flex-col{ display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2   { gap: 8px; }
.gap-4   { gap: 16px; }
.gap-6   { gap: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  background: var(--bg-header);
  height: 64px !important;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-logo:hover { color: #fff; text-decoration: none; }
.site-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.site-logo .logo-text span { color: var(--accent); }

/* ── Search Bar ─────────────────────────────────────────────── */
.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 44px 0 16px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: .9rem;
  outline: none;
  transition: var(--transition);
}
.header-search input::placeholder { color: rgba(255,255,255,.45); }
.header-search input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,.14);
}
.header-search button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.65);
  padding: 6px;
  font-size: 1.1rem;
  transition: var(--transition);
}
.header-search button:hover { color: var(--accent); }

.header-nav { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.header-nav a {
  color: rgba(255,255,255,.8);
  font-size: .95rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.header-nav a:hover, .header-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}

.theme-toggle {
  background: transparent;
  color: rgba(255,255,255,.75);
  font-size: 1.1rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: scale(1.1);
}


/* ── Category Nav ───────────────────────────────────────────── */
.cat-nav {
  background: var(--bg-nav);
  height: var(--nav-h);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cat-nav a {
  color: rgba(255,255,255,.7);
  font-size: .82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  transition: var(--transition);
}
.cat-nav a:hover, .cat-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  text-decoration: none;
}
.cat-nav a.active {
  background: var(--primary);
}

/* ── Hero / Intro Banner ────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1d4ed8 100%);
  padding: 48px 0 40px;
  text-align: center;
  color: #fff;
}
.hero-banner h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -.02em;
}
.hero-banner h1 span { color: var(--accent); }
.hero-banner p {
  font-size: 1rem;
  color: rgba(255,255,255,.75);
  max-width: 600px;
  margin: 0 auto 28px;
}
.hero-search {
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero-search input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  font-size: .95rem;
  outline: none;
  color: #0f172a;
}
.hero-search button {
  padding: 0 24px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  transition: var(--transition);
}
.hero-search button:hover { background: var(--primary-dark); }

/* ── Ad Placeholder ─────────────────────────────────────────── */
.ad-slot {
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 20px 0;
}
.ad-slot-banner { height: 90px; }
.ad-slot-rect   { height: 250px; max-width: 300px; width: 100%; }
.ad-slot-wide   { height: 90px; }

/* ── Section Title ──────────────────────────────────────────── */
.section {
  padding: 40px 0;
}
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
}
.section-title .icon { font-size: 1.3rem; }

/* ── Calculator Category Sections (Home) ───────────────────── */
.cat-sections {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  scroll-margin-top: 130px;
  position: relative;
  overflow: hidden;
}
.cat-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}
.cat-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.cat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.04);
}
.cat-icon.financial { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border: 1px solid #bbf7d0; }
.cat-icon.health    { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); border: 1px solid #fecaca; }
.cat-icon.math      { background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); border: 1px solid #ddd6fe; }
.cat-icon.other     { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border: 1px solid #fde68a; }

.cat-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
}

.calc-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px;
}
.calc-list li {
  display: block;
}
.calc-list a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  border: 1px solid transparent;
}
.calc-list a:hover {
  background: white;
  color: var(--primary);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.08);
  border-color: rgba(29, 78, 216, 0.1);
}
.calc-list a .link-icon {
  width: 14px;
  height: 14px;
  opacity: 0.4;
  transition: all 0.2s ease;
  color: var(--primary);
}
.calc-list a:hover .link-icon {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Popular Calculators Grid ───────────────────────────────── */
.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.popular-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: var(--text-primary);
}
.popular-card:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  text-decoration: none;
}
.popular-card .pop-icon { font-size: 2rem; margin-bottom: 10px; }
.popular-card .pop-name { font-size: .85rem; font-weight: 600; }
.popular-card:hover .pop-name { color: #fff; }

/* ── Calculator Page Layout ─────────────────────────────────── */
.calc-page {
  padding: 30px 0 60px;
}
.calc-page-inner {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}
.calc-main {}
.calc-sidebar {}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-secondary); }
.header-nav a:hover { color: var(--primary); }
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 10px;
  color: var(--text-muted);
}
.lang-switcher a {
  color: var(--text-secondary) !important;
  text-decoration: none;
  padding: 2px 4px;
  transition: var(--transition);
}
.lang-switcher a.active {
  color: var(--primary) !important;
}
.lang-switcher a:hover:not(.active) {
  color: var(--primary-light) !important;
}
.lang-switcher span { color: var(--border); font-weight: 400; }
.breadcrumb span { color: var(--text-muted); }

/* Calculator Widget Box */
.calc-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.calc-widget h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.calc-widget .calc-subtitle {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 24px;
}
.calc-widget hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-input, .form-select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  transition: var(--transition);
  appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.input-group {
  position: relative;
}
.input-prefix, .input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
  font-weight: 500;
}
.input-prefix { left: 14px; }
.input-suffix { right: 14px; }
.input-group .form-input.has-prefix { padding-left: 32px; }
.input-group .form-input.has-suffix { padding-right: 42px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,78,216,.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(29,78,216,.4); transform: translateY(-1px); color: #fff; text-decoration: none; }
.btn-secondary {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); text-decoration: none; }
.btn-block { width: 100%; }
.btn-lg { height: 52px; font-size: 1rem; padding: 0 32px; }
.btn-sm { height: 34px; font-size: 0.8rem; padding: 0 16px; border-radius: var(--radius-sm); }


/* Result Display */
.result-box {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #fff;
  margin-top: 20px;
}
.result-box .result-label {
  font-size: .82rem;
  font-weight: 500;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.result-box .result-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.result-box .result-unit {
  font-size: 1rem;
  opacity: .8;
  font-weight: 400;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.result-item {
  background: rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 12px 16px;
  backdrop-filter: blur(4px);
}
.result-item .ri-label {
  font-size: .75rem;
  opacity: .75;
  margin-bottom: 4px;
}
.result-item .ri-value {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ── Tab Switcher ───────────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  text-align: center;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { background: var(--border); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Info / Content Section ─────────────────────────────────── */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.content-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.content-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 18px 0 8px;
}
.content-card p {
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.75;
  margin-bottom: 12px;
}
.content-card ul, .content-card ol {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.8;
  margin-bottom: 12px;
}
.content-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  margin: 14px 0;
}
.content-card th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.content-card td {
  padding: 9px 14px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.content-card tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
[data-theme="dark"] .content-card tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
.formula-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-family: 'Courier New', monospace;
  font-size: .9rem;
  color: var(--text-primary);
  margin: 12px 0;
}

/* ── Sidebar Widgets ────────────────────────────────────────── */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.sidebar-widget h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.related-list {
  list-style: none;
  padding: 0;
}
.related-list li { padding: 5px 0; }
.related-list a {
  font-size: .85rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.related-list a::before { content: '→'; font-size: .8rem; color: var(--text-muted); }
.related-list a:hover { text-decoration: none; color: var(--primary-dark); }

/* ── Scientific Calculator Styles ───────────────────────────── */
.sci-calc {
  background: #1e293b;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.05);
}
.sci-display {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: right;
}
.sci-expr {
  color: rgba(255,255,255,.4);
  font-size: .8rem;
  min-height: 18px;
  word-break: break-all;
  font-family: 'Courier New', monospace;
}
.sci-val {
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  word-break: break-all;
  line-height: 1.2;
  font-family: 'Courier New', monospace;
}
.sci-mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.mode-btn {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  border: 1.5px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.55);
  transition: var(--transition);
}
.mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.mode-btn:hover:not(.active) { border-color: rgba(255,255,255,.35); color: rgba(255,255,255,.85); }
.sci-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.sci-btn {
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  color: #fff;
}
.sci-btn:active { transform: scale(.95); }
.sci-btn.func   { background: #334155; color: #e2e8f0; font-size: .8rem; font-weight: 500; }
.sci-btn.func:hover  { background: #3f5470; color: #fff; }
.sci-btn.num    { background: #1e3a5f; color: #fff; font-size: .9rem; }
.sci-btn.num:hover   { background: #264880; }
.sci-btn.op     { background: #1d4ed8; }
.sci-btn.op:hover    { background: #2563eb; }
.sci-btn.eq     { background: linear-gradient(135deg, #0ea5e9, #2563eb); font-size: 1.1rem; }
.sci-btn.eq:hover    { filter: brightness(1.1); }
.sci-btn.spec   { background: #374151; }
.sci-btn.spec:hover  { background: #4b5563; }
.sci-btn.clr    { background: #7f1d1d; color: #fca5a5; }
.sci-btn.clr:hover   { background: #991b1b; color: #fff; }

/* ── BMI Chart ──────────────────────────────────────────────── */
.bmi-scale {
  position: relative;
  height: 30px;
  border-radius: 15px;
  overflow: hidden;
  background: linear-gradient(to right, #3b82f6 0%, #22c55e 25%, #f59e0b 50%, #ef4444 75%, #7f1d1d 100%);
  margin: 20px 0 8px;
}
.bmi-pointer {
  position: absolute;
  top: -6px;
  width: 3px;
  height: 42px;
  background: #0f172a;
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left .5s ease;
}
.bmi-labels {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.bmi-category-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 700;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-header);
  color: rgba(255,255,255,.6);
  margin-top: 60px;
  padding: 50px 0 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 240px repeat(4, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand .site-logo { margin-bottom: 14px; font-size: 1.1rem; }
.footer-brand p { font-size: .83rem; line-height: 1.7; }
.footer-col h5 {
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { padding: 4px 0; }
.footer-col a {
  color: rgba(255,255,255,.55);
  font-size: .83rem;
  transition: var(--transition);
}
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom a { color: rgba(255,255,255,.45); }
.footer-bottom a:hover { color: #fff; text-decoration: none; }

/* ── Search Results ─────────────────────────────────────────── */
#search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
}
#search-results.open { display: block; }
.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-primary);
}
.search-item:hover { background: var(--bg); }
.search-item .si-icon { font-size: 1.3rem; }
.search-item .si-info { flex: 1; }
.search-item .si-name { font-size: .9rem; font-weight: 600; }
.search-item .si-cat  { font-size: .75rem; color: var(--text-muted); }
.search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: .9rem; }

/* ── Progress / Slider ──────────────────────────────────────── */
input[type=range] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 2px 6px rgba(29,78,216,.4);
  transition: var(--transition);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(29,78,216,.15); }

/* ── Toast Notification ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .calc-page-inner {
    grid-template-columns: 1fr;
  }
  .calc-sidebar { order: -1; display: flex; gap: 16px; flex-wrap: wrap; }
  .sidebar-widget { flex: 1; min-width: 250px; }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  :root { --header-h: 56px; }
  .site-logo .logo-text { display: none; }
  .header-nav { display: none; }
  .hero-banner { padding: 32px 0 28px; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .popular-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {

  .result-box .result-value { font-size: 1.7rem; }
  .popular-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-card { padding: 20px; }
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .site-header, .cat-nav, .site-footer, .ad-slot, .sidebar-widget { display: none; }
  .calc-page-inner { grid-template-columns: 1fr; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fade-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulse-bg { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.fade-in { animation: fade-in .35s ease both; }
.page-loader { animation: pulse-bg 1.5s ease infinite; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 8px;
  background: var(--bg-hover);
  padding: 6px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-primary); /* Increased from secondary */
  opacity: 0.6; /* Higher visibility than pure secondary */
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.tab-panel {
  display: none;
  animation: fade-in 0.3s ease;
}
.tab-panel.active {
  display: block;
}

/* ── Share FAB ───────────────────────────────────────────────── */
.share-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-radius: 50%;
  border: none;
  font-size: 1.4rem;
  box-shadow: 0 4px 20px rgba(29,78,216,.45);
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s cubic-bezier(.175,.885,.32,1.275), box-shadow .3s;
}
.share-fab:hover {
  transform: scale(1.12) translateY(-3px);
  box-shadow: 0 8px 28px rgba(29,78,216,.65);
}
.share-fab:active { transform: scale(.94); }

/* ── Share Modal ─────────────────────────────────────────────── */
.share-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}
.share-overlay.open { display: flex; }
.share-sheet {
  background: var(--card-bg);
  border-radius: 22px 22px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
  animation: slide-up .28s ease;
}
@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.share-sheet h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  color: var(--text-primary);
  font-size: .75rem;
  font-weight: 600;
}
.share-btn:hover { background: var(--bg-secondary); transform: translateY(-3px); }
.share-btn .share-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
/* Individual colors */
.share-btn.whatsapp .share-icon { background: #25D366; color: #fff; }
.share-btn.telegram .share-icon { background: #229ED9; color: #fff; }
.share-btn.twitter  .share-icon { background: #000;    color: #fff; }
.share-btn.email    .share-icon { background: #EA4335; color: #fff; }
.share-btn.facebook .share-icon { background: #1877F2; color: #fff; }
.share-btn.linkedin .share-icon { background: #0A66C2; color: #fff; }
.share-btn.reddit   .share-icon { background: #FF4500; color: #fff; }
.share-btn.copy     .share-icon { background: var(--primary-light); color: var(--primary-dark); }

.share-url-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.share-url-row input {
  flex: 1;
  font-size: .82rem;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.share-close {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.share-close:hover { background: var(--border); color: var(--text-primary); }

@media(max-width:640px) {
  .share-fab { bottom: 20px; right: 20px; width: 50px; height: 50px; font-size: 1.2rem; }
  .share-grid { grid-template-columns: repeat(4,1fr); gap: 10px; }
}

/* ── Hamburger Mobile Menu ───────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: background .2s;
  z-index: 201;
}
.hamburger:hover { background: rgba(255,255,255,.1); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(320px, 85vw);
  height: 100dvh;
  background: var(--bg-card);
  box-shadow: -8px 0 30px rgba(0,0,0,.25);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 72px 0 32px;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.mobile-drawer.open { right: 0; }

.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.mobile-drawer-overlay.open { display: block; }

/* Drawer Links */
.mobile-drawer a,
.mobile-drawer button.mobile-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background .18s;
  border-radius: 0;
}
.mobile-drawer a:hover,
.mobile-drawer button.mobile-nav-btn:hover { background: var(--bg-secondary); color: var(--primary); }

.mobile-drawer-section {
  padding: 12px 24px 6px;
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--primary); /* Changed to primary for better separation */
  margin-top: 12px;
}
.mobile-drawer hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 24px;
}
.mobile-lang-switcher {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  flex-wrap: wrap;
}
.mobile-lang-switcher a {
  padding: 6px 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: 20px !important;
  font-size: .8rem !important;
  width: auto !important;
}
.mobile-lang-switcher a.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Hide hamburger on desktop, show nav normally */
@media (max-width: 640px) {
  .hamburger { display: flex; }
  .header-nav { display: none; }
  .header-search { max-width: none; }
  .site-header .container { gap: 12px; }
}

/* ── Enhanced UI: Next Steps & History ─────────────────────── */
.next-steps-card {
  margin: 32px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.next-steps-card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.ns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.ns-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  transition: var(--transition);
  font-weight: 500;
  font-size: .88rem;
  color: var(--text-primary);
}
.ns-item:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
}
.ns-icon { font-size: 1.2rem; }

/* History Sidebar Trigger */
.history-toggle-btn {
  position: fixed;
  right: 20px;
  bottom: 140px; /* Moved up to avoid overlap */
  width: 54px;
  height: 54px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255,255,255,0.1);
}

/* Floating Share Button (Fab) */
.share-fab {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 54px;
  height: 54px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-lg);
  z-index: 98;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255,255,255,0.1);
}
.share-fab:hover, .history-toggle-btn:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.25);
}
.history-toggle-btn:hover { transform: scale(1.1); }

.history-sidebar {
  position: fixed;
  right: -340px;
  top: 0;
  width: 320px;
  height: 100%;
  background: var(--bg-card);
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  z-index: 1000;
  padding: 24px;
  transition: right .3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.history-sidebar.open { right: 0; }
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item-card {
  display: block;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  transition: var(--transition);
  font-size: .85rem;
  color: var(--text-primary);
}
.history-item-card:hover { 
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.hi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}
.hi-title {
  color: var(--accent) !important;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
}
.hi-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.hi-result {
  font-size: 0.88rem;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.4;
}
.hi-link-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* FAQ Styles */
.faq-section { margin-top: 32px; }
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.faq-question {
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}
.faq-answer {
  padding: 10px 0 16px;
  color: var(--text-secondary);
  font-size: .92rem;
  line-height: 1.6;
}

/* AdSense Smart Placement */
.ad-auto-placement {
  margin: 24px 0;
  min-height: 100px;
  background: rgba(var(--primary-rgb), .03);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}


/* ── Widget Mode (Embed) ────────────────────────────────────── */
.widget-mode body { background: transparent !important; padding: 0 !important; margin: 0 !important; }
.widget-mode .site-header, .widget-mode .site-footer, .widget-mode .breadcrumb, 
.widget-mode .calc-sidebar, .widget-mode article.content-card, .widget-mode .ad-slot,
.widget-mode .history-toggle-btn { display: none !important; }
.widget-mode .calc-page { padding: 0 !important; }
.widget-mode .container { padding: 0 !important; max-width: none !important; }
.widget-mode .calc-page-inner { grid-template-columns: 1fr !important; gap: 0 !important; }
.widget-mode .calc-widget { border: none !important; box-shadow: none !important; border-radius: 0 !important; margin: 0 !important; }

/* ── Embed UI ───────────────────────────────────────────────── */
.embed-section {
  margin: 24px 0;
  padding: 18px;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.embed-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; color: var(--text-primary); }
.embed-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; }

.embed-modal-overlay {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  z-index: 2000; display: none; align-items: center; justify-content: center;
}
.embed-modal-overlay.open { display: flex; }
.embed-modal {
  background: var(--bg-card);
  width: 100%; max-width: 500px;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.embed-modal .close { position: absolute; right: 20px; top: 15px; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.embed-code-area {
  width: 100%; height: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 15px;
  resize: none;
}
.embed-copy-btn { margin-top: 15px; width: 100%; }

/* PWA Banner */
.pwa-banner { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: 95%; max-width: 500px; z-index: 10000; background: rgba(29, 78, 216, 0.95); backdrop-filter: blur(12px); color: white; border-radius: 16px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1); animation: pwaSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pwaSlideUp { from { transform: translate(-50%, 100%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.pwa-banner-inner { display: flex; align-items: center; gap: 16px; }
.pwa-icon { font-size: 2rem; }
.pwa-text { flex: 1; }
.pwa-title { font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.pwa-desc { font-size: 0.8rem; opacity: 0.9; }
.pwa-actions { display: flex; align-items: center; gap: 12px; }
.pwa-close { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; opacity: 0.6; }
.pwa-close:hover { opacity: 1; }
@media (max-width: 600px) { .pwa-banner { bottom: 10px; padding: 12px; width: 90%; } .pwa-desc { display: none; } }

