/* ==========================================================================
   ALEGRÍAS TOURS - TÉRMINOS Y CONDICIONES GENERALES (LEGAL)
   Diseño editorial limpio, estructurado y sin tarjetas genéricas ni AI slop.
   ========================================================================== */

.terms-page {
  padding-top: calc(var(--header-height) + 40px);
  padding-bottom: 100px;
  background-color: #F8FAFC;
  min-height: 100vh;
}

.terms-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 32px;
}

/* 1. Header Editorial */
.terms-hero {
  text-align: center;
  max-width: 920px;
  margin: 0 auto 48px auto;
}

.terms-main-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  color: var(--color-deep-navy);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.terms-main-title .highlight-line {
  position: relative;
  display: inline-block;
  color: var(--color-deep-navy);
}

.terms-main-title .highlight-line::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: -2px;
  right: -2px;
  height: 4px;
  background: var(--color-brand-yellow);
  border-radius: 2px;
  z-index: -1;
}

.terms-main-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.terms-main-subtitle strong {
  color: var(--color-deep-navy);
  font-weight: 700;
}

.terms-meta-info {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 32px;
  letter-spacing: 0.01em;
}

/* 2. Barra de Utilidades (Buscador + Acciones) */
.terms-action-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 16px 22px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.03);
}

@media (min-width: 768px) {
  .terms-action-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.terms-search-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.terms-search-wrap .search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #94A3B8;
  pointer-events: none;
}

.terms-search-wrap input {
  width: 100%;
  padding: 12px 38px 12px 42px;
  border-radius: 10px;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--color-deep-navy);
  transition: all var(--transition-fast);
}

.terms-search-wrap input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--color-brand-yellow);
  box-shadow: 0 0 0 3px rgba(255, 199, 0, 0.25);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #94A3B8;
  cursor: pointer;
  padding: 4px 8px;
}

.search-clear-btn:hover {
  color: #1E293B;
}

.terms-action-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-terms-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 220ms ease;
  white-space: nowrap;
}

.btn-terms-action svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-terms-download {
  background: var(--color-deep-navy);
  color: var(--color-brand-yellow);
  border: 1px solid #1E293B;
}

.btn-terms-download:hover {
  background: #1E293B;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
}

.btn-terms-print {
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #E2E8F0;
}

.btn-terms-print:hover {
  background: #E2E8F0;
  color: #0F172A;
  transform: translateY(-1px);
}

/* Feedback de búsqueda */
.search-feedback-bar {
  padding: 12px 18px;
  background: #FEF9C3;
  border: 1px solid #FDE047;
  border-radius: 10px;
  color: #854D0E;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 3. Layout Grid de 2 Columnas (TOC Sticky + Contenido) */
.terms-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  align-items: start;
}

@media (min-width: 992px) {
  .terms-layout-grid {
    grid-template-columns: 310px 1fr;
    gap: 48px;
  }
}

/* Sidebar e Índice (TOC) */
.terms-sidebar {
  display: none;
}

@media (min-width: 992px) {
  .terms-sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + 24px);
    max-height: calc(100vh - 120px);
    overflow: hidden;
  }
}

.terms-toc-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid #E2E8F0;
  margin-bottom: 12px;
}

.toc-header h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-deep-navy);
  letter-spacing: -0.01em;
}

.toc-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: #F1F5F9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 6px;
}

.terms-toc-nav {
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
}

.terms-toc-nav::-webkit-scrollbar {
  width: 5px;
}
.terms-toc-nav::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.terms-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.terms-toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.8125rem;
  color: #475569;
  font-weight: 500;
  line-height: 1.35;
  transition: all var(--transition-fast);
}

.terms-toc-link .toc-num {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  color: #94A3B8;
  background: #F8FAFC;
  padding: 2px 5px;
  border-radius: 4px;
  min-width: 24px;
  text-align: center;
}

.terms-toc-link .toc-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terms-toc-link:hover {
  background: #F8FAFC;
  color: var(--color-deep-navy);
}

.terms-toc-link.active {
  background: rgba(255, 199, 0, 0.15);
  color: var(--color-deep-navy);
  font-weight: 700;
}

.terms-toc-link.active .toc-num {
  background: var(--color-brand-yellow);
  color: var(--color-deep-navy);
}

/* 4. Área de Contenido Central (Documento Legal Continuo Sin Cards) */
.terms-content-area {
  min-width: 0;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 48px 52px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.03);
}

@media (max-width: 767px) {
  .terms-content-area {
    padding: 28px 20px;
    border-radius: 12px;
  }
}

.terms-preamble-box {
  background: transparent;
  border: none;
  border-bottom: 2px solid #F1F5F9;
  border-radius: 0;
  padding: 0 0 28px 0;
  margin-bottom: 32px;
  box-shadow: none;
}

