/* ==================================
   Archivo: base.css
   ================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap');


/* Reset y box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Page background y overlay */
html { background: var(--color-primario); }
body {
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background: none;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
 
  pointer-events: none;
  z-index: -1;
}


.site-logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}



/* Botones globales */
button, .btn {
  background: var(--color-secundario);
  color: #fff;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s ease;
}
button:hover, .btn:hover {
  background: var(--color-terciario);
}

/* Global search form */
.global-search-form {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
}
.global-search-form input[type="search"] {
  padding: .4rem .8rem;
  border: 1px solid var(--color-terciario);
  border-radius: 4px 0 0 4px;
  width: 200px;
}
.global-search-form button {
  padding: .4rem .8rem;
  border: 1px solid var(--color-terciario);
  border-left: none;
  border-radius: 0 4px 4px 0;
}

/* Footer */
footer {
  background: var(--color-cuaternario);
  color: var(--color-text);
  text-align: center;
  padding: 1rem;
  font-size: .9rem;
}
footer a {
  color: var(--color-text);
  text-decoration: underline;
}
footer a:hover {
  color: var(--color-terciario);
}

/* Contenedores 'card' genéricos */
.card,
section,
article,
aside {
  background: rgba(255,255,255,0.85);
  border-radius: 8px;
  padding: 1rem;
}

/* Formulario de contacto */
.contact-section,
.contact-form-wrap {
  max-width: 900px;
  margin: 2rem auto;
  background: rgba(255,255,255,0.9);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}
.contact-section h2,
.contact-form-wrap h3 {
  color: var(--color-text);
  text-align: center;
  margin-bottom: 1rem;
}
.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.contact-buttons .button {
  flex: 1 1 200px;
  background: var(--color-cuaternario);
  color: #fff;
  padding: .8rem 1.2rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}
.contact-buttons .button:hover {
  background: var(--color-terciario);
}
.contact-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.contact-form .form-row.full {
  grid-column: 1 / -1;
}
.contact-form label {
  display: block;
  margin-bottom: .5rem;
  color: var(--color-text);
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: .75rem;
  border: 1px solid var(--color-terciario);
  border-radius: 6px;
  transition: border-color .2s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--color-terciario);
}
.form-message--success {
  background: #e6ffed;
  color: #027a15;
}
.form-message--error {
  background: #ffe6e6;
  color: #a10000;
}



.site-header .logo {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-cuaternario);
  text-decoration: none;
}
/* Search centrado */
.site-header .header-actions {
  flex: 1;
  display: flex;
  justify-content: center;
}
.search-box input {
  width: 100%;
  max-width: 400px;
  padding: .5rem 2.5rem .5rem 1rem;
  border: 1px solid var(--color-cuaternario);
  border-radius: 4px;
}
.search-box button {
  position: absolute;
  top: 50%; right: calc(50% - 200px + .5rem);
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer;
}
.search-box button svg { fill: var(--color-cuaternario); }

/* Subnav de categorías */
.sub-nav {
  background: var(--color-secundario);
  padding: .5rem 2rem;
}
.sub-nav ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 1200px;
  margin: 0 auto;
}
.sub-nav li {
  position: relative;
}
.sub-nav a {
  color: #fff;
  text-decoration: none;
  padding: .5rem;
  display: block;
}
.sub-nav a:hover {
  background: var(--color-terciario);
}
/* Dropdown modal */
.sub-nav li .sub-dropdown {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: #fff;
  border: 1px solid var(--color-terciario);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 1rem;
  min-width: 200px;
  z-index: 200;
}
.sub-nav li:hover > .sub-dropdown {
  display: block;
}
.sub-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sub-dropdown li {
  margin-bottom: .5rem;
}
.sub-dropdown a {
  color: var(--color-text);
  padding: .25rem 0;
}
.sub-dropdown a:hover {
  color: var(--color-cuaternario);
}


