:root {
  --fondo: #9e5c5c;
  --texto: #fff6f0;
  --acento: #f3d1a5;
  --oscuro: #4b2e2e;
  --borde: #f6e0cc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--fondo);
  color: var(--texto);
}

/* NAVBAR */
.navbar {
  background-color: var(--oscuro);
  color: var(--texto);
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.navbar h1 {
  font-size: 1.8rem;
  margin: 0;
  font-weight: 600;
}

.logo {
  width: 48px;
  height: 48px;
  margin-right: 1rem;
  border-radius: 50%;
}

/* INTRO */
.intro {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 1.25rem;
  background-color: var(--oscuro);
  color: var(--texto);
}

/* CATÁLOGO */
.catalogo {
  padding: 2rem 1.5rem;
}

.catalogo h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--acento);
  font-size: 2rem;
}

.productos {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.producto {
  background-color: var(--oscuro);
  border: 2px solid var(--borde);
  padding: 1.5rem;
  border-radius: 15px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 420px;
  text-align: center;
}

.producto:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.producto img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.producto:hover img {
  transform: scale(1.03);
}

.producto h3 {
  margin: 0.5rem 0;
  font-size: 1.1rem;
  color: var(--acento);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.precio {
  font-weight: bold;
  margin: 0.5rem 0 1rem;
  font-size: 1.1rem;
  min-height: 24px;
}

.producto button {
  background-color: var(--acento);
  color: #432a1c;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  margin-top: auto;
}

.producto button:hover {
  transform: scale(1.05);
}

/* FOOTER */
footer {
  text-align: center;
  background-color: var(--oscuro);
  padding: 1rem;
  font-size: 0.95rem;
  color: var(--texto);
  margin-top: 3rem;
}

/* CARRITO FLOTANTE */
#carrito-icono {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--acento);
  color: #432a1c;
  padding: 12px 16px;
  border-radius: 50px;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

#carrito-icono span {
  font-size: 1rem;
  background: red;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1;
}

#carrito-icono.vibrar {
  animation: vibrar 0.4s ease;
  box-shadow: 0 0 10px var(--acento), 0 0 20px var(--acento);
}

@keyframes vibrar {
  0% { transform: scale(1); }
  25% { transform: scale(1.05) rotate(2deg); }
  50% { transform: scale(0.98) rotate(-2deg); }
  75% { transform: scale(1.05) rotate(1deg); }
  100% { transform: scale(1); }
}

/* PANEL CARRITO */
#carrito-panel {
  font-size: 1.1rem;
  position: fixed;
  top: 0;
  right: -100%;
  width: 380px;
  max-width: 90vw;
  height: 100%;
  background-color: var(--oscuro);
  color: var(--texto);
  padding: 2rem 1.5rem;
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.4);
  border-left: 2px solid var(--acento);
}

#carrito-panel.abierto {
  right: 0;
}

#carrito-panel h3 {
  margin-top: 0;
  color: var(--acento);
}

#carrito-lista {
  list-style: none;
  padding: 0;
  flex-grow: 1;
  overflow-y: auto;
  margin-top: 1rem;
}

#carrito-lista li {
  margin-bottom: 12px;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.botones-cantidad {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
}

.botones-cantidad button {
  background-color: var(--acento);
  color: #432a1c;
  font-size: 0.85rem;
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#carrito-total {
  font-weight: bold;
  font-size: 1.2rem;
  margin: 1rem 0;
}

#cerrar-carrito {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  color: var(--texto);
  font-size: 1.2rem;
  border: 1.5px solid var(--texto);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#cerrar-carrito:hover {
  background-color: var(--texto);
  color: var(--oscuro);
}

#carrito-panel button:not(#cerrar-carrito) {
  margin-top: 0.5rem;
  background-color: var(--acento);
  color: #432a1c;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
}

/* ANIMACIONES GENERALES */
.fade-in {
  opacity: 0;
  animation: fadeIn 1s forwards;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 1s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .navbar {
    flex-direction: row;
    justify-content: space-between;
  }

  .navbar h1 {
    font-size: 1.4rem;
  }

  .producto h3 {
    font-size: 1rem;
  }

  .producto button {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }

  #carrito-panel {
    width: 100%;
    padding: 1.2rem;
  }

  #carrito-panel button:not(#cerrar-carrito) {
    font-size: 0.95rem;
    padding: 0.6rem;
  }

  #carrito-icono {
    font-size: 1.2rem;
    padding: 10px 14px;
  }
}