/* ═══════════════════════════════════════════════════════════
   CareBridge — Estilos compartidos de páginas legales
   Incluido en: privacidad.html · terminos.html · cookies.html
   ═══════════════════════════════════════════════════════════ */

:root {
  --navy: #0b1f3a;
  --navy-mid: #13305a;
  --teal: #00b4a0;
  --teal-light: #e0f7f5;
  --teal-mid: #00907f;
  --cream: #f8f6f1;
  --text: #1a2e44;
  --muted: #5a7080;
  --border: #d4dde6;
  --white: #ffffff;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--cream);
}

/* ── Header ── */
header {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, #0e3d6e 0%, transparent 70%),
    radial-gradient(ellipse at 10% 80%, #00443c 0%, transparent 60%);
  opacity: 0.9;
}

.header-grid {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: linear-gradient(var(--teal) 1px, transparent 1px),
    linear-gradient(90deg, var(--teal) 1px, transparent 1px);
  background-size: 48px 48px;
}

.header-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 64px 40px 56px;
}

/* ── Logo ── */
.logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

/* Logo enlazado al sitio principal */
.logo-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

/* Si .logo-row y .logo-link coexisten, el margin viene de .logo-link */
a.logo-row { margin-bottom: 0; }

.logo-mark {
  width: 42px;
  height: 42px;
  background: var(--teal);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark svg {
  width: 24px;
  height: 24px;
}

.logo-name {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--white);
  letter-spacing: 0.01em;
}

.logo-name span {
  color: var(--teal);
}

.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.badge {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 180, 160, 0.4);
  color: var(--teal);
  background: rgba(0, 180, 160, 0.08);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--white);
  margin-bottom: 20px;
}

h1 em {
  font-style: italic;
  color: var(--teal);
}

.header-meta {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.header-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Layout ── */
.layout {
  max-width: 900px;
  margin: 48px auto 0;
  padding: 0 40px 80px;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 48px;
  align-items: start;
}

/* ── TOC ── */
.toc {
  position: sticky;
  top: 32px;
}

.toc-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 2px;
}

.toc-list a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px 5px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: all 0.15s;
  line-height: 1.4;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--teal-mid);
  border-left-color: var(--teal);
  background: var(--teal-light);
}

/* ── Content ── */
.content {
  min-width: 0;
}

.section {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 32px; /* evita que el TOC sticky tape la sección (#4) */
}

.section:last-child {
  border-bottom: none;
}

h2 {
  font-family: var(--serif);
  font-size: clamp(20px, 3.5vw, 26px);
  font-weight: 400;
  color: var(--navy);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--teal);
  color: var(--white);
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

h3 {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  margin: 24px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p {
  margin-bottom: 14px;
  color: var(--text);
  font-size: 15px;
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 10px 0 14px 0;
  padding-left: 0;
  list-style: none;
}

ul li,
ol li {
  font-size: 15px;
  color: var(--text);
  padding: 5px 0 5px 22px;
  position: relative;
  line-height: 1.6;
}

ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

ol {
  counter-reset: ol-counter;
}

ol li {
  counter-increment: ol-counter;
}

ol li::before {
  content: counter(ol-counter) '.';
  position: absolute;
  left: 0;
  top: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--teal-mid);
}

/* ── Info cards ── */
.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 16px 0;
}

.info-card.teal {
  background: var(--teal-light);
  border-color: rgba(0, 180, 160, 0.25);
}

.info-card.warning {
  background: #fff8e6;
  border-color: #f0d070;
  border-left: 4px solid #e6a800;
}

.card-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-mid);
  margin-bottom: 8px;
}

.info-card.warning .card-label {
  color: #a07000;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 16px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

thead {
  background: var(--navy);
  color: var(--white);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
}

tbody tr {
  background: var(--white);
}

tbody tr:nth-child(even) {
  background: var(--cream);
}

tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ── Pills ── */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}

.pill-green {
  background: #e1f5ee;
  color: #0f6e56;
}

.pill-amber {
  background: #fff1cc;
  color: #8a5a00;
}

.pill-red {
  background: #fff1f0;
  color: #b03020;
}

