/* ============================================================
 * theme.css — TEMA: Estados de la materia
 * Prefijo propio: "est-"
 * Usa solo var(--guia-*) de la capa compartida; sin hex de marca.
 * ============================================================ */

/* ---- Tabla comparativa (M6) ---- */
.est-tabla-comp {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 1rem 0;
  overflow-x: auto;
  display: block;
}

.est-tabla-comp th,
.est-tabla-comp td {
  border: 1px solid var(--guia-line);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  font-size: 15px;
  line-height: 1.4;
}

.est-tabla-comp thead th {
  background: var(--guia-navy);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.est-fila-solido td:first-child {
  color: var(--guia-navy);
  font-weight: 700;
}

.est-fila-liquido td:first-child {
  color: var(--guia-deep);
  font-weight: 700;
}

.est-fila-gas td:first-child {
  color: var(--guia-green);
  font-weight: 700;
}

.est-fila-plasma td:first-child {
  color: var(--guia-orange);
  font-weight: 700;
}

.est-tabla-comp tbody tr:nth-child(even) {
  background: var(--guia-cream);
}

/* ---- Simulador de partículas (sim-particulas) ---- */
.est-sim-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
}

.est-sim-canvas {
  width: 100%;
  max-width: 480px;
  height: 220px;
  border: 1px solid var(--guia-line);
  border-radius: 8px;
  background: var(--guia-cream);
  display: block;
}

.est-sim-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
}

.est-sim-slider {
  width: 100%;
  accent-color: var(--guia-orange);
  cursor: pointer;
}

.est-sim-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 13px;
  color: var(--guia-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.est-sim-estado {
  font-size: 17px;
  font-weight: 700;
  color: var(--guia-orange);
  min-height: 1.5em;
  text-align: center;
}

/* ---- Rueda de cambios (rueda-cambios) ---- */
.est-rueda-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.est-rueda-svg-wrap {
  width: 100%;
  max-width: 400px;
}

.est-rueda-svg {
  width: 100%;
  height: auto;
}

/* Nodos de estado en la rueda */
.est-rueda-nodo {
  cursor: default;
}

.est-rueda-nodo text {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  fill: #fff;
  letter-spacing: 0.04em;
}

/* Flechas de transición */
.est-rueda-flecha {
  cursor: pointer;
  transition: opacity 0.15s;
}

.est-rueda-flecha:hover {
  opacity: 0.8;
}

.est-rueda-flecha.est-activa path,
.est-rueda-flecha.est-activa line,
.est-rueda-flecha.est-activa polyline {
  stroke-width: 3;
}

/* Panel de información al tocar flecha */
.est-rueda-panel {
  width: 100%;
  max-width: 400px;
  min-height: 80px;
  border: 1px solid var(--guia-line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--guia-cream);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.est-rueda-panel:empty::before {
  content: "Toca una flecha de la rueda para ver el cambio de estado";
  color: var(--guia-muted);
  font-size: 15px;
}

.est-rueda-panel-nombre {
  font-size: 17px;
  font-weight: 700;
  color: var(--guia-navy);
}

.est-panel-endo {
  color: var(--guia-deep);
  font-weight: 600;
  font-size: 15px;
}

.est-panel-exo {
  color: var(--guia-orange);
  font-weight: 600;
  font-size: 15px;
}

.est-rueda-panel-ejemplo {
  color: var(--guia-muted);
  font-size: 15px;
}

/* ---- Retos de identificación (reto-cambio) ---- */
.est-reto-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0.5rem 0;
}

.est-reto-item {
  border: 1px solid var(--guia-line);
  border-radius: 8px;
  overflow: hidden;
}

.est-reto-fenomeno {
  background: var(--guia-cream);
  padding: 0.85rem 1rem;
  font-size: 17px;
  line-height: 1.5;
  color: var(--guia-ink);
  border-bottom: 1px solid var(--guia-line);
}

.est-reto-opciones {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.est-reto-opcion {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 17px;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: none;
  border-top: 1px solid var(--guia-line);
  cursor: pointer;
  color: var(--guia-navy);
  transition: background 0.12s;
}

.est-reto-opcion:hover {
  background: var(--guia-cream);
}

.est-reto-opcion:first-child {
  border-top: none;
}

.est-reto-opcion.est-opcion-ok {
  background: #d1fae5;
  color: #065f46;
  cursor: default;
}

.est-reto-opcion.est-opcion-miss {
  background: #fee2e2;
  color: #991b1b;
  cursor: default;
}

.est-reto-feedback {
  padding: 0.75rem 1rem;
  font-size: 15px;
  line-height: 1.5;
  border-top: 1px solid var(--guia-line);
  display: none;
}

.est-reto-feedback.est-visible {
  display: block;
}

.est-reto-feedback.est-fb-ok {
  background: #ecfdf5;
  color: #065f46;
}

.est-reto-feedback.est-fb-miss {
  background: #fff7ed;
  color: #92400e;
}

/* ---- Utilidades generales del tema ---- */
.est-etiqueta-estado {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.est-etiqueta-solido  { background: #e0e7ff; color: #1B3A6B; }
.est-etiqueta-liquido { background: #dbeafe; color: #1e40af; }
.est-etiqueta-gas     { background: #e0f2fe; color: #0369a1; }
.est-etiqueta-plasma  { background: #fff7ed; color: #92400e; }

/* ---- Leyenda de color de los estados (renderLegend) ---- */
.est-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  align-items: center;
}

.est-legend .it {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 15px;
}

.est-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: 0 0 auto;
}

/* ---- Fila del slider de temperatura (simulador) ---- */
.est-sim-slider-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.est-sim-slider-row .est-sim-slider {
  flex: 1 1 auto;
  min-width: 0;
}

.est-sim-cold,
.est-sim-hot {
  font-size: 18px;
  flex: 0 0 auto;
  line-height: 1;
}

/* ---- Leyenda de calor de la rueda (endo/exo) ---- */
.est-rueda-leyenda-calor {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.1rem;
  font-size: 13px;
  color: var(--guia-muted);
}

.est-rueda-leyenda-calor span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.est-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

/* ---- Numerito de cada reto (M12) ---- */
.est-reto-num {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--guia-deep);
  margin-right: 0.5rem;
}

@media (max-width: 480px) {
  .est-tabla-comp th,
  .est-tabla-comp td {
    padding: 0.45rem 0.5rem;
    font-size: 15px;
  }

  .est-tabla-comp thead th {
    font-size: 13px;
  }

  .est-sim-canvas {
    height: 180px;
  }
}

@media print {
  .est-sim-wrap,
  .est-rueda-wrap,
  .est-reto-wrap {
    display: none !important;
  }
}