/* ==== REPOSICIONAR ICONO DE BÚSQUEDA DENTRO DE INPUT ==== */
.header-search, .global-search-form { position: relative; }
.header-search input, .global-search-form input[type="search"] {
  padding-right: 2.5rem; /* espacio para el icono */
}
.header-search button, .global-search-form button {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-search button img, .global-search-form button img {
  display: block;
  width: 1rem;
  height: auto;
}


/* Logo a la izquierda (columna 1) */
.site-logo {
  grid-column: 1;
  margin-right: 2rem; /* separa un poco del menú */
}





/* Asegurar input y botón dentro del contenedor */
.header-search input {
  width: 100%;
  padding: .5rem 2.5rem .5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--color-cuaternario);
}
.header-search button {
  position: absolute;
  top: 50%;
  right: .75rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Icono de lupa dentro del buscador */
.header-search button img {
  display: block;
  width: 1rem;
  height: auto;
}


.sub-nav {
  background: var(--color-cuaternario);
  padding: 0.75rem 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.sub-nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0;
}
.sub-nav li {
  position: relative;
}
.sub-nav a.filter-cat {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  padding: .5rem .75rem;
  border-radius: 4px;
  transition: background .3s, color .3s;
}
.sub-nav a.filter-cat:hover {
  background: var(--color-terciario);
  color: #fff;
}

/* Dropdown (subcategorías) */
.sub-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: .75rem 1rem;
  min-width: 180px;
  z-index: 100;
}
.sub-nav li:hover > .sub-dropdown {
  display: block;
}
/* Lista interna del dropdown */
.sub-dropdown ul {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sub-dropdown a {
  color: var(--color-text);
  padding: .4rem .6rem;
  border-radius: 4px;
  transition: background .2s;
}
.sub-dropdown a:hover {
  background: var(--color-primario);
  color: var(--color-cuaternario);
}

/* Asegurar responsivo: apilar en móvil */
@media (max-width: 768px) {
  .sub-nav ul {
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }
  .sub-dropdown {
    position: static;
    box-shadow: none;
    background: transparent;
    padding: 0;
    min-width: auto;
  }
  .sub-dropdown ul {
    flex-direction: row;
    gap: 1rem;
  }
}
/* Forzar texto visible en sub-dropdown */
.sub-dropdown {
  background: #fff !important;
}

.sub-dropdown a {
  display: block;               /* asegúrate que ocupe todo el ancho */
  color: var(--color-text) !important;  /* texto oscuro sobre fondo blanco */
  text-decoration: none;
  padding: .4rem .6rem;
}

.sub-dropdown a:hover {
  background: var(--color-primario);
  color: var(--color-cuaternario);
}

/* ==================================
   Estilos del Mega Menú
   ================================== */

/* Contenedor principal del panel */
#mega-menu-panel {
  position: absolute;
  top: 100%; /* Justo debajo del header */
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  z-index: 999;
  
  /* Estado inicial (oculto) */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  max-height: calc(100vh - 120px);
  overflow-y: auto;   
}

/* Estado visible */
#mega-menu-panel.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Parrilla interna de 4 columnas */
.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.mega-menu-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* Espacio entre grupos de categoría padre */
}

/* Título de la categoría padre */
.mega-menu-parent-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-cuaternario);
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-terciario);
}

/* Lista de subcategorías */
.mega-menu-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mega-menu-sublist a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.mega-menu-sublist a:hover {
  color: var(--color-terciario);
  padding-left: 5px; /* Pequeño efecto al hacer hover */
}

/* Responsive para el Mega Menú */
@media (max-width: 900px) {
  .mega-menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .mega-menu-grid {
    grid-template-columns: 1fr;
  }
  #mega-menu-panel {
    padding: 1.5rem;
  }
}

/* --- Ajuste fino para hacer el menú más compacto --- */
.mega-menu-grid {
  gap: 1.5rem; /* Reduce el espacio entre columnas */
}
.mega-menu-column {
  gap: 1rem; /* Reduce el espacio entre categorías padre */
}
.mega-menu-parent-title {
  font-size: 0.9rem; /* Título de padre un poco más pequeño */
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
}
.mega-menu-sublist a {
  font-size: 0.85rem; /* Subcategorías más pequeñas */
  padding: 2px 0;
}
.mega-menu-sublist {
    gap: 0.3rem; /* Reduce el espacio entre subcategorías */
}
/* ==================================
   Estilos Unificados de la Cabecera
   ================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto 1fr auto; /* Logo | Menú | Buscador */
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  background: var(--color-cuaternario);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* --- Columna 1: Logo --- */
.site-logo {
  grid-column: 1;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

/* --- Columna 2: Menú de Navegación --- */
.site-nav {
  grid-column: 2;
  justify-self: center; /* Centra el menú en el espacio disponible */
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

.nav-menu a {
  display: block;
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
  padding: 0.5rem;
  background: none; /* Aseguramos que no tenga fondos extraños */
  border: none; /* Ni bordes extraños */
  transition: color 0.3s ease, transform 0.2s ease;
}

.nav-menu a:hover {
  color: var(--color-terciario);
  transform: translateY(-2px);
}

/* --- Columna 3: Buscador --- */
.header-search {
  grid-column: 3;
  justify-self: end; /* Alinea el buscador a la derecha */
  position: relative;
  width: 250px;
}

.header-search input[type="search"] {
  width: 100%;
  padding: .5rem 2.5rem .5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--color-terciario);
}

.header-search button {
  position: absolute;
  top: 50%;
  right: .5rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
}

.header-search button img {
  width: 1rem;
  height: auto;
}

/* ==================================
   Estilos Responsive y Menú Móvil
   ================================== */

/* Contenedor de acciones en el header para alinear búsqueda y botón móvil */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  grid-column: 3;
  justify-self: end;
}