/* ── Contact box (privacidad + cookies) ── */
.contact-box {
  background: var(--navy);
  border-radius: 16px;
  padding: 32px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.contact-box .cb-text h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--white);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 6px;
}

.contact-box .cb-text p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.contact-box a,
.contact-box-btn {
  display: inline-block;
  background: var(--teal);
  color: var(--navy);
  font-weight: 500;
  font-size: 14px;
  padding: 11px 24px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.contact-box a:hover,
.contact-box-btn:hover {
  background: #00cdb8;
}

/* ── Legal form controls ── */
.steps-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.steps-list li {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  padding: 16px 18px 16px 54px;
}

.steps-list li::before {
  counter-increment: ol-counter;
  content: counter(ol-counter);
  top: 16px;
  left: 18px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.steps-list {
  counter-reset: ol-counter;
}

.steps-list strong {
  display: block;
  color: var(--navy);
  margin-bottom: 4px;
}

.legal-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field[hidden] {
  display: none;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label,
.checkbox-field label {
  color: var(--navy);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  padding: 11px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.checkbox-field input:focus-visible {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px rgba(0, 180, 160, 0.14);
  outline: none;
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: #dc4030;
}

.form-field textarea {
  min-height: 112px;
  resize: vertical;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-error {
  color: #b03020;
  display: none;
  font-size: 12px;
  line-height: 1.45;
}

.field-error.visible {
  display: block;
}

.checkbox-field {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.checkbox-field input {
  accent-color: var(--teal-mid);
  flex: 0 0 auto;
  height: 18px;
  margin-top: 2px;
  width: 18px;
}

.legal-button {
  align-items: center;
  background: var(--teal);
  border: none;
  border-radius: 8px;
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.legal-button:hover {
  background: #00cdb8;
  transform: translateY(-1px);
}

.legal-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.form-status {
  border-radius: 10px;
  display: none;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
}

.form-status.visible {
  display: block;
}

.form-status.success {
  background: #e1f5ee;
  color: #0f6e56;
}

.form-status.error {
  background: #fff1f0;
  color: #b03020;
}

.hp-field {
  height: 1px;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  top: auto;
  width: 1px;
}

.paper-form {
  background: #f0f4f8;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.8;
  margin-top: 12px;
  overflow-x: auto;
  padding: 14px 16px;
  white-space: pre-wrap;
}

/* ── Footer ── */
footer {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  padding: 32px 40px;
  font-size: 13px;
  line-height: 1.6;
}

footer strong {
  color: rgba(255, 255, 255, 0.7);
}

footer a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}

footer a:hover {
  color: var(--teal);
}

/* ── Responsive 900px ── */
@media (max-width: 900px) {
  .layout {
    gap: 36px;
    padding: 0 32px 72px;
    margin-top: 40px;
  }

  .header-inner {
    padding: 48px 32px 44px;
  }
}

/* ── Responsive 700px ── */
@media (max-width: 700px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0 20px 60px;
    margin-top: 32px;
    gap: 32px;
  }

  .toc {
    position: static;
  }

  .header-inner {
    padding: 40px 20px 36px;
  }

  footer {
    padding: 24px 20px;
  }

  /* h2 usa display:flex; sin flex-wrap el texto desborda en móvil */
  h2 {
    display: block;
  }

  .section-num {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 8px;
    margin-bottom: 4px;
  }

  p, li, h1, h2, h3, a,
  .section-desc, .card-label, td, code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Tablas: layout apilado tipo tarjeta */
  table {
    display: block;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  thead {
    display: none;
  }

  tbody, tbody tr, tbody td {
    display: block;
    box-sizing: border-box;
    width: 100%;
  }

  tbody tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    background: var(--white);
    overflow: hidden;
  }

  tbody tr:nth-child(even) {
    background: var(--white);
  }

  tbody td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
  }

  tbody tr td:last-child {
    border-bottom: none;
  }

  tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 3px;
  }

  /* contact-box responsive */
  .contact-box {
    flex-direction: column;
    padding: 24px 20px;
  }

  .contact-box a {
    width: 100%;
    text-align: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .legal-button {
    width: 100%;
  }

  .steps-list li {
    padding: 14px 14px 14px 48px;
  }
}
