/* ===========================
   1099TaxEstimator.tax — Main Stylesheet
   Optimized for Core Web Vitals (LCP < 2.0s, CLS < 0.1, INP < 200ms)
   =========================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);
}

/* CLS prevention: explicit dimensions on all sized elements */
img, svg { width: auto; height: auto; max-width: 100%; display: block; }

/* ===========================
   Typography
   =========================== */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h2, h3 { line-height: 1.25; }

/* ===========================
   Layout utilities
   =========================== */
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ===========================
   Calculator Grid
   =========================== */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) { .calculator-grid { grid-template-columns: 1fr; } }

/* ===========================
   Cards
   =========================== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card h2 .icon {
  width: 28px; height: 28px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ===========================
   Form Elements
   =========================== */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: .875rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.label-hint { font-weight: 400; color: var(--text-muted); font-size: .78rem; }

.input-wrap { position: relative; }
.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-weight: 600; font-size: 1rem; pointer-events: none;
}

input[type="number"], select {
  width: 100%;
  padding: .65rem .85rem .65rem 2rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
  /* CLS: ensure consistent height */
  min-height: 44px;
}
select { padding-left: .85rem; }
input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* INP: hardware-accelerated button transitions */
.btn {
  width: 100%; padding: .875rem 1.5rem;
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-top: .5rem;
  /* min touch target for INP */
  min-height: 48px;
  will-change: background;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { opacity: .92; }

.btn-secondary {
  background: transparent; color: var(--text-muted);
  border: 2px solid var(--border);
  margin-top: .5rem; font-size: .875rem; font-weight: 600;
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }

/* ===========================
   Results Panel
   =========================== */
#results-panel { position: sticky; top: 80px; }

.results-placeholder {
  background: var(--white); border-radius: var(--radius);
  padding: 3rem 1.5rem; text-align: center; color: var(--text-muted);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.results-placeholder .big-icon { font-size: 3rem; margin-bottom: 1rem; }
.results-placeholder p { font-size: .9rem; }

.result-section { margin-bottom: 1.5rem; }
.result-section h3 {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  margin-bottom: .75rem; padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem 0; font-size: .9rem;
}
.result-row .label { color: var(--text-muted); }
.result-row .value { font-weight: 600; color: var(--text); }
.result-row.highlight {
  background: var(--primary-light); margin: 0 -.75rem;
  padding: .6rem .75rem; border-radius: 8px;
}
.result-row.highlight .label { color: var(--primary); font-weight: 600; }
.result-row.highlight .value { color: var(--primary); font-size: 1.05rem; }
.result-row.danger .value { color: var(--danger); }
.result-row.success .value { color: var(--success); }

.take-home-box {
  background: linear-gradient(135deg,#16a34a,#15803d);
  color: white; border-radius: 10px; padding: 1.25rem;
  text-align: center; margin-bottom: 1.5rem;
}
.take-home-box .label-sm { font-size: .8rem; opacity: .85; margin-bottom: .25rem; }
.take-home-box .amount { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.take-home-box .per-month { font-size: .85rem; opacity: .8; margin-top: .25rem; }

.quarterly-box {
  background: linear-gradient(135deg,#d97706,#b45309);
  color: white; border-radius: 10px; padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
}
.quarterly-box .q-icon { font-size: 1.75rem; }
.quarterly-box .q-label { font-size: .8rem; opacity: .9; }
.quarterly-box .q-amount { font-size: 1.35rem; font-weight: 800; }

.tax-bar-wrap { margin: 1.25rem 0; }
.tax-bar-label {
  display: flex; justify-content: space-between;
  font-size: .78rem; color: var(--text-muted); margin-bottom: .3rem;
}
.tax-bar-track { height: 10px; background: var(--border); border-radius: 100px; overflow: hidden; }
.tax-bar-fill {
  height: 100%; border-radius: 100px;
  background: linear-gradient(90deg,var(--primary),var(--accent));
  /* INP: GPU-accelerated transition */
  transition: width .4s ease;
  will-change: width;
}

/* ===========================
   Info & Definition Boxes
   =========================== */
.info-box {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: .85rem 1rem;
  font-size: .825rem; color: #92400e;
  margin-top: 1rem; line-height: 1.5;
}
.info-box strong { color: #78350f; }

.definition-box {
  background: var(--primary-light); border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: 8px; padding: 1rem 1.25rem;
  font-size: .925rem; color: #1e3a8a; line-height: 1.65;
}

.ad-placeholder {
  background: var(--bg); border: 2px dashed var(--border);
  border-radius: 8px; padding: 1.5rem; text-align: center;
  color: var(--text-muted); font-size: .8rem; margin: 1.5rem 0;
  /* CLS: explicit min-height prevents layout shift when ad loads */
  min-height: 90px; display: flex; align-items: center; justify-content: center;
}

/* ===========================
   Section headings
   =========================== */
.section-title {
  font-size: 1.5rem; font-weight: 800; text-align: center;
  margin-bottom: .5rem; color: var(--text);
}
.section-sub {
  text-align: center; color: var(--text-muted);
  margin-bottom: 2rem; font-size: .95rem;
}

/* ===========================
   Set-Aside Section
   =========================== */
.featured-answer {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-left: 4px solid var(--success);
  border-radius: 8px; padding: 1rem 1.25rem;
  font-size: .95rem; color: #14532d; line-height: 1.7;
  margin-bottom: 1.5rem;
}

.setaside-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
  margin-top: 1.5rem;
}
@media (max-width: 640px) { .setaside-grid { grid-template-columns: 1fr; } }

.setaside-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; text-align: center;
  box-shadow: var(--shadow);
}
.setaside-card.highlight-card {
  border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.setaside-label {
  font-size: .75rem; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem;
}
.setaside-income { font-size: .95rem; color: var(--text-muted); margin-bottom: .75rem; }
.setaside-pct { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: .5rem; }
.setaside-breakdown { font-size: .78rem; color: var(--text-muted); }

/* ===========================
   Quarterly Dates
   =========================== */
.dates-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.5rem;
}
@media (max-width: 768px) { .dates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .dates-grid { grid-template-columns: 1fr; } }

.date-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
  box-shadow: var(--shadow);
}
.date-card-active {
  border-color: var(--warning); background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(217,119,6,.2);
}
.date-now { font-size: .7rem; font-weight: 700; color: var(--warning); margin-bottom: .25rem; }
.date-quarter { font-size: .8rem; color: var(--text-muted); font-weight: 600; margin-bottom: .35rem; }
.date-due { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: .35rem; }
.date-covers { font-size: .75rem; color: var(--text-muted); }

/* ===========================
   Tax Tables
   =========================== */
.table-wrap {
  overflow-x: auto; margin-top: 1.5rem;
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  /* CLS: prevent layout shift */
  min-height: 200px;
}
.tax-table, .compare-table {
  width: 100%; border-collapse: collapse;
  font-size: .875rem; background: var(--white);
}
.tax-table th, .compare-table th {
  background: #1e40af; color: white; padding: .75rem 1rem;
  font-size: .78rem; font-weight: 700; text-align: left;
  white-space: nowrap;
}
.tax-table td, .compare-table td {
  padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text);
}
.tax-table tr:last-child td, .compare-table tr:last-child td { border-bottom: none; }
.tax-table tr:nth-child(even) td, .compare-table tr:nth-child(even) td { background: var(--bg); }
.row-highlight td { background: var(--primary-light) !important; }

/* ===========================
   Steps
   =========================== */
.steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 1.5rem;
}
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }

