/* =========================================================
   FICHA DE PRODUCTO (PDP) — específicos
   ========================================================= */

.pdp-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  overflow-x: hidden;  /* safety net contra hijos que sobresalgan en mobile */
}

/* Breadcrumb */
.pdp-crumbs {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--tpm-text-muted);
  margin-bottom: 24px;
}
.pdp-crumbs a { color: var(--tpm-text-muted); text-decoration: none; transition: color 0.12s ease; }
.pdp-crumbs a:hover { color: var(--tpm-blue-dark); }
.pdp-crumbs__sep { color: var(--tpm-text-faint); user-select: none; }
.pdp-crumbs__current { color: var(--tpm-text); font-weight: 500; }

/* Cabecera */
.pdp-hd { margin-bottom: 32px; }
.pdp-hd__brand {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--tpm-blue-dark);
  margin: 0 0 8px;
}
body.dark-mode .pdp-hd__brand,
.dark-mode .pdp-hd__brand { color: var(--tpm-blue); }
.pdp-hd__brand a { color: inherit; text-decoration: none; }
.pdp-hd__brand a:hover { text-decoration: underline; text-underline-offset: 2px; }
.pdp-hd h1 {
  font-size: 32px; font-weight: 700;
  line-height: 1.2; letter-spacing: -0.015em;
  color: var(--tpm-text);
  margin: 0 0 12px;
  max-width: 880px;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.pdp-hd__meta { overflow-wrap: anywhere; }
.pdp-crumbs__current { overflow-wrap: anywhere; }
.pdp-hd__meta {
  font-size: 13px; color: var(--tpm-text-muted);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.pdp-hd__meta a { color: var(--tpm-text); text-decoration: none; border-bottom: 1px dotted var(--tpm-border-strong); }
.pdp-hd__meta a:hover { color: var(--tpm-blue-dark); border-bottom-color: var(--tpm-blue-dark); }
.pdp-hd__meta-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--tpm-text-faint); }

/* Layout principal */
.pdp-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: start;
  margin-bottom: 56px;
}
.pdp-img-col, .pdp-info-col { min-width: 0; }
.pdp-img-col { display: flex; flex-direction: column; gap: 14px; }
.pdp-img {
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.pdp-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 24px;
  background: #fff;
}
.pdp-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}
.pdp-thumb {
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s ease;
  padding: 4px;
}
.pdp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.pdp-thumb:hover { border-color: var(--tpm-border-strong); }
.pdp-thumb--active { border-color: var(--tpm-blue); border-width: 2px; }

.pdp-info-col { display: flex; flex-direction: column; gap: 24px; }

/* Trío precios */
.pdp-prices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  overflow: hidden;
  background: var(--tpm-surface);
}
.pdp-price { padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.pdp-price + .pdp-price { border-left: 1px solid var(--tpm-border); }
.pdp-price__label {
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tpm-text-faint);
  display: flex; align-items: center; gap: 6px;
}
.pdp-price__label-dot { width: 6px; height: 6px; border-radius: 50%; }
.pdp-price__value {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--tpm-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.pdp-price__when { font-size: 11.5px; color: var(--tpm-text-muted); }
.pdp-price--max .pdp-price__label-dot { background: var(--tpm-stat-max); }
.pdp-price--max .pdp-price__value { color: var(--tpm-stat-max); }
.pdp-price--current { background: var(--tpm-blue-soft); }
.pdp-price--current .pdp-price__label-dot { background: var(--tpm-blue); }
.pdp-price--current .pdp-price__label { color: var(--tpm-blue-dark); }
body.dark-mode .pdp-price--current .pdp-price__label,
.dark-mode .pdp-price--current .pdp-price__label { color: var(--tpm-blue); }
.pdp-price--current .pdp-price__value { color: var(--tpm-blue-dark); }
body.dark-mode .pdp-price--current .pdp-price__value,
.dark-mode .pdp-price--current .pdp-price__value { color: var(--tpm-blue); }
.pdp-price--min .pdp-price__label-dot { background: var(--tpm-stat-min); }
.pdp-price--min .pdp-price__value { color: var(--tpm-stat-min); }
.pdp-price__pulse {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 6px;
  background: var(--tpm-blue);
  color: #fff;
  border-radius: 3px;
}

/* CTAs */
.pdp-ctas { display: flex; flex-direction: column; gap: 10px; }
.pdp-cta-primary {
  height: 52px;
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--tpm-cta-text);
  background: var(--tpm-cta);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background 0.12s ease, transform 0.12s ease;
}
.pdp-cta-primary:hover { background: var(--tpm-cta-hover); }
.pdp-cta-primary:active { transform: translateY(1px); }
.pdp-cta-primary svg { width: 14px; height: 14px; }
.pdp-cta-primary__sub { font-size: 11px; font-weight: 400; opacity: 0.7; margin-left: 6px; }
.pdp-cta-secondary {
  height: 48px;
  font-size: 14px; font-weight: 600;
  color: var(--tpm-cta-text);
  background: transparent;
  border: 1px solid var(--tpm-cta);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background 0.12s ease;
}
.pdp-cta-secondary:hover { background: rgba(255, 153, 0, 0.08); }
body.dark-mode .pdp-cta-secondary,
.dark-mode .pdp-cta-secondary { color: var(--tpm-cta); }
.pdp-cta-secondary svg { width: 14px; height: 14px; }

