/* ═══════════════════════════════════════════════
   YieldsHub — Shared Design System
   Used by all calculator pages
   ═══════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── DESIGN TOKENS ── */
:root {
  --bg:            #f8f9fb;
  --surface:       #ffffff;
  --surface2:      #f1f3f7;
  --border:        #e2e6ef;
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --accent:        #10b981;
  --accent-light:  #ecfdf5;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --warning-light: #fffbeb;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.10);
}

/* ── BASE ── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo-row {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px 10px;
}
.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -1px;
  line-height: 1;
  display: inline-block;
}
.logo span { color: var(--accent); }
@media (max-width: 400px) { .logo { font-size: 1.5rem; } }

.header-nav-row {
  border-top: 1px solid var(--border);
}

/* ── HEADER NAV & DROPDOWN ── */
.header-nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dropdown { position: relative; display: inline-block; }

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.01em;
}
.dropdown-toggle:hover { background: var(--primary-dark); }

.dropdown-arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
  display: inline-block;
  opacity: 0.85;
}
.dropdown.open .dropdown-arrow { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.14);
  min-width: 260px;
  z-index: 300;
  padding: 10px 0;
}
.dropdown.open .dropdown-menu { display: flex; animation: fadeUp 0.15s ease; }

.menu-section-label {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  padding: 4px 16px 8px;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.dropdown-menu a:hover  { background: var(--primary-light); color: var(--primary); }
.dropdown-menu a.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }

.menu-icon { font-size: 0.95rem; width: 20px; text-align: center; flex-shrink: 0; }
.menu-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ── AD BANNER TOP ── */
.ad-banner {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 10px;
  font-size: 0.75rem;
  color: var(--text-light);
}
.ad-placeholder {
  display: inline-block;
  background: #e8edf5;
  border: 1px dashed #c5cfe0;
  border-radius: 6px;
  padding: 12px 24px;
  color: var(--text-light);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
  color: white;
  text-align: center;
  padding: 30px 20px 26px;
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.hero p {
  font-size: 1.05rem;
  opacity: 0.88;
  max-width: 540px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 14px;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}

/* ── MAIN LAYOUT ── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}
@media (max-width: 820px) { .main { grid-template-columns: 1fr; } }

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
}

/* ── SECTION LABEL ── */
.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── FORM FIELDS ── */
.field { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.field input,
.field select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
  appearance: none;
}
.field input:focus,
.field select:focus { border-color: var(--primary); }
.field input.error  { border-color: var(--danger); }

/* Input with prefix/suffix icon */
.input-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.84rem;
  color: var(--text-muted);
  pointer-events: none;
}
.input-suffix {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.84rem;
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrap input { padding-left: 22px; }
.input-wrap.has-suffix input { padding-right: 28px; }

/* ── FORM GRID ── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 600px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: 1fr; }
}

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── TOGGLE ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.toggle-row .toggle-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.toggle-row .toggle-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }

/* ── BUTTONS ── */
.calc-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
  font-family: inherit;
}
.calc-btn:hover  { background: var(--primary-dark); }
.calc-btn:active { transform: scale(0.99); }

