/* modal.css — Estilos del modal carrito (compartido pedido.html + mas18.html) */

/* ============ BASE DEL MODAL ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeInModal .22s ease-out;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal.hidden { display: none !important; }

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  animation: slideUpModal .28s cubic-bezier(.16, 1, .3, 1);
  position: relative;
}

@keyframes slideUpModal {
  from {
    transform: translateY(40px) scale(.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-carrito-content {
  padding: 0;
}

.modal-paso {
  padding: 22px 24px 24px;
}
.modal-paso.hidden {
  display: none !important;
}

/* ============ HEADER DEL MODAL ============ */
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eee;
}
.modal-header h2 {
  flex: 1;
  font-size: 1.15rem;
  font-weight: 700;
  color: #2c2c2c;
  margin: 0;
}
.btn-cerrar,
.btn-atras {
  background: #f8f5f7;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: #2c2c2c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.btn-cerrar:hover,
.btn-atras:hover {
  background: #ece6ea;
}
.btn-atras { font-size: 1.1rem; }

/* ============ ITEMS DEL CARRITO ============ */
.carrito-items {
  margin-bottom: 16px;
  max-height: 40vh;
  overflow-y: auto;
}
.carrito-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  font-size: .9rem;
}

.carrito-item:last-child { border-bottom: none; }
.item-nombre {
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.carrito-items-18 .item-nombre {
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-cant {
  display: flex;
  align-items: center;
  gap: 6px;
}
.item-cant button {
  background: #f8f5f7;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  font-size: .9rem;
  color: #2c2c2c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.item-cant button:hover {
  background: #d6336c;
  color: #fff;
}
.item-cant span {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
}
.item-subtotal {
  font-weight: 700;
  color: #d6336c;
  white-space: nowrap;
}
.item-eliminar {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  opacity: .6;
  transition: opacity .2s;
}
.item-eliminar:hover { opacity: 1; }

/* ============ CARRITO VACÍO ============ */
.carrito-vacio {
  text-align: center;
  padding: 30px 0;
  color: #666;
}
.carrito-vacio p {
  margin-bottom: 16px;
  font-size: .95rem;
}

/* ============ TOTALES ============ */
.carrito-totales {
  padding: 14px 0;
  border-top: 2px dashed #eee;
  margin-bottom: 14px;
}
.linea {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: .92rem;
  color: #666;
}
.linea.total {
  font-weight: 700;
  color: #2c2c2c;
  font-size: 1.1rem;
  padding-top: 10px;
  border-top: 1px solid #eee;
  margin-top: 8px;
}
.linea.hidden { display: none !important; }

/* ============ AVISO MÍNIMO ============ */
.aviso-minimo {
  background: #fff3cd;
  color: #856404;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .85rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.aviso-minimo.hidden { display: none !important; }

/* ============ BOTONES ============ */
.btn-primario.btn-full {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  border-radius: 50px;
  font-weight: 700;
}

/* ============ SUGERENCIAS ============ */
.carrito-sugerencias {
  margin: 14px 0;
  padding: 14px;
  background: #f8f5f7;
  border-radius: 14px;
  border: 1px dashed rgba(214, 51, 108, .3);
}
.carrito-sugerencias h4 {
  font-size: .88rem;
  color: #2c2c2c;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sugerencias-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sug-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.sug-card:hover {
  border-color: #d6336c;
  transform: translateX(4px);
}
.sug-card img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.sug-card > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sug-card strong {
  font-size: .85rem;
  color: #2c2c2c;
}
.sug-card span {
  font-size: .78rem;
  color: #d6336c;
  font-weight: 700;
}
.sug-card i {
  color: #d6336c;
  font-size: 1rem;
}
.sug-card.added {
  border-color: #2e7d32;
  background: #e7f5e8;
}
.sug-card.added i { color: #2e7d32; }

/* ============ RESPONSIVE ============ */
@media (max-width: 560px) {
  .modal { padding: 10px; align-items: flex-end; }
  .modal-content {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: slideUpMobile .3s cubic-bezier(.16, 1, .3, 1);
  }
  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-paso { padding: 18px 18px 22px; }
  .carrito-item {
    grid-template-columns: 1fr auto;
    gap: 6px;
  }
  .item-cant {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .item-subtotal {
    grid-column: 2;
    grid-row: 1;
  }
  .item-eliminar {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
  .carrito-totales .linea.total { font-size: 1rem; }
}

/* ============================================================ */
/* BOTÓN FLOTANTE DEL CARRITO (mobile)                          */
/* ============================================================ */
.cart-flotante {
  position: fixed;
  bottom: 20px;
  z-index: 500;
  background: linear-gradient(135deg, #d6336c, #b02a56);
  color: #fff;
  border: none;
  padding: 14px 22px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 8px 24px rgba(214, 51, 108, .45);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform .2s, box-shadow .2s;
  font-family: inherit;
  animation: fadeInFlotante .4s ease-out .8s backwards;
}

@keyframes fadeInFlotante {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.cart-flotante:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(214, 51, 108, .55);
}

.cart-flotante i {
  font-size: 1.05rem;
}

.cart-flotante .badge {
  background: #fff;
  color: #d6336c;
  font-size: .72rem;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-weight: 700;
  position: absolute;
  top: -4px;
  right: -4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

/* Ocultar en desktop */
@media (min-width: 768px) {
  .cart-flotante { display: none; }
}

/* En mobile: bottom arriba del WhatsApp/bot si hubiera */
@media (max-width: 767px) {
  .cart-flotante {
    bottom: 20px;
    left: 16px;
    padding: 12px 18px;
    font-size: .92rem;
  }
}

/* ============================================================ */
/* BOTÓN FLOTANTE — TEMA AFTER +18                              */
/* ============================================================ */
body.after18 .cart-flotante {
  background: linear-gradient(135deg, #d4af37, #b28f2b);
  color: #1a1a1a;
  box-shadow: 0 8px 24px rgba(212, 175, 55, .45);
}
body.after18 .cart-flotante:hover {
  box-shadow: 0 12px 32px rgba(212, 175, 55, .6);
}
body.after18 .cart-flotante .badge {
  background: #1a1a1a;
  color: #d4af37;
}