/* ==========================================================================
   Estilos del Portal Legal (Términos, Privacidad, Juego Limpio y Cuenta)
   Inspirado en la identidad visual de la app (#131E47, #007AFF, #F5F5F7)
   ========================================================================== */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-alt: #f0f4fa;
  --text: #1c2434;
  --text-muted: #556277;
  --border: #dce3ee;
  --primary: #1a66db;
  --primary-hover: #1352b5;
  --primary-soft: rgba(26, 102, 219, 0.1);
  --navy-start: #131e47;
  --navy-end: #0e3b78;
  --accent-gold: #d99b1e;
  --success: #1b8f4b;
  --success-soft: rgba(27, 143, 75, 0.12);
  --warning: #b4690e;
  --warning-soft: rgba(237, 180, 58, 0.18);
  --danger: #d93025;
  --danger-soft: rgba(217, 48, 37, 0.1);
  --shadow-sm: 0 2px 8px rgba(19, 30, 71, 0.06);
  --shadow-md: 0 10px 30px rgba(19, 30, 71, 0.1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --max-width: 1120px;
}

html[data-theme="dark"] {
  --bg: #0e1117;
  --surface: #161b24;
  --surface-alt: #1d2432;
  --text: #edf2f7;
  --text-muted: #a0aec0;
  --border: #2a3446;
  --primary: #64b5f6;
  --primary-hover: #8cc8fa;
  --primary-soft: rgba(100, 181, 246, 0.14);
  --navy-start: #0b122b;
  --navy-end: #102a54;
  --accent-gold: #f0b849;
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.15);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.14);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* Control bilingüe instantáneo */
html[data-site-lang="es"] [data-lang="en"],
html[data-site-lang="en"] [data-lang="es"] {
  display: none !important;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header / Navbar ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] .site-header {
  background: rgba(22, 27, 36, 0.9);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none !important;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  object-fit: cover;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.mobile-menu-btn {
  display: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy-start) 0%, var(--navy-end) 100%);
  color: #ffffff;
  padding: 52px 0 48px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 3.2vw, 2.6rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.hero-lead {
  margin: 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.04rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 20px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.8);
}

.hero-icon-card {
  flex-shrink: 0;
  width: 104px;
  height: 104px;
  border-radius: 24px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

/* ---------- Provisional Banner ---------- */
.provisional-banner {
  background: var(--warning-soft);
  border-bottom: 1px solid rgba(217, 155, 30, 0.35);
  color: var(--text);
  padding: 12px 0;
  font-size: 0.9rem;
}

.provisional-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.provisional-banner strong {
  color: var(--warning);
}

.is-hidden {
  display: none !important;
}

/* ---------- Cards Grid (Home Hub) ---------- */
.main-section {
  padding: 36px 0 64px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.card h2,
.card h3 {
  margin: 0 0 8px;
  font-size: 1.18rem;
  letter-spacing: -0.015em;
}

.card p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--primary);
}

/* ---------- Legal Document Two-Column Layout ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.toc-sidebar {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.toc-title {
  margin: 0 0 12px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.toc-link:hover,
.toc-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-left-color: var(--primary);
  text-decoration: none;
}

.doc-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
  box-shadow: var(--shadow-sm);
}

.doc-article section {
  padding-top: 8px;
  margin-bottom: 30px;
  scroll-margin-top: 90px;
}

.doc-article section:last-child {
  margin-bottom: 0;
}

.doc-article h2 {
  font-size: 1.38rem;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.015em;
}

.doc-article h3 {
  font-size: 1.06rem;
  margin: 18px 0 8px;
  color: var(--text);
}

.doc-article p {
  margin: 0 0 12px;
}

.doc-article ul,
.doc-article ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.doc-article li {
  margin-bottom: 7px;
}

/* ---------- Callouts & Tables ---------- */
.callout {
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 16px 0;
  border-left: 4px solid var(--primary);
  background: var(--surface-alt);
}

.callout-info {
  border-left-color: var(--primary);
  background: var(--primary-soft);
}

.callout-warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.callout-success {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.callout-danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.callout-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--surface-alt);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

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

/* ---------- Summary Box & Forms ---------- */
.summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.info-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.info-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.info-pill-label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.info-pill-value {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-word;
}

.form-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.field-input,
.field-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.field-input:focus,
.field-textarea:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

html[data-theme="dark"] .btn-primary {
  color: #0b122b;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.copy-feedback {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--success);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .toc-sidebar {
    position: static;
  }
  .doc-article {
    padding: 24px 20px;
  }
}

@media (max-width: 780px) {
  .hero-inner {
    flex-direction: column-reverse;
    align-items: flex-start;
  }
  .hero-icon-card {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px 18px;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow-md);
  }
  .nav-links.open {
    display: flex;
  }
}

@media print {
  .site-header,
  .toc-sidebar,
  .nav-controls,
  .mobile-menu-btn,
  .provisional-banner,
  .no-print {
    display: none !important;
  }
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-article {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  body {
    background: #ffffff;
    color: #000000;
  }
}
