/* ==========================================================================
   ProRataCalculator.online - Global Stylesheet
   Pure CSS3, Modern Fintech UI/UX Design System (Zero Frameworks, Ultra-Fast)
   ========================================================================== */

/* -----------------------------
   Design Tokens & Variables
   ----------------------------- */
:root {
  /* Brand Colors */
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-active: #0d47a1;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-glow: rgba(26, 115, 232, 0.18);

  /* Neutrals & Surfaces */
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-elevated: #ffffff;
  --body-bg: #f8fafd;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-subtle: #edf2f7;

  /* Typography Colors */
  --text-main: #0f172a;
  --text-body: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Accent & Highlight */
  --accent: #eff6ff;
  --success-bg: #ecfdf5;
  --success-surface: #f0fdf4;
  --success-text: #065f46;
  --success-border: #a7f3d0;
  --success-badge: #10b981;

  /* Border Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Modern Layered Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 5px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 20px -3px rgba(15, 23, 42, 0.08), 0 3px 7px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.1), 0 5px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 48px -8px rgba(26, 115, 232, 0.15);

  /* Typography & Transitions */
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  --transition-fast: all 0.15s ease;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  --container-max: 1120px;
}

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

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

body {
  font-family: var(--font-stack);
  background-color: var(--body-bg);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, svg {
  vertical-align: middle;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.35rem; }
h2 { font-size: 1.75rem; margin-top: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-top: 1.25rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; color: var(--text-body); }
p.lead { font-size: 1.15rem; color: var(--text-muted); line-height: 1.6; }

/* -----------------------------
   Layout Container
   ----------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.main-content {
  flex: 1 0 auto;
  padding-bottom: 4.5rem;
}

/* -----------------------------
   Modern Sticky Glassmorphism Header
   ----------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

.site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.logo-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  font-size: 1.35rem;
  box-shadow: var(--shadow-xs);
}

.logo-text-highlight {
  color: var(--primary);
}

.main-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.65rem;
  align-items: center;
}

.nav-link {
  font-size: 0.935rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}

/* Hybrid nav labels: short on desktop, full on mobile */
.nav-short { display: inline; }
.nav-full  { display: none; }

/* Mobile Toggle */
.nav-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: var(--text-main);
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-fast);
}

.nav-toggle:hover {
  background-color: var(--surface-alt);
  border-color: var(--border-hover);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* -----------------------------
   Hero Section
   ----------------------------- */
.hero {
  padding: 3rem 0 2rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.95rem;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-pill);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: 2.65rem;
  font-weight: 850;
  color: var(--text-main);
  letter-spacing: -0.03em;
  margin-bottom: 0.85rem;
  line-height: 1.15;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto;
  line-height: 1.6;
}

.breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb-separator {
  color: #cbd5e1;
}

/* -----------------------------
   Trust Banner
   ----------------------------- */
.trust-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.75rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* -----------------------------
   Calculator Card Component Layout
   ----------------------------- */
.calculator-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem;
  margin-bottom: 3rem;
  position: relative;
  transition: box-shadow 0.25s ease;
}

.calculator-card:hover {
  box-shadow: var(--shadow-lg);
}

.calc-grid, .calc-grid-full {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.25rem;
  align-items: start;
}

/* Form Controls */
.calc-form {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.form-hint {
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-group {
  position: relative;
  display: flex;
  align-items: stretch;
}

.input-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  background-color: var(--surface-alt);
  border: 1px solid #cbd5e1;
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
  min-width: 48px;
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 1.025rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--surface);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  transition: var(--transition-fast);
}

.input-group .form-control {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
  background-color: #ffffff;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-main);
}

.form-check input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

/* Quick presets buttons */
.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.4rem;
  align-items: center;
}

.preset-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.75rem;
  font-family: inherit;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.preset-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  transform: translateY(-1px);
}

/* -----------------------------
   Results Display Card
   ----------------------------- */
.results-card {
  background-color: #fafcfe;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.65rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  box-shadow: var(--shadow-xs);
}

.result-hero {
  background: linear-gradient(135deg, var(--success-bg) 0%, var(--success-surface) 100%);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.result-hero-label {
  font-size: 0.8rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--success-text);
  margin-bottom: 0.35rem;
}

