/* =========================================================
 * Modo Transparencia — QuVi
 * Integrado con el design system claro de core.css
 * ========================================================= */

/* ─── Container ─────────────────────────────────────────── */
#transparencia-panel {
  display: none;
  flex-direction: column;
  gap: var(--s-24, 20px);
  padding: 0;
  padding-bottom: 40px;
  animation: mt-fadeIn 0.45s ease-out;
}

@keyframes mt-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── 2-Column Layout ───────────────────────────────────── */
.mt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-20, 18px);
  align-items: stretch;
}

.mt-col-left,
.mt-col-right {
  display: flex;
  flex-direction: column;
  gap: var(--s-20, 18px);
}

/* ─── Section Cards ─────────────────────────────────────── */
.mt-section {
  background: var(--surface, #fff);
  border: 1px solid var(--separator, #e6eaf0);
  border-radius: var(--r-16, 16px);
  padding: var(--s-20, 18px);
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(0,0,0,.06));
  transition: box-shadow 0.2s;
}

.mt-section:hover {
  box-shadow: var(--shadow-m, 0 6px 16px rgba(0,0,0,.08));
}

.mt-section + .mt-section {
  animation: mt-fadeIn 0.45s ease-out both;
}
.mt-col-left .mt-section:nth-child(2) { animation-delay: 0.08s; }
.mt-col-right .mt-section:nth-child(1) { animation-delay: 0.05s; }
.mt-col-right .mt-section:nth-child(2) { animation-delay: 0.12s; }

/* ─── Section Header ────────────────────────────────────── */
.mt-section-header {
  display: flex;
  align-items: center;
  gap: var(--s-12, 10px);
  margin-bottom: var(--s-16, 14px);
}

.mt-section-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-10, 10px);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mt-section-icon svg,
.mt-lucide-icon svg,
.mt-lucide-icon {
  width: 17px;
  height: 17px;
}

.mt-section-icon--ranking {
  background: color-mix(in oklch, var(--brand) 12%, var(--surface));
  color: var(--brand);
}

.mt-section-icon--filosofia {
  background: color-mix(in oklch, oklch(0.72 0.15 250) 12%, var(--surface));
  color: oklch(0.55 0.15 250);
}

.mt-section-icon--lab {
  background: color-mix(in oklch, var(--success) 14%, var(--surface));
  color: oklch(0.50 0.14 145);
}

.mt-section-icon--mercado {
  background: color-mix(in oklch, oklch(0.65 0.16 300) 12%, var(--surface));
  color: oklch(0.50 0.16 300);
}

.mt-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--label, #111827);
  line-height: 1.2;
}

.mt-section-subtitle {
  font-size: 0.75rem;
  color: var(--secondary, #6b7280);
  margin-top: 1px;
}

/* ─── S1: Top 3 Narrado ────────────────────────────────── */
.mt-top3-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-12, 10px);
}

