/* ================================
   PALETA DE COLORES
=================================== */

:root {
  --verde-oscuro: #213832;
  --dorado: #f2c38f;
  --fondo: #f5f2eb;
  --texto: #213832;
  --texto-suave: #4b5563;
  --borde-suave: #e5e7eb;
  --error: #b3261e;
  --ok: #2f7d32;
}

/* ================================
   RESET BÁSICO
=================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* Evitar scroll horizontal en móvil por desbordes pequeños */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ================================
   TIPOGRAFÍA BASE
=================================== */

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--verde-oscuro);
}

p {
  margin-top: 0;
}

a {
  color: var(--verde-oscuro);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ================================
   HERO
=================================== */

.hero {
  background: var(--verde-oscuro);
  color: var(--dorado);
  padding: 2.1rem 1.25rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.4);
}

.hero-inner {
  max-width: 960px;
  margin: 0 auto;
}

.hero-title {
  font-size: 1.9rem;
  margin-bottom: 0.4rem;
  color: var(--dorado);
  letter-spacing: 0.03em;
}

.hero-subtitle {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  color: var(--dorado);
}

.hero-descripcion {
  max-width: 650px;
  margin: 0.5rem auto 0;
  font-size: 0.95rem;
  opacity: 0.95;
  color: var(--dorado);
}

/* ================================
   LAYOUT PRINCIPAL
=================================== */

.layout-principal {
  max-width: 960px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.25rem;
  width: 100%;
}

.cogs-calculator {
  position: relative;
}

.steps-indicator {
  font-size: 0.9rem;
  color: var(--texto-suave);
  margin-bottom: 0.75rem;
}

/* ================================
   TARJETAS
=================================== */

.card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  padding: 1.5rem 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  max-width: 100%;
}

.step-card {
  display: none;
}

.step-card.step-active {
  display: block;
}

.texto-intro {
  font-size: 0.95rem;
  color: var(--texto-suave);
  margin-bottom: 1.1rem;
}

/* ================================
   FORMULARIOS / GRID
=================================== */

.grid-dos-columnas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 720px) {
  .grid-dos-columnas {
    grid-template-columns: 1fr;
  }
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.campo label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--texto);
}

input[type="text"],
input[type="number"],
select {
  border-radius: 8px;
  border: 1px solid var(--borde-suave);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  background: #f9fafb;
  color: var(--texto);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease;
  width: 100%;
  max-width: 100%;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
  color: #9ca3af;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--verde-oscuro);
  box-shadow: 0 0 0 2px rgba(33, 56, 50, 0.18);
  background: #ffffff;
}

.nota-pequena {
  font-size: 0.8rem;
  color: #6b7280;
}

/* Modo velas: se oculta por defecto, se controla con JS */
.campo-velas {
  display: none;
}

/* ================================
   SLIDERS
=================================== */

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slider-row input[type="range"] {
  flex: 1;
}

.slider-row input[type="number"] {
  width: 80px;
}

/* ================================
   BOTONES
=================================== */

.btn-principal,
.btn-secundario,
.btn-agregar-ingrediente,
.btn-imprimir {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s,
    color 0.15s, filter 0.1s;
}

/* Botón principal */
.btn-principal {
  background: var(--verde-oscuro);
  color: var(--dorado);
  box-shadow: 0 8px 16px rgba(33, 56, 50, 0.35);
}

.btn-principal:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(33, 56, 50, 0.4);
}

.btn-principal:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(33, 56, 50, 0.3);
}

/* Secundario */