.result-hero-value {
  font-size: 2.35rem;
  font-weight: 850;
  color: var(--success-text);
  line-height: 1.1;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.25rem 0.6rem;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.breakdown-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.breakdown-label {
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.breakdown-value {
  font-weight: 750;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  font-size: 1.025rem;
}

.formula-callout {
  background-color: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.15rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
}

.formula-callout-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
}

.formula-callout-text {
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Consolas, Menlo, Monaco, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  word-break: break-all;
}

/* -----------------------------
   Dedicated Calculators Hub Cards
   ----------------------------- */
.tools-section {
  padding: 1.5rem 0 3.25rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tool-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, #60a5fa 100%);
  opacity: 0;
  transition: var(--transition);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #bfdbfe;
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
  background-color: var(--primary-light);
  color: var(--primary);
  margin-bottom: 1rem;
}

.tool-card-icon {
  font-size: 2.35rem;
  line-height: 1;
  margin-bottom: 0.85rem;
}

.tool-card h3 {
  font-size: 1.3rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-weight: 750;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.tool-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.tool-card-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
  gap: 0.75rem;
}

/* -----------------------------
   How It Works 3-Step Visual
   ----------------------------- */
.how-steps-section {
  padding: 2.75rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 2.25rem;
}

.section-title h2 {
  font-size: 1.95rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.section-title p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.step-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.step-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  font-size: 1.85rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.step-card h3 {
  font-size: 1.2rem;
  margin-top: 0;
  margin-bottom: 0.6rem;
  color: var(--text-main);
  font-weight: 750;
}

.step-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.55;
  margin-bottom: 0;
}

/* -----------------------------
   Country-Specific Information Cards
   ----------------------------- */
.country-section {
  padding: 2.75rem 0;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.65rem;
}

.country-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.country-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: #cbd5e1;
  border-top-color: var(--primary-hover);
}

.country-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.country-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.country-flag {
  font-size: 2.35rem;
  line-height: 1;
}

.country-flag-img {
  width: 40px;
  height: auto;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
  object-fit: cover;
  flex-shrink: 0;
}

.twemoji-flag {
  width: 40px !important;
  height: 40px !important;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
  object-fit: cover;
  flex-shrink: 0;
  vertical-align: middle;
}

.country-name {
  font-weight: 800;
  font-size: 1.3rem;
  margin: 0;
  color: var(--text-main);
}

.country-law-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.country-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.country-metric-box {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.country-metric-label {
  font-size: 0.775rem;
  font-weight: 650;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  display: block;
}

.country-metric-value {
  font-size: 1.2rem;
  font-weight: 850;
  color: var(--text-main);
  display: block;
}

.country-rule-callout {
  background-color: #fafcfe;
  border-left: 3.5px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.95rem 1.15rem;
  font-size: 0.9rem;
  color: var(--text-body);
  line-height: 1.55;
}

.country-rule-callout strong {
  color: var(--primary);
  display: block;
  font-size: 0.825rem;
  font-weight: 750;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.country-rule-callout p {
  margin: 0;
  color: #334155;
}

/* -----------------------------
   FAQ Accordion Section
   ----------------------------- */
.faq-section {
  padding: 3rem 0 1.5rem;
}

.faq-list {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.faq-item {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-fast);
}

.faq-item:hover {
  border-color: #cbd5e1;
}

.faq-item.open {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition-fast);
}

.faq-question:hover {
  color: var(--primary);
}

.faq-chevron {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  flex-shrink: 0;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.65;
}

.faq-item.open .faq-answer {
  padding-bottom: 1.35rem;
}

.faq-answer p {
  margin-bottom: 0.75rem;
  color: #334155;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* -----------------------------
   Content Articles & Comparison Tables
   ----------------------------- */
.article-container {
  max-width: 860px;
  margin: 0 auto;
}

.content-box {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2.5rem;
  margin-bottom: 2.5rem;
}

.content-box h2 {
  font-size: 1.65rem;
  margin-top: 2rem;
  margin-bottom: 0.85rem;
}

.content-box h2:first-child {
  margin-top: 0;
}

.content-box h3 {
  font-size: 1.25rem;
  margin-top: 1.4rem;
  margin-bottom: 0.5rem;
}

.content-box ul, .content-box ol {
  margin-bottom: 1.35rem;
  padding-left: 1.65rem;
  color: var(--text-body);
}

.content-box li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Responsive Modern Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background-color: var(--surface-alt);
  color: var(--text-main);
  font-weight: 750;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:nth-child(even) {
  background-color: #fafcfe;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: #eff6ff;
}

/* Call to action card */
.cta-box {
  background: linear-gradient(135deg, var(--primary-light) 0%, #e0edff 100%);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin: 2.5rem 0;
  box-shadow: var(--shadow-sm);
}

.cta-box h3 {
  font-size: 1.55rem;
  margin-top: 0;
  margin-bottom: 0.6rem;
  color: var(--primary);
  font-weight: 800;
}

.cta-box p {
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 1.35rem;
  font-size: 1.025rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.975rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.35);
  transition: var(--transition);
}

.btn:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(26, 115, 232, 0.45);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
}

/* -----------------------------
   Footer
   ----------------------------- */
.site-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.75rem;
  margin-top: auto;
  font-size: 0.925rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.35rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.footer-tagline {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.75rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--primary);
  text-decoration: none;
}

