/* Puntoweb Studio — herramientas gratuitas (complementa /styles.css) */

[hidden] { display: none !important; }

/* Navegación activa */
.main-nav a[aria-current="page"] { background: var(--navy-50); color: var(--navy-800); }

/* Cabecera de herramienta */
.tool-hero {
  color: #fff;
  background:
    radial-gradient(700px 360px at 90% 0%, rgba(64,120,200,.35), transparent 60%),
    linear-gradient(160deg, var(--navy-900), var(--navy-950));
  padding: clamp(28px, 5vw, 56px) 0 clamp(72px, 9vw, 104px);
}
.crumbs { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .92rem; color: #A9B8CB; }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: #6F86A3; }
.crumbs a { color: #D3DEEC; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.tool-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.6vw, 3rem); font-weight: 800; letter-spacing: -0.03em; max-width: 22em; }
.tool-hero .lead { margin-top: 14px; }
.tool-badges { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tool-badges li { font-size: .88rem; font-weight: 600; color: var(--navy-100); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); padding: 4px 12px; border-radius: 999px; }

/* Caja principal de la herramienta */
.tool-main { margin-top: clamp(-80px, -7vw, -56px); position: relative; }
.tool-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(18px, 3.5vw, 32px); }

/* Formularios */
.field { display: grid; gap: 6px; }
.field > span, .field-label { font-weight: 700; font-size: .98rem; color: var(--navy-900); }
.field small { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink); background: #fff;
  border: 1.5px solid #C9D3DF; border-radius: var(--radius-sm); padding: 12px 14px; min-height: 50px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(27,66,119,.15); }
.input[aria-invalid="true"] { border-color: #C2410C; }
.affix { position: relative; }
.affix .input { padding-right: 44px; }
.affix i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 700; color: var(--muted); pointer-events: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 1rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--navy-800); flex: none; }

