/* Pagina "Calcolatore del risparmio fiscale": due sezioni (deduzione/detrazione) con card
   informative e calcolatori. Classi prefissate tax-, variabili e keyframes da base.css. */

/* Navigazione morbida verso le ancore (solo se il movimento è gradito) */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

/* Badge "aggiornato a" nell'hero */
.tax-updated {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin-top: 1.75rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em;
  color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 100px; padding: 0.35rem 0.9rem;
}
.tax-updated::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,0.2);
}

/* Pillole sticky sotto il nav (68px) */
.tax-pills {
  position: sticky; top: 68px; z-index: 40; background: var(--white);
  box-shadow: 0 2px 10px rgba(15,31,61,0.08);
  display: flex; justify-content: center; gap: 0.75rem; padding: 0.85rem 1.5rem;
}
.tax-pill {
  font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.85rem;
  color: var(--navy); text-decoration: none; border: 1.5px solid var(--navy);
  border-radius: 999px; padding: 0.45rem 1.2rem; transition: background 0.2s, color 0.2s;
}
.tax-pill:hover, .tax-pill.is-active { background: var(--navy); color: var(--white); }

/* Contenitore */
.tax-wrap { max-width: 1100px; margin: 0 auto; padding: 0 2rem; }
.tax-wrap--bridge { padding-top: 3rem; padding-bottom: 3rem; }

/* Titoli sezione */
#deduzione, #detrazione { scroll-margin-top: 130px; }
.tax-section { padding: 3.5rem 0 4.5rem; }
.tax-section--gray { background: var(--gray-bg); }
.tax-section-title {
  font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; color: var(--night);
  letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 0.5rem;
}