/* Alerta */
.pdp-alert {
  background: var(--tpm-blue-soft);
  border: 1px solid var(--tpm-blue-soft-br);
  border-radius: 8px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.pdp-alert__head { display: flex; align-items: center; gap: 10px; }
.pdp-alert__icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--tpm-surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--tpm-blue-dark);
  flex-shrink: 0;
}
.pdp-alert__icon svg { width: 14px; height: 14px; }
body.dark-mode .pdp-alert__icon,
.dark-mode .pdp-alert__icon { color: var(--tpm-blue); }
.pdp-alert__title { font-size: 14px; font-weight: 600; color: var(--tpm-text); margin: 0; }
.pdp-alert__sub { font-size: 12px; color: var(--tpm-text-muted); margin: 0; }
.pdp-alert__form { display: flex; gap: 8px; flex-wrap: wrap; }
.pdp-alert__field { flex: 1; min-width: 140px; position: relative; }
.pdp-alert__input {
  width: 100%;
  height: 40px;
  padding: 0 32px 0 12px;
  font: inherit;
  font-size: 14px;
  color: var(--tpm-text);
  background: var(--tpm-surface);
  border: 1px solid var(--tpm-border);
  border-radius: 6px;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.pdp-alert__input:focus { border-color: var(--tpm-blue); }
.pdp-alert__currency {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--tpm-text-faint);
  pointer-events: none;
}
.pdp-alert__submit {
  appearance: none;
  border: 0;
  background: var(--tpm-blue);
  color: #fff;
  height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}
.pdp-alert__submit:hover { background: var(--tpm-blue-dark); }

/* Acciones inline */
.pdp-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.pdp-action {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--tpm-text-muted);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.12s ease;
}
.pdp-action:hover { color: var(--tpm-blue-dark); }
.pdp-action svg { width: 13px; height: 13px; }
body.dark-mode .pdp-action:hover,
.dark-mode .pdp-action:hover { color: var(--tpm-blue); }

/* Histórico: gráfica + tabla en 2 cols mismas proporciones que pdp-main */
.pdp-history {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: stretch;
  margin-bottom: 32px;
}
.pdp-history > section { margin-bottom: 0; height: 100%; display: flex; flex-direction: column; min-width: 0; }
.pdp-history .pdp-chart-section { padding-bottom: 28px; }
.pdp-history .pdp-chart-section > .pdp-chart-head { flex-shrink: 0; }
.pdp-history .pdp-chart-section > #evolution-graph { flex: 1; min-height: 0; }
.pdp-history .pdp-changes table { flex: 1; }

/* Chart */
.pdp-chart-section {
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  background: var(--tpm-surface);
  padding: 24px 24px 20px;
  margin-bottom: 32px;
}

/* c3.js overrides — anclar a tokens TPM */
#evolution-graph {
  font-family: var(--tpm-font);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
#evolution-graph svg {
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
}
.c3 .c3-axis text, .c3 .c3-tooltip th, .c3 .c3-tooltip td {
  font-family: var(--tpm-font);
  fill: var(--tpm-text-muted);
  font-size: 11.5px;
}
.c3 path.domain, .c3 .c3-axis line { stroke: var(--tpm-border-strong); }
.c3 .c3-grid line { stroke: var(--tpm-border); }
.c3 .c3-xgrid-focus { stroke: var(--tpm-text-faint); stroke-dasharray: 2 3; }
.c3 .c3-line { stroke-width: 2.4px; }
.c3 .c3-line-Precio { stroke: var(--tpm-blue); }
.c3 .c3-area { opacity: 0.18 !important; fill: var(--tpm-blue) !important; }
.c3 .c3-area-Precio { fill: var(--tpm-blue) !important; }
/* Tooltip color fijo (no var(--tpm-text)) — en dark mode --tpm-text es claro
   y producía un tooltip claro con texto claro, ilegible. */