.mt-top-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto auto auto auto;
  gap: 2px 10px;
  padding: var(--s-14, 12px);
  border-radius: var(--r-10, 10px);
  background: color-mix(in oklch, var(--fill, #f4f6fa) 60%, var(--surface, #fff));
  border: 1px solid var(--separator);
  transition: background 0.2s;
}

.mt-top-card:hover {
  border-color: color-mix(in oklch, var(--brand) 25%, transparent);
  background: color-mix(in oklch, var(--brand) 3%, var(--fill));
}

.mt-top-rank {
  grid-row: 1 / 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  align-self: start;
  margin-top: 2px;
  position: relative;
  overflow: hidden;
}

/* Oro / Plata / Bronce — matching ribbon--rank gold */
.mt-top-rank--1 {
  background: linear-gradient(180deg, oklch(0.85 0.14 95 / 0.95), oklch(0.75 0.22 90 / 0.95), oklch(0.65 0.18 85 / 0.95));
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.3);
}
.mt-top-rank--1::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 200%;
  background: linear-gradient(115deg, transparent 0%, transparent 30%, rgba(255,255,255,0.4) 50%, transparent 70%, transparent 100%);
  transform: translateX(-100%);
  animation: mt-shimmer 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes mt-shimmer {
  0% { transform: translateX(-100%); }
  30%, 100% { transform: translateX(100%); }
}
.mt-top-rank--2 {
  background: linear-gradient(180deg, oklch(0.82 0.01 250), oklch(0.72 0.02 250), oklch(0.62 0.02 250));
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.mt-top-rank--3 {
  background: linear-gradient(180deg, oklch(0.72 0.10 55), oklch(0.60 0.12 50), oklch(0.50 0.10 45));
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.mt-top-isapre {
  font-size: 0.60rem;
  font-weight: 600;
  color: color-mix(in oklch, var(--secondary) 65%, var(--surface, #fff));
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.mt-top-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--label, #111827);
}

.mt-top-nota {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.71rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  margin-top: 3px;
  width: fit-content;
  border: 1px solid;
}

/* Gold (nota ≥ 6), Blue (nota ≥ 5), Gray (resto) */
.mt-top-nota--gold {
  background: color-mix(in oklch, oklch(0.80 0.14 90) 12%, var(--surface));
  color: oklch(0.42 0.10 83);
  border-color: color-mix(in oklch, oklch(0.78 0.14 90) 28%, transparent);
}
.mt-top-nota--blue {
  background: color-mix(in oklch, oklch(0.70 0.14 250) 10%, var(--surface));
  color: oklch(0.46 0.12 250);
  border-color: color-mix(in oklch, oklch(0.68 0.14 250) 22%, transparent);
}
.mt-top-nota--gray {
  background: var(--fill);
  color: var(--secondary);
  border-color: var(--separator);
}

.mt-top-narrative {
  grid-column: 2;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-3, #374151);
  margin-top: var(--s-6, 5px);
}

.mt-top-badges {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: var(--s-6, 5px);
}

.mt-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

.mt-badge--ok   { background: var(--success-soft); color: var(--success-ink); }
.mt-badge--info { background: color-mix(in oklch, var(--brand) 10%, var(--surface)); color: oklch(0.50 0.12 250); }
.mt-badge--warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ─── S2: Filosofía ─────────────────────────────────────── */
.mt-filosofia-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-12, 10px);
}

.mt-pilar {
  padding: var(--s-12, 10px) var(--s-14, 12px);
  border-radius: var(--r-12, 12px);
  background: color-mix(in oklch, var(--fill, #f4f6fa) 60%, var(--surface, #fff));
}

.mt-pilar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.mt-pilar-emoji {
  font-size: 1.1rem;
}

.mt-pilar-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--label, #111827);
}

.mt-pilar-pct {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 20px;
  margin-left: 6px;
  background: color-mix(in oklch, var(--brand) 8%, var(--surface));
  color: oklch(0.50 0.12 250);
  border: 1px solid color-mix(in oklch, oklch(0.68 0.14 250) 18%, transparent);
}

.mt-pilar-desc {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-3, #374151);
  margin-bottom: 8px;
}

.mt-pilar-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--separator, #e6eaf0);
  overflow: hidden;
}

.mt-pilar-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.mt-pilar-bar-fill--prot { background: var(--brand); }
.mt-pilar-bar-fill--red  { background: var(--success); }
.mt-pilar-bar-fill--econ { background: var(--warn); }

/* ─── S3: Laboratorio ───────────────────────────────────── */
.mt-lab-selector {
  display: flex;
  gap: 6px;
  margin-bottom: var(--s-14, 12px);
  flex-wrap: wrap;
}

.mt-lab-chip {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--separator, #e6eaf0);
  background: var(--surface, #fff);
  color: var(--secondary, #6b7280);
  cursor: pointer;
  transition: all 0.2s;
}

.mt-lab-chip:hover {
  border-color: var(--brand);
  color: var(--label);
}

.mt-lab-chip[aria-selected="true"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Lab: contexto del plan #1 */
.mt-lab-plan-ctx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: color-mix(in oklch, var(--brand) 5%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--brand) 15%, var(--separator));
  border-radius: var(--r-10, 10px);
  margin-bottom: 14px;
}

.mt-lab-plan-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--label);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mt-lab-plan-nota {
  font-size: 0.72rem;
  color: var(--secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.mt-lab-sliders {
  display: flex;
  flex-direction: column;
  gap: var(--s-16, 14px);
}

.mt-slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 8px;
  align-items: center;
}

.mt-slider-meta {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mt-slider-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--label);
}

.mt-slider-hint {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--secondary);
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.mt-slider-input {
  -webkit-appearance: none;
  appearance: none;
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--separator, #e6eaf0);
  outline: none;
  cursor: pointer;
}

.mt-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 0.15s;
}

.mt-slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.mt-slider-value {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--label);
  min-width: 58px;
  text-align: right;
}