.footer-bottom {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* -----------------------------
   Responsive Breakpoints
   ----------------------------- */
@media (max-width: 900px) {
  .calc-grid, .calc-grid-full {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  
  .country-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  /* Mobile drawer: show full names, hide short labels */
  .nav-short { display: none; }
  .nav-full  { display: inline; }

  .main-nav {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem 1.5rem 1.75rem;
    display: none;
    flex-direction: column;
    z-index: 999;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-link {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

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

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

  .country-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .country-metrics {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .calculator-card {
    padding: 1.5rem;
  }

  .content-box {
    padding: 1.75rem 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------
   Geo Personalization Badge
   ----------------------------- */
.geo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.45rem 1rem 0.45rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
  animation: fadeSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.geo-badge strong {
  color: var(--text-main);
  font-weight: 700;
}

.geo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-badge);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  animation: geoPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.geo-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 0 0.2rem;
  line-height: 1;
  margin-left: 0.25rem;
  transition: var(--transition-fast);
}

.geo-dismiss:hover {
  color: var(--text-muted);
}

@keyframes geoPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
  50%       { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.05); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Highlighted country card for detected location */
.country-card.geo-match {
  border-top-color: var(--success-badge);
  box-shadow: var(--shadow-md), 0 0 0 2px rgba(16, 185, 129, 0.15);
  position: relative;
}

.country-card.geo-match::after {
  content: '📍 Your Location';
  position: absolute;
  top: -1px;
  right: 1rem;
  background: var(--success-badge);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  letter-spacing: 0.03em;
}

/* -----------------------------
   Mobile Nav Slide Animation
   ----------------------------- */
@media (max-width: 768px) {
  .main-nav {
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                display 0s 0.22s;
    display: flex !important; /* override display:none so transition works */
  }

  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

/* -----------------------------
   Copy Result Button
   ----------------------------- */
.copy-result-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.35rem 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--success-text);
  cursor: pointer;
  transition: var(--transition-fast);
  backdrop-filter: blur(4px);
}

.copy-result-btn:hover {
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.copy-result-btn.copied {
  color: var(--success-badge);
  border-color: var(--success-badge);
}

/* -----------------------------
   Dark Mode
   ----------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-active: #bfdbfe;
    --primary-light: #1e3a5f;
    --primary-border: #2d5a8e;
    --primary-glow: rgba(96, 165, 250, 0.2);

    --surface: #1e2433;
    --surface-alt: #161b2a;
    --surface-elevated: #252d3d;
    --body-bg: #111827;
    --border: #2d3748;
    --border-hover: #4a5568;
    --border-subtle: #1f2937;

    --text-main: #f1f5f9;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --accent: #1e3a5f;
    --success-bg: #064e3b;
    --success-surface: #065f46;
    --success-text: #6ee7b7;
    --success-border: #065f46;
    --success-badge: #34d399;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 20px -3px rgba(0, 0, 0, 0.4), 0 3px 7px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 32px -4px rgba(0, 0, 0, 0.5), 0 5px 12px -2px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 24px 48px -8px rgba(96, 165, 250, 0.2);
  }

  .site-header {
    background-color: rgba(30, 36, 51, 0.94);
  }

  .site-header.scrolled {
    background-color: rgba(30, 36, 51, 0.98);
  }

  .main-nav {
    background-color: rgba(30, 36, 51, 0.98);
  }

  .form-control,
  .form-select {
    background-color: var(--surface-alt);
    border-color: var(--border);
    color: var(--text-main);
  }

  .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-color: var(--surface-alt);
  }

  .input-prefix {
    background-color: var(--surface-alt);
    border-color: var(--border);
    color: var(--text-muted);
  }

  .results-card {
    background-color: var(--surface-alt);
  }

  .formula-callout {
    background-color: var(--primary-light);
  }

  .country-metric-box {
    background-color: var(--surface-alt);
  }

  .country-rule-callout {
    background-color: var(--surface-alt);
  }

  .country-rule-callout p {
    color: var(--text-body);
  }

  .faq-answer p {
    color: var(--text-body);
  }

  .data-table th {
    background-color: var(--surface-alt);
  }

  .data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
  }

  .data-table tbody tr:hover {
    background-color: var(--primary-light);
  }

  .site-footer {
    background-color: var(--surface);
  }

  .copy-result-btn {
    background: rgba(6, 78, 59, 0.5);
    color: var(--success-text);
  }

  .copy-result-btn:hover {
    background: rgba(6, 78, 59, 0.8);
  }
}