.step { text-align: center; padding: 1.5rem 1rem; }
.step-num {
  width: 48px; height: 48px; background: var(--primary-light);
  color: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 800; margin: 0 auto 1rem;
}
.step h3 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; }
.step p { font-size: .85rem; color: var(--text-muted); }

/* ===========================
   Stats Section — GEO
   =========================== */
.stats-section { margin: 2.5rem 0; }
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 1.5rem;
}
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; text-align: center;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 1.75rem; font-weight: 800; color: var(--primary); margin-bottom: .4rem; }
.stat-label { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* ===========================
   FAQ — AEO Optimized
   =========================== */
.faq-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }

.faq-item {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.faq-q {
  font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: .65rem;
  line-height: 1.4;
}
.faq-a p { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }
.faq-a strong { color: var(--text); }

/* ===========================
   Footer
   =========================== */
footer {
  background: #111827; color: #9ca3af; padding: 2.5rem 1.5rem; text-align: center;
}
footer .footer-inner { max-width: 1100px; margin: 0 auto; }
footer .footer-links {
  display: flex; gap: 1.5rem; justify-content: center;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
footer .footer-links a { color: #9ca3af; font-size: .875rem; }
footer .footer-links a:hover { color: white; text-decoration: none; }
footer .disclaimer {
  font-size: .775rem; color: #6b7280; max-width: 720px;
  margin: .75rem auto 0; line-height: 1.6;
}