/* Selector segmentado */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: grid; place-items: center; text-align: center; min-height: 46px; padding: 8px 10px; border-radius: 10px; font-weight: 700; font-size: .98rem; color: var(--muted); cursor: pointer; line-height: 1.25; }
.seg input:checked + label { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + label { outline: 3px solid var(--amber); outline-offset: 1px; }

.btn-navy { background: var(--navy-800); color: #fff; }
.btn-navy:hover { background: var(--navy-900); }
.btn-soft { background: var(--navy-50); color: var(--navy-800); border-color: var(--navy-100); }
.btn-soft:hover { border-color: var(--navy-700); }
.btn-text { background: none; border: 0; font: inherit; font-weight: 700; color: var(--navy-700); cursor: pointer; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; }

.note { font-size: .95rem; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; line-height: 1.5; }
.note strong { color: var(--ink); }
.note-ok { background: #EAF6EF; border-color: #BFE3CD; color: #1D4D32; }
.error-msg { color: #B03A0B; font-weight: 600; font-size: .95rem; }
.toast { min-height: 1.4em; font-size: .95rem; font-weight: 600; color: var(--wa); }

/* ---------- Calculadora ---------- */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 36px); align-items: start; }
.results { background: var(--navy-900); color: #fff; border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); display: grid; gap: 16px; }
.results h2 { color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: 0; color: var(--navy-100); }
.res-main { display: grid; gap: 2px; }
.res-main span { font-size: .95rem; color: #C7D4E5; }
.res-main strong { font-size: clamp(2rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; color: #fff; }
.res-main small { color: var(--amber); font-weight: 700; font-size: 1rem; }
.res-list { margin: 0; display: grid; gap: 0; border-top: 1px solid rgba(255,255,255,.12); }
.res-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 1rem; }
.res-list dt { color: #C7D4E5; }
.res-list dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.results .btn { width: 100%; }
.results .toast { color: #8FE0B0; text-align: center; }
.results .error-msg { color: #FFB38A; }
.results.is-empty .res-main strong { color: #6F86A3; }

/* ---------- Generador de presupuestos ---------- */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 36px); align-items: start; }
.gen fieldset { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; }
.gen legend { font-size: 1.2rem; font-weight: 800; color: var(--navy-900); padding: 0; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.gen legend .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--amber); color: var(--navy-950); font-size: .95rem; }
.lines { display: grid; gap: 12px; margin-bottom: 12px; }
.line { display: grid; grid-template-columns: 1fr 92px 120px 44px; gap: 8px; align-items: end; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.line .field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.line .input { min-height: 46px; padding: 10px 12px; font-size: 1rem; }
.line-del { width: 44px; height: 46px; border-radius: 10px; border: 1.5px solid #C9D3DF; background: #fff; color: #9A3412; cursor: pointer; display: grid; place-items: center; }
.line-del:hover { border-color: #9A3412; }
.line-del svg { width: 20px; height: 20px; }
.line-del:disabled { opacity: .4; cursor: not-allowed; }
.gen-preview { position: sticky; top: 88px; display: grid; gap: 14px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview-head h2 { font-size: 1.15rem; }
.preview-actions { display: grid; gap: 10px; }
.saved-box { display: grid; gap: 8px; }

/* Documento de presupuesto (vista previa e impresión) */
.doc-frame { background: #E9EEF4; border-radius: var(--radius); padding: clamp(10px, 2vw, 18px); overflow-x: auto; }
.doc {
  background: #fff; color: #1A2433; font-family: var(--font); font-size: 13px; line-height: 1.45;
  padding: 32px 30px; border-radius: 6px; box-shadow: 0 6px 24px -10px rgba(11,31,56,.35);
  min-width: 300px;
}
.doc-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 18px; border-bottom: 3px solid var(--navy-900); }
.doc-biz strong { display: block; font-size: 17px; color: var(--navy-900); line-height: 1.25; margin-bottom: 4px; }
.doc-biz div, .doc-client div { color: #4A5869; overflow-wrap: anywhere; }
.doc-title { text-align: right; }
.doc-title h3 { font-size: 22px; letter-spacing: .06em; text-transform: uppercase; color: var(--navy-900); }
.doc-title div { color: #4A5869; white-space: nowrap; }
.doc-title b { color: #1A2433; }
.doc-client { margin: 18px 0; padding: 12px 14px; background: #F4F7FB; border-radius: 6px; }
.doc-client .lbl, .doc-notes .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6A7A8C; margin-bottom: 2px; }
.doc-client strong { color: #1A2433; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #6A7A8C; text-align: left; padding: 8px 6px; border-bottom: 1.5px solid #C9D3DF; }
.doc td { padding: 9px 6px; border-bottom: 1px solid #E3E8EF; vertical-align: top; overflow-wrap: anywhere; }
.doc .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc .empty td { color: #93A1B1; font-style: italic; }
.doc-totals { margin: 14px 0 0 auto; width: min(100%, 290px); }
.doc-totals div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 6px; font-variant-numeric: tabular-nums; }
.doc-totals .total { margin-top: 6px; padding: 10px 8px; background: var(--navy-900); color: #fff; border-radius: 6px; font-size: 16px; font-weight: 800; }
.doc-notes { margin-top: 20px; white-space: pre-line; color: #2B3747; overflow-wrap: anywhere; }
.doc-foot { margin-top: 24px; padding-top: 12px; border-top: 1px solid #E3E8EF; font-size: 11px; color: #6A7A8C; }

/* ---------- Contenido SEO ---------- */
.tool-content { padding: clamp(48px, 7vw, 88px) 0 0; }
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin: 44px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.2rem; margin: 26px 0 8px; }
.prose p, .prose li { color: #2B3747; }
.prose p { margin-bottom: 14px; }
.prose ol, .prose ul { padding-left: 1.3em; margin: 0 0 16px; display: grid; gap: 6px; }
.prose strong { color: var(--ink); }
.example { background: var(--amber-soft); border: 1px solid #F1D3A6; border-radius: var(--radius-sm); padding: 16px 18px; margin: 18px 0; }
.example p:last-child { margin-bottom: 0; }
.explain { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.explain div { background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: var(--radius-sm); padding: 16px; }
.explain b { display: block; color: var(--navy-900); margin-bottom: 4px; }
.explain p { font-size: 1rem; margin: 0; }

.faq { display: grid; gap: 10px; margin-top: 8px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 18px; font-weight: 700; color: var(--navy-900); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; font-weight: 600; color: var(--navy-700); }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 18px 16px; margin: 0; }

/* Otras herramientas y llamada a la acción */
.more-tools { max-width: 760px; margin: 48px auto 0; }
.more-tools h2 { font-size: 1.35rem; margin-bottom: 14px; }
.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tool-link { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink); transition: transform .25s, box-shadow .25s, border-color .25s; }
.tool-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--navy-100); }
.tool-link h2, .tool-link h3 { font-size: 1.3rem; }
.tool-link p { color: var(--muted); font-size: 1rem; flex: 1; }
.tool-link .go { font-weight: 700; color: var(--navy-700); }
.tool-link .s-ico { margin-bottom: 4px; }

.cta-box { max-width: 760px; margin: clamp(40px, 6vw, 64px) auto clamp(56px, 8vw, 96px); display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: var(--radius); padding: 22px 26px; }
.cta-box p { font-size: 1.05rem; color: var(--ink); max-width: 30em; }
.cta-box strong { color: var(--navy-900); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .calc, .gen { grid-template-columns: 1fr; }
  .gen-preview { position: static; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .explain, .tools-grid { grid-template-columns: 1fr; }
  .line { grid-template-columns: 1fr 1fr 44px; }
  .line .f-desc { grid-column: 1 / -1; }
  .doc { padding: 22px 16px; font-size: 12px; }
  .doc-top { flex-direction: column; gap: 12px; }
  .doc-title { text-align: left; }
  .cta-box .btn { width: 100%; }
}

/* ---------- Impresión (PDF del presupuesto) ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; font-size: 12pt; }
  body.printing-doc > *:not(main) { display: none !important; }
  body.printing-doc main > *:not(.tool-main) { display: none !important; }
  body.printing-doc .tool-main .gen > form,
  body.printing-doc .preview-head,
  body.printing-doc .preview-actions,
  body.printing-doc .saved-box,
  body.printing-doc .gen-preview > .note { display: none !important; }
  body.printing-doc .tool-main { margin: 0; }
  body.printing-doc .tool-main > .wrap { padding: 0; max-width: none; }
  body.printing-doc .tool-card { border: 0; box-shadow: none; padding: 0; }
  body.printing-doc .gen { display: block; }
  body.printing-doc .doc-frame { background: none; padding: 0; overflow: visible; }
  body.printing-doc .doc { box-shadow: none; padding: 0; font-size: 10.5pt; min-width: 0; }
  body.printing-doc .doc-top { flex-direction: row; }
  body.printing-doc .doc-title { text-align: right; }
  .doc, .doc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc tr, .doc-totals { break-inside: avoid; }
}
