/* ============================
   1. BASES & VARIABLES
   ============================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --red-main: #c7352f;
  --red-dark: #9e2a25;
  --yellow-main: #f5b034;
  --yellow-dark: #c98527;
  --white: #ffffff;
  --cream: #fffdf5;
  --grid-color: #c7352f;
  --mp-blue: #009ee3;
}

body {
  font-family: "Roboto Slab", serif;
  background-color: #ffffff;
  background-image: linear-gradient(var(--grid-color) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid-color) 2px, transparent 2px);
  background-size: 60px 60px;
  color: #333;
  display: block;
  min-height: 100vh;
}

h1,
h2,
h3 {
  font-family: "Alfa Slab One", serif;
  letter-spacing: 1px;
}
img {
  max-width: 100%;
  display: block;
}

/* ============================
   2. HEADER & NAV (UNIFICADO)
   ============================ */
.header {
  width: 100%;
  background-color: var(--red-main);
  padding: 0.5rem 5%;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header.scrolled {
  background-color: rgba(199, 53, 47, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  transition: all 0.3s ease;
}

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.logo-img {
  height: 80px;
  width: auto;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: center center;
}
.logo-link:hover .logo-img {
  transform: scale(1.08) rotate(-3deg);
}

@media (min-width: 768px) {
  .logo-img {
    height: 110px;
  }
}

.nav-links-desktop {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-left: auto;
  margin-right: 40px;
}
.nav-link {
  font-family: "Madimi One", sans-serif;
  font-size: 1.1rem;
  color: var(--white);
  text-decoration: none;
  position: relative;
  transition: color 0.3s, transform 0.2s ease-out;
  display: inline-block;
}
.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 3px;
  bottom: -5px;
  left: 0;
  background-color: var(--yellow-main);
  transition: width 0.3s ease;
}
.nav-links-desktop a:hover::after {
  width: 100%;
}
.nav-link.active {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 6px 14px;
}
.nav-link:hover {
  transform: translateY(-3px);
}

.cart-btn {
  background: var(--yellow-main);
  border: 3px solid var(--white);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}
.cart-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
  background: var(--white);
}
.cart-btn:hover svg {
  stroke: var(--red-main);
}
.cart-btn svg {
  stroke: var(--white);
  width: 24px;
  height: 24px;
  transition: stroke 0.2s;
}
.cart-counter {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--red-dark);
  color: var(--white);
  font-family: "Alfa Slab One", cursive;
  font-size: 10px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--white);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}
.mobile-menu-container {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  background-color: var(--red-dark);
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 15px;
  z-index: 99;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 4px solid var(--yellow-main);
}
.mobile-menu-container.active {
  display: flex;
  animation: slideDown 0.3s ease;
}
.mobile-link {
  font-family: "Madimi One", sans-serif;
  font-size: 1.5rem;
  color: white;
  text-decoration: none;
  text-align: center;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================
   3. LAYOUT DEL CARRITO
   ============================ */
.main-wrapper {
  display: flex;
  justify-content: center;
  padding: 40px 20px 80px;
  min-height: calc(100vh - 100px);
}

.floating-card {
  width: 100%;
  max-width: 900px;
  background-color: var(--white);
  border-radius: 30px;
  box-shadow: 0 30px 60px rgba(199, 53, 47, 0.25);
  overflow: hidden;
  position: relative;
  animation: breathingShadow 5s infinite ease-in-out;
  border: 2px solid transparent;
}

@keyframes breathingShadow {
  0% {
    box-shadow: 0 20px 50px rgba(199, 53, 47, 0.15);
    border-color: transparent;
  }
  50% {
    box-shadow: 0 25px 60px rgba(199, 53, 47, 0.3);
    border-color: rgba(245, 176, 52, 0.3);
  }
  100% {
    box-shadow: 0 20px 50px rgba(199, 53, 47, 0.15);
    border-color: transparent;
  }
}

.card-body {
  padding: 50px;
}

.cart-title {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--red-main);
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.299);
  margin-bottom: 50px;
  text-transform: uppercase;
}

.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
  min-height: 100px;
}

/* ITEM DEL CARRITO */
.cart-item {
  display: flex;
  align-items: center;
  gap: 25px;
  border-bottom: 2px dashed #eee;
  padding: 20px;
  border-radius: 20px;
  transition: all 0.3s ease;
  background-color: var(--white);
}
.cart-item:last-child {
  border-bottom: none;
}
.cart-item:hover {
  background-color: var(--cream);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  border-bottom-color: transparent;
}