/* Resultado before / after */
.mt-lab-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-10, 10px);
  background: var(--fill);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 12px;
}

.mt-lab-result-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.mt-lab-result-col--before { opacity: 0.6; }

.mt-lab-result-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
}

.mt-lab-result-nota {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--label);
  transition: color 0.2s;
  transform-origin: center;
}

.mt-lab-result-nota--base { color: var(--secondary); font-size: 1.3rem; }
.mt-lab-result-nota--up   { color: oklch(0.50 0.18 145); }
.mt-lab-result-nota--down { color: oklch(0.52 0.18 20); }

.mt-lab-result-arrow {
  font-size: 1.2rem;
  color: var(--secondary);
  transition: color 0.2s;
  flex-shrink: 0;
}

.mt-lab-result-arrow--up   { color: oklch(0.50 0.18 145); }
.mt-lab-result-arrow--down { color: oklch(0.52 0.18 20); }

.mt-lab-result-delta {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 1px;
}

.mt-lab-result-delta--up   { color: oklch(0.55 0.14 145); }
.mt-lab-result-delta--down { color: var(--error); }
.mt-lab-result-delta--same { color: var(--secondary); }

.mt-lab-insight {
  margin-top: var(--s-10, 8px);
  padding: var(--s-10, 8px) var(--s-12, 10px);
  border-radius: var(--r-8, 8px);
  background: var(--warn-bg);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--warn-ink);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.mt-lab-insight::before {
  content: "💡";
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ─── S4: Radiografía del Mercado ───────────────────────── */
.mt-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-10, 8px);
  margin-bottom: var(--s-16, 14px);
}

.mt-kpi {
  padding: var(--s-12, 10px) var(--s-10, 8px);
  border-radius: var(--r-10, 10px);
  background: var(--surface);
  border: 1.5px dashed color-mix(in oklch, var(--brand) 22%, var(--separator));
  text-align: center;
  transition: border-color 0.2s;
}

.mt-kpi:hover {
  border-color: color-mix(in oklch, var(--brand) 40%, var(--separator));
}

.mt-kpi-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--label);
  letter-spacing: -0.02em;
}

.mt-kpi-label {
  font-size: 0.64rem;
  color: var(--secondary);
  margin-top: 3px;
  line-height: 1.25;
  font-weight: 500;
}

.mt-mercado-context {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-3);
  margin-bottom: var(--s-12, 10px);
}

/* Histogram */
.mt-histo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--s-12, 10px);
}

.mt-histo-row {
  display: grid;
  grid-template-columns: 36px 1fr 105px;
  gap: 8px;
  align-items: center;
}

.mt-histo-label {
  font-size: 0.68rem;
  color: var(--secondary);
  text-align: right;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mt-histo-bar {
  height: 14px;
  border-radius: 6px;
  background: color-mix(in oklch, var(--separator) 70%, var(--fill));
  overflow: hidden;
}

.mt-histo-fill {
  height: 100%;
  width: 0; /* starts at 0, animated by GSAP */
  border-radius: 6px;
  background: color-mix(in oklch, oklch(0.65 0.14 260) 55%, var(--separator));
}

.mt-histo-fill--highlight {
  background: linear-gradient(90deg, oklch(0.60 0.18 250), oklch(0.68 0.20 240));
  box-shadow: 0 0 6px color-mix(in oklch, oklch(0.65 0.18 245) 40%, transparent);
}

.mt-histo-pct {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--label);
  white-space: nowrap;
}

.mt-histo-marker {
  font-size: 0.65rem;
  color: var(--brand);
  font-weight: 700;
  display: inline-block;
}

/* Posición insight */
.mt-mercado-insight {
  margin-top: var(--s-12, 10px);
  padding: var(--s-10, 8px) var(--s-12, 10px);
  border-radius: var(--r-8, 8px);
  background: color-mix(in oklch, var(--brand) 6%, var(--surface));
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-3);
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 780px) {
  .mt-grid {
    grid-template-columns: 1fr;
  }

  .mt-slider-row {
    grid-template-columns: 80px 1fr auto;
  }

  .mt-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
