/* ---------- ESTILOS GENERALES ---------- */
* {
  box-sizing: border-box;
}
body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  color: #333;
  text-align: center;
  overflow-x: hidden;
  overflow-y: auto;
}

header {
  background-color: #8f103d;
  color: white;
  font-size: 24px;
  font-weight: bold;
  padding: 15px;
}

.banner img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  min-height: 40px;
  padding: 10px 15px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  background-color: #8f103d;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
  background-color: #bf2750;
  transform: scale(1.02);
}

input, select {
  padding: 10px;
  margin: 12px 0;
  width: 100%;
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 20px;
}

thead {
  background-color: #8f103d;
  color: white;
  text-transform: uppercase;
}

th, td {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}

th {
  font-weight: bold;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s;
}

.form-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.05);
}

/* ---------- MOBILE ---------- */
@media (max-width: 768px) {
  #pedido-tabla, #productos-tabla, #productos-container {
    display: none;
  }

  #tarjetas-container {
    display: block;
    padding: 10px;
  }

  .producto-card {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    margin: 10px 0;
    padding: 15px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
  }

  .producto-card img {
    width: 100%;
    height: auto;
    margin: 0 auto 10px auto;
    display: block;
  }

  .producto-card h3 {
    margin: 5px 0;
    font-size: 18px;
  }

  .producto-card .precio {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
  }

  .producto-card .acciones {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
  }

  .producto-card input[type="number"] {
    width: 60px;
    padding: 6px;
  }

  #carrito-sidebar {
    position: fixed;
    top: 80px;
    right: 10px;
    width: 95%;
    max-width: 320px;
    background-color: #fff;
    border: 2px solid #8f103d;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
    display: none; /* esto es clave */
  }

  .barra-informativa {
    flex-direction: column;
    gap: 5px;
  }

  .barra-texto {
    width: 100%;
    text-align: center;
    margin-bottom: 5px;
  }

  .barra-redes {
    justify-content: center;
  }

  .banner-container {
    height: 200px;
  }
}

/* ---------- DESKTOP ---------- */
@media (min-width: 769px) {
  #pedido-tabla {
    display: table;
  }

  #productos-tabla, #productos-container {
    display: none;
  }

  #tarjetas-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
  }

  .producto-card {
    display: flex;
    flex-direction: column;
    width: 22%;
    max-width: 280px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    text-align: center;
    transition: transform 0.2s;
  }

  .producto-card:hover {
    transform: translateY(-5px);
  }

  .producto-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 0;
    background-color: transparent;
  }

  .producto-card h3 {
    font-size: 16px;
    margin: 10px 0 10px;
    min-height: 48px;
  }

  .producto-card .precio {
    font-size: 18px;
    font-weight: bold;
    color: #8f103d;
    margin-bottom: 10px;
  }

  .producto-card .acciones {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: auto;
  }

  .producto-card input[type="number"] {
    width: 60px;
    padding: 6px;
  }
}

.img-container {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 10px;
}

.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ---------- CARRITO ---------- */
#carrito-sidebar {
  display: none;
  position: fixed;
  top: 100px;
  right: 20px;
  width: 300px;
  background-color: #fff;
  border: 2px solid #8f103d;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 999;
  max-height: 80vh;
  overflow-y: auto;
}

#carrito-sidebar h2 {
  margin-top: 0;
  font-size: 20px;
  color: #8f103d;
}

#carrito-sidebar ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 15px;
}

#carrito-sidebar li {
  font-size: 15px;
  margin-bottom: 10px;
}

#carrito-sidebar button {
  background-color: #8f103d;
  color: white;
  border: none;
  padding: 10px;
  width: 100%;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

#carrito-sidebar button:hover {
  background-color: #a5124d;
}

.carrito-item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

.carrito-item-img img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.carrito-item-detalle {
  flex: 1;
  text-align: left;
}

.carrito-item-nombre {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 5px;
}

.carrito-item-controles {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
}

.carrito-item-controles input[type="number"] {
  width: 60px;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
  text-align: center;
}

.carrito-item-precio {
  flex: 1;
  text-align: right;
  font-weight: bold;
  font-size: 14px;
  color: #444;
}

.icono-basura {
  width: 18px;
  height: 18px;
  fill: #8f103d;
  cursor: pointer;
  transition: transform 0.2s;
}

.icono-basura:hover {
  transform: scale(1.2);
}

/* ---------- BARRA INFORMATIVA ---------- */
.barra-informativa {
  background-color: #f3f3f3;
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #333;
  flex-wrap: wrap;
  text-align: center;
}

.barra-texto {
  flex: 1;
  font-weight: 500;
  text-align: center;
}

.barra-redes {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.barra-redes img {
  width: 20px;
  height: 20px;
  transition: transform 0.2s;
}

.barra-redes img:hover {
  transform: scale(1.1);
}

/* ---------- MODAL IMAGEN ---------- */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
}

.modal-content {
  max-width: 90%;
  max-height: 80%;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 30px;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
}
#boton-carrito-flotante {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #8f103d;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.boton-agregado {
  position: relative;
  background-color: #28a745 !important;
  color: transparent !important;
}

.boton-agregado::after {
  content: "✔";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: white;
  animation: fadeOut 0.8s forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}