:root {
  --primary-color: #0077cc;
  --bg-color: #ffffff;
  --text-color: #333;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Arial', sans-serif;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
}

header {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--header-height);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 999;
  transition: background 0.3s ease;
}

header.solid {
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header span {
  font-weight: bold;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 40px;
  margin-right: 10px;
}

nav a {
  margin-left: 20px;
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

/* Imagen Pantalla Completa */
.hero-portada {
  height: 100vh;
  width: 100%;
  background-image: url('/ml-catalogo/img/hero.webp');
  background-size: cover;
  background-position: center;
  background-attachment: fixed; /* EFECTO scroll */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  color: white;
}

.hero-portada::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 0;
}

.hero-texto {
  font-size: 1.5rem;
  z-index: 1;
  position: relative;
  padding: 0 20px;
}

.contenido-principal {
  background: white;
  padding: 80px 20px;
  position: relative;
  z-index: 2;
}


/* ✅ NUEVO: enlaces visibles en modo oscuro */
body.dark nav a {
  color: #f0f0f0;
}

body.dark nav a:hover {
  color: #66ccff;
}

.banner {
  margin-top: var(--header-height);
  width: 100%;
  height: 300px;
  overflow: hidden;
  position: relative;
}

.banner img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  position: absolute;
  transition: opacity 1s ease-in-out;
  opacity: 0;
}

.banner img.active {
  opacity: 1;
  z-index: 1;
}

/* Inicio Aviso Nuevos Articulos **/
.update-notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #0077cc;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  z-index: 9999;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.update-notice.hidden {
  display: none;
}

.update-notice button {
  background: white;
  color: #0077cc;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}
/* Fin Aviso Nuevos Articulos */

.catalog-controls {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.catalog-controls input,
.catalog-controls select {
  padding: 10px;
  font-size: 16px;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding: 20px;
}

/* Loader */
.catalog-loader {
  text-align: center;
  padding: 40px;
  font-size: 16px;
  color: #444;
  display: none; /* Oculto por defecto */
}

.catalog-loader .spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 4px solid #ccc;
  border-top-color: #0077cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Inicio Agrega X al buscador de articulos */
.search-wrapper {
  display: flex;
  align-items: center;
  max-width: 300px;
  width: 100%;
  position: relative;
}

.search-wrapper input {
  flex: 1;
  height: 38px;
  padding-right: 30px;
  font-size: 14px;
  box-sizing: border-box;
}

#clearSearch {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  display: none;
  line-height: 1;
}

#clearSearch.visible {
  display: block;
}
/* Final Agrega X al buscador de articulos */

.item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  background: #fff;
  transition: transform 0.2s;
}

.item:hover {
  transform: scale(1.03);
}

.item img {
  width: 100%;
  aspect-ratio: 1 / 1;       /* ✅ cuadrado perfecto */
  object-fit: cover;
  margin-bottom: 10px;
  border-radius: 10px;
  border-radius: 10px; /* esquinas redondeadas */
}

.item h4 {
  margin-bottom: 10px;
}

.item a {
  background: var(--primary-color);
  color: white;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 5px;
  display: inline-block;
  margin-bottom: 10px;
}

.item button {
  background: transparent;
  border: none;
  color: #0077cc;
  cursor: pointer;
  font-size: 16px;
}

.item p {
  margin-bottom: 10px;
}

.pagination {
  width: 100%;
  display: flex;
  justify-content: center;    /* ✅ centra los botones horizontalmente */
  flex-wrap: wrap;            /* ✅ los deja bajar de línea en móvil */
  gap: 10px;                  /* ✅ espacio entre botones */
  padding: 20px;
  text-align: center;
  box-sizing: border-box;
}

.pagination button {
  padding: 10px 15px;
  border: none;
  background: var(--primary-color);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  min-width: 40px;
}

.pagination button.active {
  background: #005fa3;
}

/* 🌙 Modo oscuro */
body.dark {
  --bg-color: #121212;
  --text-color: #f0f0f0;
  --primary-color: #66ccff;
  background: var(--bg-color);
  color: var(--text-color);
}

body.dark .item {
  background: #1e1e1e;
  border-color: #444;
}

body.dark header.solid {
  background: #1c1c1c;
  box-shadow: 0 2px 10px rgba(255,255,255,0.1);
}

body.dark .item a {
  background: #66ccff;
}

/* Toggle switch */
.dark-toggle {
  margin-left: 20px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  background-color: #ccc;
  border-radius: 34px;
  top: 0; left: 0; right: 0; bottom: 0;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}

.badge-new {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: #e91e63;
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 5px;
  z-index: 2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.item {
  position: relative; /* necesario para que la etiqueta se posicione sobre la imagen */
}

input:checked + .slider {
  background-color: #66ccff;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Responsive */
@media (max-width: 1200px) {
  .catalog {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .catalog {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .catalog {
    grid-template-columns: repeat(2, 1fr);
  }
  .search-wrapper {
  display: flex;
  align-items: center;
  max-width: 100%;
  width: 100%;
  position: relative;
  }
}

@media (max-width: 480px) {
  .catalog {
    grid-template-columns: 1repeat(2, 1fr);
  }
  .search-wrapper {
  display: flex;
  align-items: center;
  max-width: 100%;
  width: 100%;
  position: relative;
  }
  .catalog-categories {
    display: grid;
    max-width: 100%;
    width: 100%;
  }
}