/* --- Botón de Hamburguesa --- */
.mobile-menu-button {
  display: none; /* Oculto por defecto en escritorio */
  background: none;
  border: none;
  padding: 0;
  width: 30px;
  height: 24px;
  position: relative;
  cursor: pointer;
  z-index: 1011;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease, opacity 0.3s ease;
}

.hamburger-icon { top: 50%; transform: translateY(-50%); }
.hamburger-icon::before { top: -10px; }
.hamburger-icon::after { bottom: -10px; }

/* --- Animación de la hamburguesa a "X" --- */
.mobile-menu-button.is-active .hamburger-icon {
  background: transparent; /* La línea del medio desaparece */
}
.mobile-menu-button.is-active .hamburger-icon::before {
  top: 0;
  transform: rotate(45deg);
}
.mobile-menu-button.is-active .hamburger-icon::after {
  bottom: 0;
  transform: rotate(-45deg);
}

/* --- Panel del Menú Móvil (Off-Canvas) --- */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%; /* Empieza fuera de la pantalla */
  width: 280px;
  max-width: 80%;
  height: 100vh;
  background: var(--color-cuaternario);
  box-shadow: -4px 0 15px rgba(0,0,0,0.2);
  padding: 6rem 2rem 2rem 2rem;
  z-index: 1010;
  transition: right 0.4s ease-in-out;
  overflow-y: auto;
}

.mobile-menu.is-open {
  right: 0; /* Se desliza a la vista */
}

.mobile-menu nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mobile-menu nav a {
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 500;
}

/* ==================================
   Media Queries para Responsive
   ================================== */
@media (max-width: 900px) {
  /* Ocultamos el menú de escritorio y el buscador */
  .site-nav {
    display: none;
  }
  .header-search {
    display: none;
  }

  /* Mostramos el botón de hamburguesa */
  .mobile-menu-button {
    display: block;
  }

  /* Ajustamos la cabecera */
  .site-header {
    grid-template-columns: 1fr auto; /* Logo a la izquierda, acciones a la derecha */
    gap: 1rem;
    padding: 1rem 1.5rem;
  }
  .site-logo {
    grid-column: 1;
    justify-self: start;
  }
  .header-actions {
    grid-column: 2;
  }
}

/* ==================================
   Estilos para el Modal de Éxito
   ================================== */

.modal-overlay {
  position: fixed;
  inset: 0; /* Abarca toda la pantalla */
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  /* Estado inicial (oculto) */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: #fff;
  padding: 2rem 3rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 5px 25px rgba(0,0,0,0.2);
  max-width: 400px;

  /* Animación de entrada */
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.is-visible .modal-box {
  transform: scale(1);
}

.modal-icon svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
}

.modal-box h2 {
  margin-bottom: 0.5rem;
  color: var(--color-cuaternario);
}

/* Estilos para el crédito del desarrollador en el footer */
.site-developer-credit {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.site-developer-credit a {
    color: #555;
    font-weight: 600;
    text-decoration: none;
}

.site-developer-credit a:hover {
    text-decoration: underline;
}

/* ==================================
   Estilos para el Banner de Cookies
   ================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 1rem;
    z-index: 10000;
    backdrop-filter: blur(5px);
    
    /* Estado inicial: oculto y fuera de la pantalla */
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
}

/* Estado visible: se desliza hacia arriba */
.cookie-banner.is-visible {
    transform: translateY(0);
}

.cookie-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.cookie-banner p {
    margin: 0;
    flex-grow: 1;
    font-size: 0.9rem;
}

.cookie-banner a {
    color: var(--color-primario); /* Usa un color de tu paleta */
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.75rem;
}

.cookie-banner .btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.cookie-banner .btn.btn-primary {
    background: var(--color-terciario);
    color: #fff;
}

.cookie-banner .btn.btn-secondary {
    background: #555;
    color: #fff;
}

/* ==================================
    Estilos para Páginas Legales
   ================================== */

.legal-page-container {
    max-width: 800px; /* Ancho máximo para facilitar la lectura */
    margin: 2rem auto;  /* Centra el contenedor y le da espacio arriba/abajo */
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.legal-page-container .entry-title {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-terciario);
    padding-bottom: 0.75rem;
}

.legal-page-container .entry-content h2 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.legal-page-container .entry-content h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.legal-page-container .entry-content p,
.legal-page-container .entry-content li {
    line-height: 1.7;
}

.legal-page-container .entry-content ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 1rem;
}