body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: white;
  color: #212529;
  margin: 0;
  padding: 20px;
}

/* Header alineado al 70% */
header {
  width: 70%;
  margin: 0 auto;
  padding: 20px 0 10px 0;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.direccion {
  display: block;
  font-size: 1.1rem;
  color: #555555; /* Gris oscuro */
  font-weight: bold; /* Quita el grosor de título */
  margin-top: 4px;
}

.foto-tienda {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.1;
  color: #212529;
  font-weight: bold;
}

.contacto-info {
  width: 100%;
  font-size: 1.1rem;
  color: #495057;
  margin-top: 15px;
}

/* Menú Fijo y Buscador al 70% */
.menu-fijo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #ffffff;
  padding: 10px 0;
  width: 70%;
  margin: 0 auto;
}

.dropdown-contenedor {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffffff;
  min-width: 180px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
  border-radius: 6px;
  overflow: hidden;
  z-index: 100;
  border: 1px solid #ddd;
}

/* Despliegue al pasar el mouse por encima */
.dropdown-contenedor:hover .dropdown-menu {
  display: flex;
  flex-direction: column;
}

.dropdown-menu.mostrar {
  display: flex;
  flex-direction: column;
}

.dropdown-menu .btn-categoria {
  width: 100%;
  padding: 10px 15px;
  text-align: left;
  background: white;
  border: none;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 0.95rem;
}

.dropdown-menu .btn-categoria:hover {
  background-color: #f0f0f0;
}

.btn-dropdown {
  background-color: #581825;
  color: white;
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* Barra de Búsqueda */
.input-buscador {
  padding: 8px 12px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  width: 100%;
  max-width: 220px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-buscador:focus {
  border-color: #581825;
  box-shadow: 0 0 4px rgba(88, 24, 37, 0.3);
}

.btn-carrito {
  margin-left: auto;
  background-color: #008080;
  font-weight: bold;
}

.btn-carrito:hover {
  background-color: #006666;
}

/* Catálogo en 4 Columnas al 70% */
.catalogo {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px; 
  justify-content: center; 
  width: 70%;
  margin: 0 auto;
  padding: 10px 0;
}

.seccion-catalogo {
  display: none; 
}

.seccion-catalogo.catalogo-activo {
  display: block; 
}

.titulo-categoria-centrado {
  text-align: center;
  font-size: 1.6rem;
  color: #6b1d2f; 
  margin: 15px 0 25px 0;
  font-weight: bold;
}

/* Tarjetas de Libros */
.libro {
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  text-align: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: background-color 0.3s ease;
}

/* Alternado de colores en diagonal */
.libro:nth-child(3n+1) {
  background-color: rgb(48, 238, 206);
}

.libro:nth-child(3n+2) {
  background-color: #23bd75;
}

.libro:nth-child(3n) {
  background-color: #ee96fa;
}

.libro img {
  width: 100%;
  max-width: 180px;
  height: 250px;
  object-fit: cover;
  border-radius: 6px;
  margin: 0 auto 10px auto;
}

.libro .titulo,
.libro h2 {
  font-size: 1rem;
  margin: 5px 0;
  text-align: center;
}

.libro .autor,
.libro p {
  font-size: 0.85rem;
  margin: 0 0 10px 0;
  text-align: center;
}

.libro .precio,
.libro span {
  margin-top: auto !important; 
  font-weight: bold;
  font-size: 1.1rem;
  color: #9b3a01 !important;
  display: block;
  padding-top: 5px;
}

.btn-agregar {
  background-color: #5c1a3b;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  width: 100%;
  font-weight: bold;
  transition: background-color 0.2s;
}

.btn-agregar:hover {
  background-color: #008080;
}

.btn-agregar.btn-presionado {
  background-color: #5c1a3b !important; /* Vuelve a su color bordó original */
  transform: scale(0.95);               /* Leve hundimiento tipo botón físico */
}
/* Modal del Carrito */
.modal-carrito {
  display: none; 
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-carrito.activo {
  display: flex;
}

.contenido-modal {
  background-color: #ffffff;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.encabezado-modal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.encabezado-modal h2 {
  font-size: 1.2rem;
  color: #333;
  margin: 0;
}

.btn-cerrar {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #888;
}

.btn-cerrar:hover {
  color: #000;
}

.lista-carrito {
  max-height: 250px;
  overflow-y: auto;
  margin: 15px 0;
}

.item-carrito {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.titulo-item {
  font-weight: bold;
  font-size: 0.95rem;
  color: #333;
}

.precio-item {
  color: #666;
  font-size: 0.85rem;
}

.acciones-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-restar {
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  color: #333;
  font-size: 16px;
  font-weight: bold;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.2s;
}

.btn-restar:hover {
  background-color: #e0e0e0;
}

.btn-eliminar {
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 10px;
  transition: color 0.2s;
}

.btn-eliminar:hover {
  color: #c0392b;
}

.pie-modal {
  border-top: 1px solid #eee;
  padding-top: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-contenedor {
  font-size: 1.1rem;
}

.btn-comprar {
  background-color: #25d366;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-comprar:hover {
  background-color: #1ebc57;
}

.carrito-vacio {
  text-align: center;
  color: #777;
  padding: 20px 0;
}

/* ==========================================
   DISEÑO RESPONSIVO (CELULARES Y TABLETS)
   ========================================== */
@media (max-width: 768px) {

  /* 1. Aprovechar todo el ancho del celular */
  header,
  .menu-fijo,
  .catalogo {
    width: 92%; /* Pasa de 70% a 92% para no desperdiciar pantalla */
  }

  /* 2. Reducir el header para que no ocupe toda la pantalla */
  header {
    justify-content: center;
    text-align: center;
    gap: 10px;
    padding: 10px 0;
  }

  .foto-tienda {
    width: 90px;
    height: 90px; /* Acheca el logo para dar lugar al catálogo */
  }

  header h1 {
    font-size: 1.4rem;
  }

  .contacto-info {
    font-size: 0.95rem;
    margin-top: 5px;
  }

  /* 3. Menú Adaptable (en 2 filas) */
  .menu-fijo {
    flex-wrap: wrap; /* Permite que los elementos bajen si no entran */
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
  }

  /* El buscador ocupa toda una fila en celulares */
  .input-buscador {
    max-width: 100%;
    order: 3; /* Lo manda a la segunda fila abajo de los botones */
    margin-top: 4px;
  }

  /* Ajuste de botones en móvil */
  .btn-dropdown {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  /* 4. Catálogo a 2 Columnas (en lugar de 4) */
  .catalogo {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 5px 0;
  }

  /* Tarjetas de libros adaptadas */
  .libro {
    padding: 10px;
  }

  .libro img {
    height: 180px; /* Mantiene la proporción de la portada */
  }

  .libro .titulo, 
  .libro h2 {
    font-size: 0.88rem;
  }

  .libro .autor, 
  .libro p {
    font-size: 0.78rem;
  }

  /* 5. Modal del Carrito al 95% del celular */
  .contenido-modal {
    width: 95%;
    padding: 15px;
  }
}

.link-wsp {
  color: #25d366;
  font-weight: bold;
  text-decoration: underline;
  transition: color 0.2s;
}

.link-wsp:hover {
  color: #1ebc57;
}