/* ================================
   TABLA CARRITO — MOBILE FIRST
   ================================ */

/* Base (móvil): la "tabla" se convierte en tarjetas */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Ocultar cabecera en móvil */
.cart-table thead {
  display: none;
}

/* Cada fila: bloque tipo tarjeta */
.cart-table tbody tr {
  display: block;
  border-bottom: 2px solid #eee;
  padding: 12px;
}

/* Cada celda: bloque por defecto */
.cart-table td {
  display: block;
  padding: 4px 0;
  border-bottom: none;
  text-align: left;
}

/* Columna Formato: siempre oculta en móvil */
.cart-table td:nth-child(2),
.hide-mobile {
  display: none;
}

/* Fila inferior: Precio + Cantidad + Subtotal + Eliminar en línea */
.cart-table td:nth-child(3),
.cart-table td:nth-child(4),
.cart-table td:nth-child(5),
.cart-table td:nth-child(6) {
  display: inline-block;
  vertical-align: middle;
  padding: 4px 6px;
}

.cart-table td:nth-child(3) { /* Precio */
  font-weight: 600;
  color: #2c3e50;
}

.cart-table td:nth-child(5) { /* Subtotal */
  font-weight: 700;
  color: #2c3e50;
}

/* Imagen más pequeña en móvil */
.cart-item-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.cart-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Control de cantidad compacto */
.qty-control {
  display: flex;
  gap: 4px;
  align-items: center;
}

.qty-control button {
  padding: 2px 7px;
  cursor: pointer;
}

.qty-control input {
  width: 38px;
  text-align: center;
  padding: 3px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Acciones del pie en columna en móvil */
.cart-actions-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.cart-actions-bottom a {
  text-align: center;
}

/* Formulario promo adaptado */
.promo-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.promo-inline-form input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#promo-msg {
  font-weight: bold;
}

/* Contenedores */
.promo-container {
  margin-bottom: 20px;
  padding: 20px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.totals-container {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  text-align: right;
}

.totals-row {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  margin-bottom: 10px;
  font-size: 16px;
}

.total-final {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
  border-top: 2px solid #eee;
  padding-top: 10px;
  margin-top: 10px;
}

/* CARRITO VACÍO */
.empty-cart-container {
  text-align: center;
  padding: 50px 0;
}

.empty-cart-icon {
  font-size: 50px;
  color: #ccc;
  margin-bottom: 20px;
}

.empty-cart-text {
  font-size: 18px;
  color: #666;
  margin-bottom: 20px;
}

/* Quitar flechas de inputs de número */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

/* ================================
   TABLET / ESCRITORIO (
   ================================ */
@media (min-width: 768px) {
  /* Restaurar tabla normal */
  .cart-table thead {
    display: table-header-group;
  }

  .cart-table th {
    background: #f8f9fa;
  }

  .cart-table th,
  .cart-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
  }

  .cart-table tbody tr {
    display: table-row;
    border-bottom: none;
    padding: 0;
  }

  .cart-table td {
    display: table-cell;
    padding: 15px;
  }

  /* Mostrar columna Formato */
  .cart-table th:nth-child(2),
  .cart-table td:nth-child(2),
  .hide-mobile {
    display: table-cell;
  }

  /* Restaurar inline de la fila inferior a table-cell */
  .cart-table td:nth-child(3),
  .cart-table td:nth-child(4),
  .cart-table td:nth-child(5),
  .cart-table td:nth-child(6) {
    display: table-cell;
    vertical-align: middle;
    padding: 15px;
  }

  /* Imagen tamaño normal */
  .cart-item-img {
    width: 60px;
    height: 60px;
  }

  /* Qty control espaciado normal */
  .qty-control {
    gap: 10px;
  }

  .qty-control input {
    width: 50px;
    padding: 5px;
  }

  .qty-control button {
    padding: 2px 8px;
  }

  /* Acciones en fila */
  .cart-actions-bottom {
    flex-direction: row;
    justify-content: flex-end;
    gap: 15px;
  }

  .cart-actions-bottom a {
    text-align: left;
  }
}