/* ============================================================
   TEMA MODERNO
   Se carga al final: refina tipografía, superficies y estados
   manteniendo la paleta original (marrón, dorado y crema).
   ============================================================ */

:root {
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ring: 0 0 0 3px rgba(180, 135, 58, 0.22);
  --shadow-sm: 0 2px 8px rgba(61, 42, 30, 0.06);
  --shadow-md: 0 10px 28px rgba(61, 42, 30, 0.10);
  --shadow-lg: 0 24px 60px rgba(30, 20, 12, 0.28)
}

body {
  font-family: var(--font-ui);
  letter-spacing: -0.005em
}

h1, h2, h3 {
  letter-spacing: -0.02em
}

/* Accesibilidad: foco visible y motion reducido */
:where(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important
  }
}

/* ============================================================ BUSCADOR CON X */

.buscador-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 520px;
  width: min(100%, 520px)
}

.buscador-icono {
  position: absolute;
  left: 14px;
  font-size: 14px;
  opacity: .5;
  pointer-events: none
}

.buscador-wrap #busqueda,
.buscador-wrap input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 0 44px 0 38px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fffdfa;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s
}

.buscador-wrap input:focus {
  border-color: var(--gold);
  box-shadow: var(--ring)
}

.btn-limpiar {
  position: absolute;
  right: 8px;
  width: 30px;
  height: 30px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1;
  transition: background .15s, color .15s, transform .15s
}

.btn-limpiar.visible {
  display: grid
}

.btn-limpiar:hover {
  background: var(--primary);
  color: #fff8ef;
  transform: rotate(90deg)
}

/* ============================================================ ESTADOS DE STOCK */

.pill-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.5
}

.pill-stock.en-stock {
  background: #e2f2e6;
  color: var(--green-2)
}

.pill-stock.agotado {
  background: #f7e2dc;
  color: var(--danger-2)
}

.pill-stock.mini {
  font-size: 10px;
  padding: 2px 7px
}

.card-agotada {
  border-color: rgba(198, 92, 66, .28);
  background: linear-gradient(180deg, rgba(198, 92, 66, .05), transparent 60px)
}

/* Se atenúa solo la foto y el nombre: los botones quedan
   con su color normal para que sigan viéndose activos */
.card-agotada .card-info h3,
.card-agotada .card-info p {
  opacity: .72
}

.card-agotada .precio-item {
  opacity: .78
}

.card-agotada .producto-img {
  filter: grayscale(.55)
}

.card-badge-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap
}

.detalle-estado {
  margin-bottom: 10px
}

/* ============================================================ SWITCH EN STOCK / AGOTADO */

.switch-stock {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px !important;
  cursor: pointer;
  user-select: none
}

.switch-stock input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0
}

.switch-pista {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: var(--danger);
  transition: background .2s;
  flex-shrink: 0
}

.switch-bolita {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform .2s
}

.switch-stock input:checked + .switch-pista {
  background: var(--green)
}

.switch-stock input:checked + .switch-pista .switch-bolita {
  transform: translateX(22px)
}

.switch-texto .txt-si {
  display: none
}

.switch-stock input:checked ~ .switch-texto .txt-si {
  display: inline
}

.switch-stock input:checked ~ .switch-texto .txt-no {
  display: none
}

.switch-texto {
  font-weight: 700;
  color: var(--text);
  font-size: 14px
}

/* ============================================================ TABS (soporta 4 pestañas) */

.tabs-app {
  gap: 10px
}

.tab-btn {
  border-radius: var(--radius-md);
  border: 1px solid rgba(180, 135, 58, 0.18);
  transition: transform .15s, box-shadow .15s, background .2s, color .2s
}

.tab-btn.activa {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 20px rgba(78, 52, 46, 0.24)
}

@media(max-width:768px) {
  .tabs-bottom-mobile {
    grid-template-columns: unset;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 8px
  }

  .tab-btn {
    flex-direction: column;
    gap: 3px !important;
    padding: 6px 4px;
    min-height: 52px
  }

  .tab-texto {
    font-size: 10.5px !important
  }

  /* El buscador ocupa toda la fila en móvil */
  .buscador-wrap {
    grid-column: 1/-1;
    flex: none;
    width: 100%;
    max-width: 100%
  }

  .buscador-wrap #busqueda,
  .buscador-wrap input[type="text"] {
    min-height: 42px;
    font-size: 14px;
    border-radius: 13px
  }
}

/* ============================================================ TARJETAS Y SUPERFICIES */

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s, border-color .16s
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong)
}

.card-info h3 {
  text-transform: capitalize
}

.precio-item {
  border-radius: 10px
}

.precio-item .valor {
  font-variant-numeric: tabular-nums
}

.panel-modulo {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm)
}

.btn-principal,
.btn-secundario {
  border-radius: 13px;
  transition: transform .14s, box-shadow .14s, filter .14s
}

.btn-principal:hover {
  transform: translateY(-1px);
  filter: brightness(1.04)
}

/* ============================================================ ESTADOS VACÍOS Y CARGA */

.estado-vacio {
  grid-column: 1/-1;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 36px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--text-soft);
  text-align: center
}

.estado-vacio-icono {
  font-size: 30px;
  opacity: .7
}

.estado-vacio p {
  margin: 0;
  font-size: 14px;
  max-width: 320px
}

.cargando {
  grid-column: 1/-1;
  padding: 22px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px
}

.sin-presentaciones {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-soft)
}

/* ============================================================ MODALES */

.modal {
  backdrop-filter: blur(3px)
}

.modal-contenido {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg)
}

.modal-contenido h2 {
  letter-spacing: -0.02em
}

.modal-contenido input,
.modal-contenido select,
.modal-contenido textarea {
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s
}

/* ============================================================ ZONA DE ACCIONES PELIGROSAS */

.acciones-peligrosas {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(198, 92, 66, .35);
  border-radius: var(--radius-md);
  background: #fdf4f1
}

.aviso-peligro {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft)
}

.aviso-peligro strong {
  color: var(--danger-2)
}

.fila-acciones-peligrosas {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.btn-desactivar-producto,
.btn-eliminar-producto {
  flex: 1 1 180px;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13.5px;
  transition: filter .15s, transform .12s
}

.btn-desactivar-producto {
  background: #fff;
  color: var(--danger-2);
  border: 1px solid var(--danger)
}

.btn-desactivar-producto:hover {
  background: #f9e7e1
}

.btn-eliminar-producto {
  background: var(--danger-2);
  color: #fff;
  border: 1px solid var(--danger-2)
}

.btn-eliminar-producto:hover {
  filter: brightness(1.08);
  transform: translateY(-1px)
}
