/* FeeWiseCalc Production Stylesheet - 100% Standalone (No External CDN Required) */
:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-dark: #0f172a;
  --bg-indigo-deep: #1e1b4b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --emerald: #047857;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;
  --rose: #e11d48;
  --rose-bg: #fff1f2;
  --rose-border: #fecdd3;
  --amber-bg: #fffbeb;
  --amber-border: #fcd34d;
  --amber-text: #92400e;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Strict SVG sizing so icons never expand uncontrollably */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  max-width: 100%;
}
.w-3\.5 { width: 14px; height: 14px; }
.w-4 { width: 16px; height: 16px; }
.w-5 { width: 20px; height: 20px; }
.w-6 { width: 24px; height: 24px; }

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

.hidden {
  display: none !important;
}

/* Layout Containers */
.container {
  max-width: 1160px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}
@media (min-width: 640px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* Header & Navigation */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  font-family: inherit;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.brand-title span {
  color: var(--primary);
}

.badge-rates {
  display: none;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
@media (min-width: 640px) {
  .badge-rates {
    display: inline-block;
  }
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
}
@media (min-width: 820px) {
  .desktop-nav {
    display: flex;
  }
}

.mobile-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}
@media (min-width: 820px) {
  .mobile-nav {
    display: none;
  }
}

.nav-btn, .nav-link {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.nav-btn:hover, .nav-link:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.nav-btn.active-nav, .nav-link.active-nav {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.currency-select {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-muted);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}

.ads-toggle-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--amber-border);
  background: var(--amber-bg);
  color: var(--amber-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f59e0b;
  display: inline-block;
}
.dot-indicator.off {
  background: #94a3b8;
}

/* AdSense Placement Preview Boxes */
.ad-slot-box {
  transition: all 0.2s ease;
}
.ad-banner-inner {
  width: 100%;
  border-radius: var(--radius-md);
  border: 2px dashed var(--amber-border);
  background: var(--amber-bg);
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--amber-text);
}
.ad-badge {
  background: #fde68a;
  color: #78350f;
  font-weight: 800;
  font-size: 0.65rem;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* Hero Section */
.hero-box {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 24px auto;
}
.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin: 0 0 8px 0;
  line-height: 1.25;
}
@media (min-width: 640px) {
  .hero-title {
    font-size: 2.3rem;
  }
}
.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

/* Calculator Tool Switcher Tabs */
.tool-tabs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: #e2e8f0;
  padding: 6px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
@media (min-width: 640px) {
  .tool-tabs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 960px) {
  .tool-tabs-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.tool-tab-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 11px;
  padding: 11px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
}
.tool-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
}
.tool-tab-btn.active-tool {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

/* Main Calculator 2-Column Layout */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 32px;
}
@media (min-width: 992px) {
  .calc-layout {
    grid-template-columns: 7fr 5fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
@media (min-width: 640px) {
  .card {
    padding: 26px;
  }
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 3px 0 0 0;
}

.btn-secondary {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-secondary:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-primary {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
  text-decoration: none;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

/* Form Controls */
.field-group {
  margin-bottom: 18px;
}
.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.amount-input-wrap {
  position: relative;
}
.currency-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.15rem;
  font-weight: 800;
  color: #94a3b8;
  pointer-events: none;
}
.input-lg {
  width: 100%;
  padding: 12px 14px 12px 38px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input-lg:focus, .input-std:focus, .select-std:focus, .textarea-std:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.input-std, .select-std, .textarea-std {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-family: inherit;
}

.quick-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.preset-amount-btn {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-amount-btn:hover, .preset-amount-btn.active-preset {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.grid-3-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
@media (min-width: 560px) {
  .grid-3-cols {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid-2-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (min-width: 560px) {
  .grid-2-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

.toggle-row {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.checkbox-lg {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Affiliate Partner Box */
.affiliate-box {
  background: linear-gradient(135deg, #eef2ff 0%, #ecfdf5 100%);
  border: 1px solid var(--primary-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Right Column: Live Payout Cards */
.result-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.res-card-net {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  border-radius: 12px;
  padding: 14px;
}
.res-card-fee {
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
  border-radius: 12px;
  padding: 14px;
}
.res-label-net {
  font-size: 0.75rem;
  font-weight: 700;
  color: #065f46;
  display: block;
}
.res-val-net {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--emerald);
  display: block;
  margin: 4px 0 2px 0;
}
.res-sub-net {
  font-size: 0.72rem;
  font-weight: 600;
  color: #065f46;
  display: block;
}
.res-label-fee {
  font-size: 0.75rem;
  font-weight: 700;
  color: #9f1239;
  display: block;
}
.res-val-fee {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--rose);
  display: block;
  margin: 4px 0 2px 0;
}
.res-sub-fee {
  font-size: 0.72rem;
  font-weight: 600;
  color: #9f1239;
  display: block;
}

/* Reverse Invoice Highlight Box */
.reverse-box {
  background: var(--bg-indigo-deep);
  color: #ffffff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}
.reverse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.reverse-tag {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a5b4fc;
}
.reverse-pill {
  font-size: 0.68rem;
  font-weight: 700;
  background: #312e81;
  color: #e0e7ff;
  padding: 2px 8px;
  border-radius: 6px;
}
.reverse-amount {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fcd34d;
}
.copy-link-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: #c7d2fe;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.copy-link-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Pure SVG Donut & Stacked Bar Chart Container */
.chart-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

/* Comparison Table */
.table-wrap {
  overflow-x: auto;
}
.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.comp-table th {
  text-align: left;
  padding: 12px 10px;
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.comp-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}
.comp-table tr:hover td {
  background: #f8fafc;
}

/* Directory Cards for Multi-Page SEO Internal Linking */
.seo-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (min-width: 640px) {
  .seo-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 960px) {
  .seo-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.seo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.seo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}
.seo-card h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}
.seo-card p {
  margin: 0 0 12px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.seo-card-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

/* Prose / Article Styling for SEO Guides */
.prose-box h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--text-main);
}
.prose-box h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 22px;
  margin-bottom: 8px;
  color: var(--text-main);
}
.prose-box p, .prose-box li {
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.formula-banner {
  background: var(--bg-dark);
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  padding: 14px 18px;
  border-radius: 10px;
  margin: 12px 0;
  overflow-x: auto;
}
.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}
@media (min-width: 700px) {
  .faq-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.faq-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}
.faq-item h4 {
  margin: 0 0 6px 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}
.faq-item p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 32px 0;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}
@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
  }
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* Toast Notification */
.toast-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
  background: var(--bg-dark);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