.outline-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.outline-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.quick-btns { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.quick-btn {
  background: var(--primary-light);
  border: 1.5px solid #bfdbfe;
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.quick-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── RESULTS ── */
.results-section { display: none; }

/* ── SUMMARY BAR ── */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.summary-bar-2 { grid-template-columns: repeat(2, 1fr) !important; }
.summary-bar-4 { grid-template-columns: repeat(4, 1fr) !important; }
@media (max-width: 500px) {
  .summary-bar,
  .summary-bar-4 { grid-template-columns: 1fr 1fr !important; }
}
.summary-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 14px;
}
.summary-item .s-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.summary-item .s-value { font-size: 1rem; font-weight: 700; color: var(--text); margin-top: 2px; }
.summary-item .s-value.green { color: var(--accent); }
.summary-item .s-value.blue  { color: var(--primary); }
.summary-item .s-value.red   { color: var(--danger); }

/* ── TABS ── */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── CHART WRAP ── */
.chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 8px;
}
.chart-wrap-tall { height: 340px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; margin-top: 8px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
th {
  text-align: left;
  padding: 9px 12px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child  { border-radius: 0 8px 8px 0; }
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── SIDEBAR ── */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

/* ── TIP / INFO BOXES ── */
.tip-box {
  background: var(--accent-light);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 16px;
}
.tip-box h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.tip-box ul {
  padding-left: 16px;
  font-size: 0.84rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px;
}
.info-box h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.warn-box {
  background: var(--warning-light);
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 14px 16px;
}
.warn-box h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ── AFFILIATE CTA ── */
.affiliate-box {
  background: linear-gradient(135deg, #fefce8, #fff7ed);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px;
}
.affiliate-box h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
}
.affiliate-box p { font-size: 0.82rem; color: #78350f; margin-bottom: 12px; }
.affiliate-btn {
  display: inline-block;
  background: #d97706;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s;
}
.affiliate-btn:hover { background: #b45309; }

/* ── BADGE / PILL ── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-blue   { background: var(--primary); color: white; }
.badge-green  { background: var(--accent);  color: white; }
.badge-yellow { background: var(--warning); color: white; }
.badge-red    { background: var(--danger);  color: white; }

/* ── UTILITY ── */
.error-msg {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 8px;
  display: none;
}
.text-green  { color: var(--accent); }
.text-blue   { color: var(--primary); }
.text-red    { color: var(--danger); }
.text-muted  { color: var(--text-muted); }
.font-bold   { font-weight: 700; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-12       { margin-top: 12px; }
.mt-16       { margin-top: 16px; }
.mb-4        { margin-bottom: 4px; }
.mb-8        { margin-bottom: 8px; }
.mb-12       { margin-bottom: 12px; }
.mb-16       { margin-bottom: 16px; }

/* ── FADE-IN ANIMATION ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.35s ease both; }

/* ── SEO CONTENT SECTION ── */
.seo-content {
  max-width: 1100px;
  margin: 0 auto 48px;
  padding: 0 20px;
}
.seo-content h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.seo-content h3 { font-size: 1rem; font-weight: 700; margin: 20px 0 8px; color: var(--text); }
.seo-content p  { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; max-width: 720px; }
.seo-content ul { padding-left: 20px; font-size: 0.9rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; max-width: 720px; }

/* ── FOOTER ── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  font-size: 0.8rem;
  color: var(--text-light);
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--primary); }

/* ══════════════════════════════════════════════
   MOBILE FIRST — phones ≤ 480px
   Critical: inputs must be 16px to prevent
   iOS Safari from auto-zooming on tap.
   ══════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* Prevent iOS auto-zoom on input tap */
  .field input,
  .field select { font-size: 16px; padding: 11px 10px; }
  .input-wrap input { padding-left: 22px; }
  .input-wrap.has-suffix input { padding-right: 28px; }

  /* More tap-friendly buttons */
  .calc-btn { padding: 16px; font-size: 1rem; }
  .tab-btn  { font-size: 0.8rem; padding: 7px 11px; }
  .quick-btn { font-size: 0.73rem; padding: 5px 10px; }

  /* Tighter card & layout padding */
  .card { padding: 16px; }
  .main { padding: 14px 12px; gap: 16px; }

  /* Smaller chart height so it fits without scrolling */
  .chart-wrap      { height: 210px; }
  .chart-wrap-tall { height: 260px; }

  /* Tighter summary bar text */
  .summary-item { padding: 8px 10px; }
  .summary-item .s-value { font-size: 0.9rem; }
  .summary-item .s-label { font-size: 0.68rem; }

  /* Tables scroll but shrink text slightly */
  td, th { padding: 7px 8px; font-size: 0.8rem; }

  /* Footer links stack tighter */
  .footer-links { gap: 10px; }

  /* Dropdown menu full-width on small screens */
  .dropdown-menu { min-width: 220px; }
}

/* ── PRINT ── */
@media print {
  .ad-banner, .sidebar, .calc-btn, .outline-btn, .quick-btns, header nav { display: none !important; }
  .main { grid-template-columns: 1fr !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  body  { background: white; }
  .hero { background: #1e40af; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