.preamble-tag {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #64748B;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.terms-preamble-text {
  font-size: 1.05rem;
  color: #334155;
  line-height: 1.75;
}

/* Secciones Formales (Flujo Documental Continuo) */
.terms-sections-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.terms-section {
  background: transparent;
  border: none;
  border-bottom: 1px solid #F1F5F9;
  border-radius: 0;
  padding: 32px 0;
  box-shadow: none;
  scroll-margin-top: calc(var(--header-height) + 24px);
  transition: background-color var(--transition-fast);
}

.terms-section:last-child {
  border-bottom: none;
}

.terms-section:target,
.terms-section.is-highlighted {
  background: rgba(241, 245, 249, 0.6);
  border-radius: 8px;
  padding-left: 14px;
  padding-right: 14px;
  box-shadow: none;
}

.terms-section-header {
  padding-bottom: 10px;
  border-bottom: none;
  margin-bottom: 14px;
}

.terms-section-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-deep-navy);
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.terms-sec-prefix {
  color: #475569;
  font-weight: 700;
  margin-right: 6px;
}

.terms-section-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.terms-paragraph {
  font-size: 1rem;
  line-height: 1.78;
  color: #334155;
}

.terms-bullet {
  font-size: 0.975rem;
  line-height: 1.7;
  color: #1E293B;
  padding-left: 20px;
  position: relative;
}

.terms-bullet::before {
  content: "▪";
  color: var(--color-brand-yellow);
  font-size: 1.1rem;
  position: absolute;
  left: 4px;
  top: -1px;
}

.terms-subsection-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-deep-navy);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #E2E8F0;
  line-height: 1.35;
}

/* Tabla de Datos de la Agencia en Sección 1 */
.terms-table-wrapper {
  margin: 14px 0;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
}

.terms-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.terms-data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #F1F5F9;
  line-height: 1.5;
}

.terms-data-table tr:last-child td {
  border-bottom: none;
}

.terms-data-table tr td:first-child {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-deep-navy);
  width: 38%;
  background: #F8FAFC;
}

.terms-data-table tr td:last-child {
  color: #334155;
  font-weight: 500;
}

/* Resaltado de Búsqueda */
mark.search-highlight {
  background-color: #FEF08A;
  color: #854D0E;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 700;
}

/* 5. Botón Volver Arriba */
.btn-back-to-top {
  position: fixed;
  bottom: 84px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-deep-navy);
  color: var(--color-brand-yellow);
  border: 1px solid #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-fast);
  z-index: 90;
}

.btn-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.btn-back-to-top:hover {
  background: #1E293B;
  color: #FFFFFF;
  transform: translateY(-3px);
}

.btn-back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Tarjetas de Resalte y Cláusulas Operativas de Alegrías Tours
   ========================================================================== */
.terms-highlight-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-left: 4px solid var(--color-brand-yellow, #FFC700);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 18px 0;
  box-shadow: 0 2px 8px rgba(11, 25, 44, 0.04);
}

.terms-highlight-card.card-navy {
  border-left-color: var(--color-deep-navy, #0B192C);
  background: #F8FAFC;
}

.terms-highlight-card.card-warning {
  border-left-color: #EF4444;
  background: #FEF2F2;
  border-color: #FEE2E2;
}

.terms-highlight-title {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-deep-navy, #0B192C);
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.terms-badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #E2E8F0;
  color: #334155;
}

.terms-badge-pill.pill-yellow {
  background: #FEF3C7;
  color: #92400E;
}

.terms-badge-pill.pill-navy {
  background: #E0E7FF;
  color: #3730A3;
}

.terms-badge-pill.pill-red {
  background: #FEE2E2;
  color: #991B1B;
}

.terms-penalty-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.925rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #E2E8F0;
}

.terms-penalty-table th {
  background: #0B192C;
  color: #FFFFFF;
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.terms-penalty-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #E2E8F0;
  color: #334155;
  line-height: 1.5;
}

.terms-penalty-table tr:last-child td {
  border-bottom: none;
}

.terms-penalty-table tr:nth-child(even) td {
  background: #F8FAFC;
}

/* Reglas de Impresión */
@media print {
  .site-header,
  .site-footer,
  .mobile-bottom-dock,
  .terms-sidebar,
  .terms-action-bar,
  .btn-back-to-top {
    display: none !important;
  }

  .terms-page {
    padding: 0 !important;
    background: #FFFFFF !important;
  }

  .terms-container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .terms-section {
    border: none !important;
    box-shadow: none !important;
    padding: 16px 0 !important;
    page-break-inside: avoid;
  }
}