.item-thumb {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  object-fit: cover;
  background-color: #eee;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.item-details {
  flex: 1;
}
.item-name {
  font-size: 1.5rem;
  color: var(--red-dark);
  margin-bottom: 8px;
}
.item-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}
.qty-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  font-weight: bold;
  font-size: 1.1rem;
}
.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.circle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--red-dark);
  background: white;
  color: var(--red-dark);
  font-weight: 900;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 2px;
  transition: all 0.2s;
}
.circle-btn:hover {
  background: var(--red-dark);
  color: white;
  transform: scale(1.1);
}

.trash-icon {
  color: #999;
  cursor: pointer;
  margin-left: 10px;
  transition: transform 0.2s;
}
.trash-icon:hover {
  transform: scale(1.2) rotate(10deg);
  color: var(--red-main);
}

.item-subtotal {
  font-family: "Madimi One", sans-serif;
  font-size: 1.2rem;
  color: var(--yellow-main);
  font-weight: bold;
}
.item-subtotal span {
  color: #ccc;
  font-family: "Roboto Slab", serif;
  font-size: 0.9rem;
  margin-right: 5px;
}

/* OBSERVACIONES */
.observations-container {
  margin-bottom: 30px;
  padding: 0 10px;
}
.observations-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Madimi One", sans-serif;
  font-size: 1.1rem;
  color: var(--red-dark);
  margin-bottom: 10px;
}
.observations-input {
  width: 100%;
  padding: 15px;
  border-radius: 15px;
  border: 2px solid #ddd;
  font-family: "Roboto Slab", serif;
  font-size: 1rem;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.3s, box-shadow 0.3s;
  background-color: #fafafa;
}
.observations-input:focus {
  outline: none;
  border-color: var(--yellow-main);
  box-shadow: 0 4px 10px rgba(245, 176, 52, 0.15);
  background-color: var(--white);
}

/* CUPONES */
.promo-container {
  background-color: #fafafa;
  border: 2px dashed #ddd;
  border-radius: 15px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  transition: all 0.3s;
}
.promo-container:focus-within {
  border-color: var(--yellow-main);
  background-color: var(--cream);
  box-shadow: 0 5px 15px rgba(245, 176, 52, 0.15);
}
.promo-label {
  width: 100%;
  text-align: left;
  font-family: "Madimi One";
  color: #666;
}
.promo-input-group {
  display: flex;
  width: 100%;
  gap: 10px;
}
.promo-input {
  flex: 1;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 50px;
  font-family: "Roboto Slab", serif;
  font-size: 1rem;
  outline: none;
  transition: border 0.3s;
  background: var(--white);
}
.promo-input:focus {
  border-color: var(--yellow-main);
}

/* === NUEVO: ANIMACION BOTON CUPON === */
@keyframes pulsePromo {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 176, 52, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(245, 176, 52, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 176, 52, 0);
  }
}

.btn-promo {
  background-color: var(--red-main);
  color: white;
  border: none;
  padding: 0 25px;
  border-radius: 50px;
  font-family: "Madimi One", sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 4px 0 var(--red-dark);

  /* Se aplica la animación */
  animation: pulsePromo 2s infinite;
}
.btn-promo:hover {
  transform: scale(1.05);
  background: var(--red-dark);
}
.btn-promo:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--red-dark);
  animation: none;
}
.btn-promo:disabled {
  background-color: #ccc;
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
}

.promo-message {
  font-size: 0.9rem;
  height: 20px;
  font-weight: bold;
}
.msg-success {
  color: #28a745;
}
.msg-error {
  color: #dc3545;
}
.msg-loading {
  color: #e6a50e;
}

/* FOOTER DEL CARRITO */
.cart-footer {
  border-top: 2px solid #f0f0f0;
  padding-top: 30px;
  text-align: center;
}
.total-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.total-label {
  font-family: "Alfa Slab One", serif;
  color: var(--red-dark);
  font-size: 1.5rem;
}
.total-number {
  font-family: "Alfa Slab One", serif;
  color: var(--yellow-main);
  font-size: 2.5rem;
}
.old-price {
  text-decoration: line-through;
  color: #bbb;
  font-size: 1.5rem;
  margin-right: 10px;
}
.discount-badge {
  background-color: #28a745;
  color: white;
  font-family: "Madimi One", sans-serif;
  font-size: 0.9rem;
  padding: 5px 10px;
  border-radius: 10px;
  transform: rotate(-5deg);
  display: inline-block;
  margin-left: 10px;
  animation: pulseBadge 2s infinite;
}

/* MENSAJE DE LOCAL CERRADO */
.shop-status-message {
  background-color: #dc3545;
  color: white;
  padding: 20px;
  border-radius: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
  border: 2px solid #a71d2a;
  animation: popIn 0.3s ease-out;
}
.shop-status-message .status-icon svg {
  width: 32px;
  height: 32px;
  stroke: white;
}
.shop-status-message .status-title {
  font-family: "Alfa Slab One", serif;
  font-size: 1.2rem;
  margin-bottom: 5px;
}
.shop-status-message .status-detail {
  font-family: "Roboto Slab", serif;
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
}