.c3 .c3-tooltip {
  background: #1a1f2e;
  color: #fff;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.32);
  overflow: hidden;
}
.c3 .c3-tooltip th { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.95); padding: 6px 10px; font-weight: 600; }
.c3 .c3-tooltip td { background: transparent; color: #fff; padding: 6px 10px; }
.c3 .c3-tooltip td.name { color: rgba(255,255,255,0.85); }
.c3 .c3-tooltip td.value { font-weight: 600; font-variant-numeric: tabular-nums; }
.c3 .c3-grid .grid-minimo line { stroke: var(--tpm-stat-min); stroke-dasharray: 3 3; }
.c3 .c3-grid .grid-minimo text { fill: var(--tpm-stat-min); font-weight: 600; font-size: 10.5px; }
.c3 .c3-grid .grid-maximo line { stroke: var(--tpm-stat-max); stroke-dasharray: 3 3; }
.c3 .c3-grid .grid-maximo text { fill: var(--tpm-stat-max); font-weight: 600; font-size: 10.5px; }
.pdp-chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 14px;
}
.pdp-chart-head h2 {
  font-size: 16px; font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.pdp-chart { width: 100%; height: auto; aspect-ratio: 800 / 220; }
.pdp-chart__point circle:first-child { transition: r 0.15s ease; }
.pdp-chart__point:hover circle:first-child { r: 5; }

/* Tabla */
.pdp-changes {
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  background: var(--tpm-surface);
  overflow: hidden;
  margin-bottom: 32px;
}
.pdp-changes h2 {
  font-size: 16px; font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--tpm-border);
}
.pdp-changes table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pdp-changes thead th {
  text-align: left;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tpm-text-faint);
  padding: 12px 24px;
  background: var(--tpm-surface-alt);
  border-bottom: 1px solid var(--tpm-border);
}
.pdp-changes tbody td {
  padding: 14px 24px;
  border-bottom: 1px solid var(--tpm-border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.pdp-changes tbody tr:last-child td { border-bottom: none; }
.pdp-changes tbody tr:hover { background: var(--tpm-surface-alt); }
.pdp-changes__delta {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pdp-changes__delta svg { width: 9px; height: 9px; }
.pdp-changes__delta--down { background: var(--tpm-stat-min-bg); color: var(--tpm-stat-min); }
.pdp-changes__delta--up { background: var(--tpm-stat-max-bg); color: var(--tpm-stat-max); }
.pdp-changes__foot {
  padding: 14px 24px;
  font-size: 12px;
  color: var(--tpm-text-muted);
  background: var(--tpm-surface-alt);
}

/* Detalle: features + side */
.pdp-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-bottom: 56px;
}
.pdp-features {
  background: var(--tpm-surface);
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  padding: 24px 28px;
}
.pdp-features h2 {
  font-size: 16px; font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tpm-border);
}
.pdp-features ol {
  margin: 0; padding: 0 0 0 24px;
  display: flex; flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--tpm-text);
}
.pdp-features li::marker { color: var(--tpm-text-faint); font-variant-numeric: tabular-nums; }
.pdp-side { display: flex; flex-direction: column; gap: 16px; }
.pdp-side__card {
  background: var(--tpm-surface);
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  padding: 20px;
}
.pdp-side__card h3 {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tpm-text-faint);
  margin: 0 0 12px;
}
.pdp-side__card p { font-size: 13.5px; line-height: 1.55; margin: 0; color: var(--tpm-text); }
.pdp-side__card p.muted { color: var(--tpm-text-muted); }

/* Relacionados */
.pdp-related { margin-top: 8px; }
.pdp-related__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tpm-border);
  flex-wrap: wrap; gap: 12px;
}
.pdp-related__head h2 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.pdp-related__sub { font-size: 13.5px; color: var(--tpm-text-muted); margin: 0; }

/* Responsive */
@media (max-width: 980px) {
  .pdp-page { padding: 20px 16px 56px; max-width: 100%; overflow-x: hidden; }
  .pdp-page * { max-width: 100%; }
  .pdp-main { grid-template-columns: 1fr; gap: 28px; }
  .pdp-history { grid-template-columns: 1fr; gap: 24px; }
  .pdp-detail-grid { grid-template-columns: 1fr; gap: 16px; }
  .pdp-hd h1 { font-size: 24px; line-height: 1.25; }
  .pdp-hd { margin-bottom: 24px; }
  .pdp-img { aspect-ratio: 4 / 3; }
  .pdp-thumbs { grid-template-columns: repeat(5, 1fr); }
  .pdp-price__value { font-size: 20px; }
  .pdp-price { padding: 14px 12px; }
  .pdp-alert__form { flex-direction: column; align-items: stretch; }
  .pdp-alert__field { min-width: 0; width: 100%; }
  .pdp-alert__submit { width: 100%; }
  .pdp-cta-primary { height: 48px; font-size: 14px; }
  .pdp-cta-primary__sub { display: none; }
  .pdp-features { padding: 18px 18px; }
  .pdp-features ol { padding-left: 22px; }
}
@media (max-width: 640px) {
  .pdp-crumbs { font-size: 11.5px; gap: 4px; }
  .pdp-prices { grid-template-columns: 1fr; }
  .pdp-price + .pdp-price { border-left: none; border-top: 1px solid var(--tpm-border); }
  .pdp-changes { overflow-x: auto; }
  .pdp-changes table thead th,
  .pdp-changes table tbody td { padding: 10px 12px; font-size: 12px; }
  .pdp-actions { gap: 10px; flex-direction: column; align-items: flex-start; }
  .pdp-related__head h2 { font-size: 18px; }
  .pdp-related__head { flex-direction: column; align-items: flex-start; }
}