.btn-secundario {
  background: #ffffff;
  color: var(--texto);
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.btn-secundario:hover {
  background: #f9fafb;
}

/* Botón agregar cera */

.btn-agregar-ingrediente {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.9rem;
}

.btn-agregar-ingrediente:hover {
  background: #dcfce7;
}

/* Botón imprimir */

.btn-imprimir {
  background: #ffffff;
  color: var(--verde-oscuro);
  border: 1px dashed var(--verde-oscuro);
}

.btn-imprimir:hover {
  background: #f9fafb;
}

/* Botón eliminar fila (icono) */

.btn-delete-row {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 1rem;
  padding: 0.15rem;
}

.btn-delete-row:hover {
  color: #ef4444;
}

/* Deshabilitado */

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Contenedores de acciones */

.acciones-paso {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.acciones-paso--derecha {
  justify-content: flex-end;
}

.acciones-ingredientes {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ================================
   TABLAS
=================================== */

.tabla-ingredientes-wrapper {
  width: 100%;
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.tabla-ingredientes {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.9rem;
  /* 🔴 Quitamos min-width global para que no "rompa" el ancho en móvil */
  /* min-width: 640px; */
}

/* Encabezados generales (por defecto sin fondo) */
.tabla-ingredientes thead {
  background: transparent;
}

.tabla-ingredientes th,
.tabla-ingredientes td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
}

.tabla-ingredientes th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--texto);
}

/* Zebrados generales (para todas menos la de ceras) */
.tabla-ingredientes tbody tr:nth-child(even) {
  background: #f9fafb;
}

/* ---------- Tabla específica de ceras ---------- */

/* Solo sombreamos las dos primeras columnas del encabezado */
.tabla-ceras thead th:nth-child(1),
.tabla-ceras thead th:nth-child(2) {
  background: #f3f4f6;
}

/* La tercera celda de cabecera (vacía) sin fondo */
.tabla-ceras thead th:nth-child(3) {
  background: transparent;
}

/* En la tabla de ceras NO usamos zebrados para no confundir */
.tabla-ceras tbody tr:nth-child(even) {
  background: transparent;
}

/* Inputs dentro de la tabla de ceras */

.tabla-ingredientes select,
.tabla-ingredientes input[type="text"],
.tabla-ingredientes input[type="number"] {
  font-size: 0.85rem;
  padding: 0.3rem 0.45rem;
}

/* Celda de porcentaje, más compacta y % en línea */

.cell-percent .percent-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.cell-percent input[type="number"] {
  width: 80px;
}

/* Campo "otro" (cera personalizada) */

.input-custom-wax {
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

/* Tabla resumen */

.tabla-resumen th,
.tabla-resumen td {
  white-space: nowrap;
}

/* ================================
   RESUMEN / MENSAJES
=================================== */

.resumen-porcentaje {
  margin-bottom: 1rem;
}

.mensaje-porcentaje {
  font-size: 0.9rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #facc15;
}

.mensaje-porcentaje.ok {
  background: #ecfdf3;
  color: #166534;
  border-color: #22c55e;
}

/* Resumen imprimible */

.print-summary {
  margin-top: 1.25rem;
}

.summary-content {
  font-size: 0.9rem;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  border: 1px solid #e5e7eb;
}

/* ================================
   ESTADOS DE ERROR
=================================== */

.input-error {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 2px rgba(179, 38, 30, 0.18) !important;
}

/* ================================
   RESPONSIVE
=================================== */

@media (max-width: 600px) {
  .layout-principal {
    max-width: 100%;
    padding: 0 0.9rem;
  }

  .card {
    padding: 1.2rem 1rem 1.4rem;
    max-width: 100%;
  }

  .acciones-paso {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-principal,
  .btn-secundario,
  .btn-imprimir {
    width: 100%;
    justify-content: center;
  }

  .acciones-ingredientes {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-descripcion {
    font-size: 0.9rem;
  }

  /* Tablas ocupan todo el ancho y sin ancho mínimo obligatorio */
  .tabla-ingredientes {
    width: 100%;
    max-width: 100%;
    font-size: 0.82rem;
    table-layout: auto;
  }

  .cell-percent input[type="number"] {
    width: 70px;
  }
}

/* Ajustes extra para móvil muy pequeño (iPhone, etc.) */

@media (max-width: 480px) {
  .layout-principal {
    max-width: 100%;
    padding: 0 0.75rem;
    margin-bottom: 1.5rem;
  }

  .card {
    padding: 1rem 0.85rem 1.2rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  .texto-intro {
    font-size: 0.9rem;
  }

  .nota-pequena {
    font-size: 0.78rem;
  }

  /* Inputs un poquito más compactos */
  input[type="text"],
  input[type="number"],
  select {
    font-size: 0.88rem;
    padding: 0.5rem 0.65rem;
  }

  .slider-row input[type="number"] {
    width: 68px;
  }

  /* Tablas aún más compactas en iPhone */
  .tabla-ingredientes {
    width: 100%;
    max-width: 100%;
    font-size: 0.8rem;
  }

  .tabla-ingredientes th,
  .tabla-ingredientes td {
    padding: 0.35rem 0.4rem;
  }

  .cell-percent input[type="number"] {
    width: 64px;
  }

  .tabla-resumen {
    font-size: 0.8rem;
  }

  .hero {
    padding: 1.7rem 1rem;
  }

  .hero-title {
    font-size: 1.4rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-descripcion {
    font-size: 0.85rem;
  }
}

/* ================================
   IMPRESIÓN
=================================== */

@media print {
  body {
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border-radius: 0;
  }

  .layout-principal {
    margin: 0;
    max-width: 100%;
    padding: 0;
  }

  .summary-content {
    border-radius: 0;
    border: none;
    padding: 0;
  }
}