/* BOTON DE PAGO */
@keyframes gentlePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 158, 227, 0.3);
  }
  100% {
    transform: scale(1);
  }
}

.btn-checkout {
  background-color: var(--mp-blue);
  color: white;
  font-family: "Alfa Slab One", serif;
  font-size: 1.3rem;
  padding: 15px 40px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  box-shadow: 0 5px 0 #007eb5;
  transition: transform 0.1s, box-shadow 0.1s, filter 0.2s, background 0.3s;
  width: 100%;
  max-width: 400px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  animation: gentlePulse 3s infinite ease-in-out;
}

.btn-checkout:hover:not(:disabled) {
  animation: none;
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #007eb5;
}
.btn-checkout:active:not(:disabled) {
  animation: none;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #007eb5;
}
.btn-checkout:disabled {
  background-color: #999;
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
  filter: grayscale(100%);
}

/* OVERLAY ESPERA */
#waitingOverlay {
  display: none;
  margin-top: 20px;
  background: #fdfdfd;
  padding: 30px;
  border-radius: 20px;
  border: 2px dashed var(--yellow-main);
  text-align: center;
  animation: floatY 4s ease-in-out infinite;
}
.loader {
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--red-main);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}
.waiting-title {
  color: var(--red-dark);
  font-family: "Alfa Slab One";
  font-size: 1.5rem;
  margin-bottom: 10px;
}
.btn-manual-check {
  padding: 10px 20px;
  border-radius: 50px;
  border: 1px solid #ccc;
  background: white;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-manual-check:hover {
  background: var(--yellow-main);
  color: white;
  border-color: var(--yellow-main);
}

/* MODALES */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}
.modal-box {
  background: var(--white);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 4px solid var(--red-main);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  transform: scale(1);
  animation: popIn 0.2s ease-out;
}
.modal-title {
  font-family: "Alfa Slab One", serif;
  color: var(--red-dark);
  font-size: 1.5rem;
  margin-bottom: 10px;
}
.modal-text {
  color: #555;
  margin-bottom: 25px;
  font-size: 1rem;
}
.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}
.btn-modal {
  padding: 12px 25px;
  border-radius: 50px;
  font-family: "Madimi One", sans-serif;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: transform 0.1s;
}
.btn-cancel {
  background: #eee;
  color: #555;
}
.btn-confirm {
  background: var(--red-main);
  color: white;
  box-shadow: 0 4px 0 var(--red-dark);
}
.btn-confirm:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--red-dark);
}
.btn-cancel:hover {
  background: #ddd;
}

/* === NUEVO: ESTILOS INPUT NOMBRE === */
.input-name {
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-family: "Roboto Slab", serif;
  text-align: center;
  margin-bottom: 20px;
  transition: border-color 0.3s;
}
.input-name:focus {
  border-color: var(--yellow-main);
  outline: none;
}

/* ANIMACIONES GLOBALES */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
  will-change: opacity, transform;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes pulseBadge {
  0% {
    transform: scale(1) rotate(-5deg);
  }
  50% {
    transform: scale(1.1) rotate(-5deg);
  }
  100% {
    transform: scale(1) rotate(-5deg);
  }
}
@keyframes floatY {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .header {
    padding: 10px 5%;
  }
  .nav-links-desktop {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
  }

  .card-body {
    padding: 30px 20px;
  }
  .cart-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .item-controls-row {
    width: 100%;
    justify-content: space-between;
  }
  .total-display {
    flex-direction: column;
    gap: 5px;
  }
  .promo-input-group {
    flex-direction: column;
  }
  .btn-promo {
    width: 100%;
    padding: 10px;
  }
}

/* ============================
           7. FOOTER (Agregado)
        ============================ */
.footer {
  background-color: var(--red-dark);
  padding: 60px 5% 40px;
  text-align: center;
  color: var(--white);
  position: relative;
  z-index: 10;
  margin-top: 0;
}
.logo-placeholder {
  font-family: "Alfa Slab One", serif;
}

.footer-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.footer-social {
  display: flex;
  gap: 20px;
  margin: 20px 0;
}
.social-icon {
  width: 45px;
  height: 45px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  color: var(--red-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.social-icon:hover {
  background: var(--yellow-main);
  color: var(--white);
}
.footer_tagline {
  font-family: "Press Start 2P", cursive;
  font-size: 0.7rem;
  color: var(--yellow-main);
  margin-top: 10px;
  animation: blinkRetro 1s step-end infinite;
}

@keyframes blinkRetro {
  50% {
    opacity: 0;
  }
}