/* Intro "due modi" */
.tax-intro { padding: 3.5rem 0 0; }
.tax-intro h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; color: var(--night); letter-spacing: -0.02em; margin: 0 0 1.5rem; }
.tax-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.tax-mode {
  background: var(--white); border-radius: 14px; padding: 1.5rem 1.6rem;
  border-left: 4px solid var(--navy); box-shadow: 0 2px 10px rgba(15,31,61,0.06);
}
.tax-mode--red { border-left-color: var(--red); }
.tax-mode h3 { font-size: 1.05rem; font-weight: 700; color: var(--night); margin: 0 0 0.6rem; }
.tax-mode p { font-size: 0.92rem; color: #475569; line-height: 1.75; margin: 0; }

/* Card informative */
.tax-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; margin-top: 2rem; }
.tax-card {
  background: var(--white); border-radius: 14px; padding: 1.4rem 1.5rem;
  box-shadow: 0 2px 10px rgba(15,31,61,0.06); border: 1px solid rgba(27,58,107,0.06);
}
.tax-card-badge {
  display: inline-block; background: rgba(27,58,107,0.08); color: var(--navy);
  font-size: 0.72rem; font-weight: 700; padding: 0.25rem 0.65rem; border-radius: 999px;
  margin-bottom: 0.7rem; letter-spacing: 0.02em;
}
.tax-card-badge--red { background: rgba(200,16,46,0.08); color: var(--red); }
/* Card di avvertimento: corregge una convinzione sbagliata, non promette un beneficio */
.tax-card--warn { border-left: 3px solid #d97706; }
.tax-card-badge--warn { background: rgba(217,119,6,0.1); color: #b45309; }
.tax-card h3 { font-size: 1.02rem; font-weight: 700; color: var(--night); margin: 0 0 0.6rem; line-height: 1.3; }
.tax-card p { font-size: 0.87rem; color: #475569; line-height: 1.7; margin: 0; }
.tax-card-link {
  display: inline-block; margin-top: 0.9rem; font-size: 0.8rem; font-weight: 600;
  color: var(--navy); text-decoration: none; transition: color 0.2s;
}
.tax-card-link:hover { color: var(--red); }

/* Box "tre regole" */
.tax-rules {
  background: #fff8f8; border: 1px solid rgba(200,16,46,0.15); border-radius: 14px;
  padding: 1.5rem 1.75rem; margin-top: 2rem;
}
.tax-rules h3 { font-size: 1rem; font-weight: 700; color: var(--night); margin: 0 0 0.9rem; }
.tax-rules ol { list-style: none; margin: 0; padding: 0; counter-reset: regole; display: grid; gap: 0.75rem; }
.tax-rules li {
  counter-increment: regole; position: relative; padding-left: 2.2rem;
  font-size: 0.87rem; color: #475569; line-height: 1.65;
}
.tax-rules li::before {
  content: counter(regole); position: absolute; left: 0; top: 0.05rem;
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 0.85rem; color: var(--red);
  width: 1.5rem; height: 1.5rem; border: 1.5px solid rgba(200,16,46,0.35);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* Box ponte deduzione/detrazione */
.tax-bridge {
  background: linear-gradient(135deg, var(--night) 0%, var(--navy) 100%);
  border-radius: 16px; padding: 2rem 2.25rem; color: var(--white);
  position: relative; overflow: hidden;
}
.tax-bridge::before {
  content: ''; position: absolute; top: -40%; right: -8%; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(200,16,46,0.14) 0%, transparent 70%);
  pointer-events: none;
}
.tax-bridge h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.9rem; position: relative; }
.tax-bridge p { font-size: 0.94rem; color: rgba(255,255,255,0.85); line-height: 1.8; margin: 0; position: relative; }

/* Calcolatori */
.tax-calc {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1.5rem; margin-top: 2.5rem;
  background: var(--white); border-radius: 16px; padding: 1.75rem;
  box-shadow: 0 4px 20px rgba(15,31,61,0.08); border: 1px solid rgba(27,58,107,0.08);
}
.tax-section--gray .tax-calc { background: var(--white); }
.tax-calc-title { font-size: 1.15rem; font-weight: 700; color: var(--night); margin: 0 0 1.25rem; }
.tax-form fieldset {
  border: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem;
}
.tax-field { display: flex; flex-direction: column; }
.tax-field--full { grid-column: 1 / -1; }
.tax-field label { font-size: 0.8rem; font-weight: 600; color: var(--night); margin-bottom: 0.35rem; }
.tax-field input, .tax-field select {
  width: 100%; padding: 0.6rem 0.75rem; border: 1.5px solid #cbd5e1; border-radius: 8px;
  font: inherit; font-size: 0.9rem; color: var(--night); background: var(--white);
  transition: border-color 0.2s;
}
.tax-field input:focus, .tax-field select:focus {
  border-color: var(--navy); outline: 2px solid rgba(27,58,107,0.15); outline-offset: 0;
}
.tax-hint { font-size: 0.72rem; color: #64748b; margin: 0.3rem 0 0; line-height: 1.4; }
.tax-noscript { grid-column: 1 / -1; font-size: 0.85rem; color: var(--red); font-weight: 600; margin: 0.5rem 0 0; }

/* Pannello risultato */
.tax-result {
  background: linear-gradient(150deg, var(--night), var(--navy)); color: var(--white);
  border-radius: 12px; padding: 1.6rem 1.7rem; display: flex; flex-direction: column; gap: 1.15rem;
  align-self: start; position: sticky; top: 132px;
}
.tax-result-row { display: flex; flex-direction: column; gap: 0.2rem; }
.tax-result-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}
.tax-result-value {
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.7rem; line-height: 1.15;
  color: var(--white); font-variant-numeric: tabular-nums;
}
.tax-result-value--big { font-size: 2.1rem; }
.tax-result-note { font-size: 0.75rem; color: rgba(255,255,255,0.55); line-height: 1.5; margin: 0; }
.tax-result-accent { font-size: 0.78rem; color: #ff8fa0; font-weight: 600; line-height: 1.5; margin: 0; }
.tax-estimate-note {
  margin-top: auto; padding-top: 0.7rem; border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.7rem; line-height: 1.45; color: rgba(255,255,255,0.45); margin-bottom: 0;
}

/* Azioni sul risultato: portare il numero calcolato dentro la conversazione */
.tax-result-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.3rem; }
.tax-wa-btn, .tax-copy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.82rem;
  padding: 0.6rem 1rem; border-radius: 8px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}
.tax-wa-btn { background: #25D366; color: #0F1F3D; }
.tax-wa-btn:hover { opacity: 0.88; }
.tax-wa-btn svg { flex-shrink: 0; }
.tax-copy-btn { background: transparent; color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.35); }
.tax-copy-btn:hover { background: rgba(255,255,255,0.12); border-color: white; }
.tax-copy-btn.is-done { background: rgba(37,211,102,0.18); border-color: rgba(37,211,102,0.6); color: white; }

/* FAQ */
.tax-faq { margin-top: 3rem; }
.tax-faq h2 { font-size: 1.4rem; font-weight: 800; color: var(--night); letter-spacing: -0.02em; margin: 0 0 1.25rem; }
.tax-faq-block {
  background: var(--white); border-radius: 12px; padding: 1.15rem 1.4rem; margin-bottom: 0.85rem;
  border: 1px solid rgba(27,58,107,0.08); box-shadow: 0 2px 8px rgba(15,31,61,0.04);
}
.tax-faq-block h3 { font-size: 0.98rem; font-weight: 700; color: var(--navy); margin: 0 0 0.5rem; }
.tax-faq-block p { font-size: 0.87rem; color: #475569; line-height: 1.7; margin: 0; }

/* Disclaimer */
.tax-disclaimer {
  background: var(--gray-bg); border-left: 4px solid var(--navy);
  border-radius: 0 12px 12px 0; padding: 1.4rem 1.6rem; margin-top: 3rem;
}
.tax-disclaimer h2 { font-size: 0.95rem; font-weight: 700; color: var(--night); margin: 0 0 0.6rem; }
.tax-disclaimer p { font-size: 0.8rem; color: #475569; line-height: 1.7; margin: 0; }

/* CTA finale (il banner rosso: base.css definisce solo il layout di .btn-white) */
.tax-cta {
  background: var(--red); border-radius: 20px; padding: 3rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 1.75rem; margin-top: 3rem;
}
.tax-cta h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.9rem); font-weight: 800; color: var(--white);
  letter-spacing: -0.02em; margin: 0; max-width: 480px; line-height: 1.25;
}
.tax-cta .btn-white {
  background: var(--white); color: var(--red); padding: 0.85rem 2rem; border-radius: 8px;
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.95rem; text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s; white-space: nowrap;
}
.tax-cta .btn-white:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }

/* Animazioni (fadeUp è già in base.css) */
.tax-intro .tax-mode { animation: fadeUp 0.5s ease both; }
.tax-intro .tax-mode:nth-child(2) { animation-delay: 0.1s; }
.tax-cards .tax-card { animation: fadeUp 0.5s ease both; }
.tax-cards .tax-card:nth-child(2) { animation-delay: 0.07s; }
.tax-cards .tax-card:nth-child(3) { animation-delay: 0.14s; }
.tax-cards .tax-card:nth-child(4) { animation-delay: 0.21s; }
.tax-cards .tax-card:nth-child(5) { animation-delay: 0.28s; }

/* Touch */
@media (hover: none) {
  .tax-pill:active { background: var(--navy); color: var(--white); }
  .tax-card:active { border-color: rgba(27,58,107,0.2); }
  .tax-cta .btn-white:active { transform: scale(0.97); }
}

/* Responsive */
@media (max-width: 900px) {
  .tax-mode-grid, .tax-cards, .tax-calc { grid-template-columns: 1fr; }
  .tax-result { position: static; }
  .tax-cta { padding: 2.25rem; }
}
@media (max-width: 640px) {
  .tax-wrap { padding: 0 1.25rem; }
  .tax-section { padding: 2.5rem 0 3.5rem; }
  .tax-pills { padding: 0.7rem 1rem; gap: 0.6rem; }
  .tax-pill { font-size: 0.8rem; padding: 0.55rem 1.15rem; }
  .tax-form fieldset { grid-template-columns: 1fr; }
  /* 16px sui campi: sotto questa dimensione iOS ingrandisce la pagina al focus */
  .tax-field input, .tax-field select { font-size: 1rem; }
  .tax-calc { padding: 1.35rem 1.15rem; }
  .tax-result-value { font-size: 1.45rem; }
  .tax-result-value--big { font-size: 1.8rem; }
  .tax-bridge { padding: 1.6rem 1.5rem; }
  .tax-cta { flex-direction: column; align-items: stretch; padding: 2rem 1.5rem; margin-bottom: 3rem; }
  .tax-cta .cta-actions { width: 100%; flex-direction: column; }
  .tax-cta .cta-actions a { justify-content: center; }
}
