/*
 Theme Name: Divi Child
 Template: Divi
*/
/* =========================================
   FUENTES LOCALES – EXO 300 & 500
   ========================================= */
@font-face {
  font-family: 'Exo';
  src: url('fonts/exo300.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range: U+000-5FF;
}

@font-face {
  font-family: 'Exo';
  src: url('fonts/exo500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+000-5FF;
}
/* =========================================
   APLICACIÓN GLOBAL DE FUENTE EXO
   ========================================= */
body, h1, h2, h3, h4, h5, h6, p, a, button, li, span, strong,
.et_pb_module, .et_pb_text, .et_pb_button, .et-menu li a {
  font-family: 'Exo', sans-serif !important;
  font-weight: 300;
}

/* =================================================
   🔤 2. ÍCONOS DIVI (ETmodules — Local WOFF2)
   ================================================= */
@font-face {
  font-family: 'ETmodules';
  src: url('/wp-content/themes/divi-child/fonts/ETmodules.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

/* Aplicar ETmodules a íconos Divi */
.et_pb_font_icon,
.et-cart-info span:before,
.et_pb_button .et_pb_button_icon:before,
.et_pb_social_icon a:before,
.et_pb_icon:before,
.et-menu li a:before,
.et_pb_main_blurb_image .et_pb_icon:before,
.et_pb_pricing_table_button:before,
.et_pb_pricing_heading .et_pb_icon:before,
.et_pb_toggle_title:before {
  font-family: 'ETmodules' !important;
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* =========================================
   OPTIMIZACIÓN DE FUENTE modules.woff
   ========================================= */

/* Ancho completo en escritorio */
@media (min-width: 992px) {
  .busqueda-personalizada {
    max-width: 100% !important;
  }
}

/* Controlar ancho máximo en pantallas grandes */
@media (min-width: 1200px) {
  .busqueda-personalizada {
    max-width: 700px;
    margin: 0 auto;
  }
}
/* =========================================
   NEUTRALIZACIÓN DE ESTILOS DIVI
   ========================================= */
.et_pb_section, .et_pb_row {
  padding: 0 !important;
  margin: 0 !important;
}

.et_pb_column {
  padding: 0 !important;
}

.et_pb_row {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto !important;
}

.et_pb_section, .et_pb_row {
  min-height: unset !important;
  height: auto !important;
}

.et_pb_row_4col,
.et_pb_row_3col,
.et_pb_row_2col {
  justify-content: unset !important;
  align-items: unset !important;
}

/* =========================================
   MENÚ CATEGORÍAS - SLIDE-IN SIN BORDES REDONDEADOS
   ========================================= */

.menu-catalogo-wrapper,
#menu-catalogo,
#boton-catalogo {
  font-family: 'Exo', sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.menu-catalogo-wrapper {
  position: relative;
  display: inline-block;
  width: auto;
  z-index: 9999;
}

/* 🔴 Botón de apertura del menú */
#boton-catalogo {
  background-color: #FF0000; /* Rojo oficial */
  color: #FFFFFF; /* Blanco */
  padding: 0px 20px;
  font-size: 18px;
  border: none;
  cursor: pointer;
  width: 100%;
  display: block;
  text-align: center;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 10;
  transition: background-color 0.3s ease;
  margin-right: 10px;
}

/* 🔴 Hover del botón */
#boton-catalogo:hover {
  background-color: #8C0303; /* Rojo oscuro oficial */
}

/* ⚫ Overlay del menú */
#menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99998;
  display: none;
  transition: opacity 0.3s ease-in-out;
  opacity: 0;
}

#menu-overlay.visible {
  display: block;
  opacity: 1;
}

/* 🔴 Panel lateral del menú */
#menu-catalogo {
  position: fixed;
  top: 0;
  left: 0;
  width: 90%;
  max-width: 400px;
  height: 100vh;
  background-color: #FF0000; /* Rojo oficial */
  box-sizing: border-box;
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 99999;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  overflow-y: auto;
}

#menu-catalogo.visible {
  transform: translateX(0);
}

/* 🔴 Encabezado del menú */
.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 20px;
  background: #8C0303; /* Rojo oscuro oficial */
  font-size: 20px;
  font-weight: bold;
  color: #FFFFFF; /* Blanco */
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-title {
  text-transform: uppercase;
  font-weight: 500; /* Añadido: negrita visual uniforme */
}

.menu-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #FFFFFF; /* Blanco */
  cursor: pointer;
  font-weight: 500; /* Añadido: negrita visual uniforme */
}

/* 🔠 Lista de categorías */
.menu-items {
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 14px;
}

.menu-items a {
  color: #FFFFFF; /* Blanco */
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.menu-items a:hover {
  text-decoration: underline;
}


/* =========================================
   SISTEMA DE COLUMNAS RESPONSIVAS - FLEXBOX
   ========================================= */
@media only screen and (max-width: 991px) {

  /* Contenedores de 2 o 3 columnas */
  .dos-columnas-50-50,
  .dos-columnas-75-25,
  .dos-columnas-33-66,
  .tres-columnas-33,
  .tres-columnas-50-25-25,
  .tres-columnas-25-50-25,
  .tres-columnas-25-25-50 {
    display: flex !important;
    flex-wrap: nowrap !important;   /* Mantiene columnas en una sola fila */
    align-items: center;            /* Centra verticalmente */
  }

  /* --- 2 COLUMNAS --- */
  .dos-columnas-50-50 > .et_pb_column:nth-child(1),
  .dos-columnas-50-50 > .et_pb_column:nth-child(2) {
    flex: 0 0 50% !important;       /* 50% y no crece más */
  }

  .dos-columnas-75-25 > .et_pb_column:nth-child(1) {
    flex: 0 0 75% !important;
  }
  .dos-columnas-75-25 > .et_pb_column:nth-child(2) {
    flex: 0 0 25% !important;
  }

  .dos-columnas-33-66 > .et_pb_column:nth-child(1) {
    flex: 0 0 33.333% !important;
  }
  .dos-columnas-33-66 > .et_pb_column:nth-child(2) {
    flex: 0 0 66.666% !important;
  }

  /* --- 3 COLUMNAS --- */
  .tres-columnas-33 > .et_pb_column {
    flex: 0 0 33.333% !important;
  }

  .tres-columnas-50-25-25 > .et_pb_column:nth-child(1) {
    flex: 0 0 50% !important;
  }
  .tres-columnas-50-25-25 > .et_pb_column:nth-child(2),
  .tres-columnas-50-25-25 > .et_pb_column:nth-child(3) {
    flex: 0 0 25% !important;
  }

  .tres-columnas-25-50-25 > .et_pb_column:nth-child(1),
  .tres-columnas-25-50-25 > .et_pb_column:nth-child(3) {
    flex: 0 0 25% !important;
  }
  .tres-columnas-25-50-25 > .et_pb_column:nth-child(2) {
    flex: 0 0 50% !important;
  }

  .tres-columnas-25-25-50 > .et_pb_column:nth-child(1),
  .tres-columnas-25-25-50 > .et_pb_column:nth-child(2) {
    flex: 0 0 25% !important;      /* Puedes ajustar a 25% si prefieres */
  }
  .tres-columnas-25-25-50 > .et_pb_column:nth-child(3) {
    flex: 0 0 50% !important;      /* Imagen en el lado derecho */
  }

  /* Ajustar las imágenes dentro de columnas */
  .tres-columnas-25-25-50 img,
  .tres-columnas-50-25-25 img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}


/* Enviar la barra de búsqueda al fondo */
.et_pb_section .et_pb_row:last-child {
  position: relative !important;
  z-index: 1 !important;
}

/* =========================================
   BARRA DE BÚSQUEDA PERSONALIZADA
   ========================================= */

.busqueda-personalizada {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.busqueda-personalizada .search-field {
  width: 100%;
  padding: 8px 40px 8px 12px;
  border: 1px solid #ff0000;
  font-size: 14px;
  color: #333;
  box-sizing: border-box;
  border-radius: 0;  /* Bordes rectos */
}

/* Botón de la lupa */
.busqueda-personalizada .search-submit {
  position: absolute;
  right: 0;
  top: 0;
  width: 40px;
  height: 100%;
  background-color: #ff0000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* SVG de la lupa */
.busqueda-personalizada .search-submit svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Ancho completo en escritorio */
@media (min-width: 992px) {
  .busqueda-personalizada {
    max-width: 100% !important;
  }
}

/* Controlar ancho máximo en pantallas grandes */
@media (min-width: 1200px) {
  .busqueda-personalizada {
    max-width: 700px;
    margin: 0 auto;
  }
}

/* ---------------------------------------------
   🗭 1. Ocultar breadcrumb "Inicio / Libros"
---------------------------------------------- */
.woocommerce-breadcrumb {
  display: none !important;
}

/* --------------------------------------------------
   🔢 2. Ocultar números de productos entre paréntesis
   (e.g. (359), (24), etc.)
--------------------------------------------------- */
.woocommerce-loop-category__title {
  font-weight: bold;
  color: #000000; /* Letras negras */
  text-align: center;
  font-size: 1.2em;
  margin-top: 10px;
  margin-bottom: 15px;
}
.woocommerce-loop-category__title .count {
  display: none !important; /* Oculta el número dentro del  */
}

/* ------------------------------------------------------
   🖼️ 3. Estilo visual de imágenes de categorías
------------------------------------------------------- */
.product-category img {
  border-radius: 0px; /* Bordes redondeados */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Sombra suave */
  transition: transform 0.3s ease;
}
.product-category img:hover {
  transform: scale(1.05); /* Efecto de zoom suave al pasar el cursor */
}

/* -------------------------------------------------
   🏷️ 4. Estilo de títulos (nombres de categorías)
-------------------------------------------------- */
/* (ya incluidos en el bloque 2 con .woocommerce-loop-category__title) */

/* -------------------------------------------------------
   📱 5. Ajuste responsive para celulares
-------------------------------------------------------- */
@media (max-width: 768px) {
  ul.products {
    display: grid !important;
    grid-template-columns: 1fr 1fr; /* 2 columnas */
    gap: 20px;
    padding: 10px;
  }
  .product-category {
    text-align: center;
  }
  .woocommerce-loop-category__title {
    font-size: 1em;
  }
}

/* -----------------------------------------------------
   🗭 6. Separación general y aire visual entre elementos
------------------------------------------------------ */
ul.products li.product-category {
  padding: 10px;
  margin-bottom: 10px;
}
/* Ocultar el título "Libros" SOLO en la categoría padre /categoria/libros/ */
.archive.tax-product_cat.term-libros .woocommerce-products-header__title.page-title {
  display: none !important;
}

/* Fallbacks por si el tema imprime el H1 con otras clases (Divi/Woo) */
.archive.tax-product_cat.term-libros h1.page-title,
.archive.tax-product_cat.term-libros .et_pb_title_container h1 {
  display: none !important;
}

/* ===================================================
   CATÁLOGO — Tarjeta de producto (Divi + WooCommerce)
   Versión oficial unificada (sin @media) ✅ + centrado imágenes
   =================================================== */

/* Evita scroll horizontal global si algo se pasa */
html, body {
  overflow-x: hidden;
}

/* Contenedor del producto */
body.woocommerce ul.products li.product {
  text-align: center;
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  padding: 2px;                /* Compacto para todos los dispositivos */
  margin-bottom: 18px;         /* Uniforme, evita separación excesiva */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Imagen: misma altura para todas + centrado horizontal */
body.woocommerce ul.products li.product img {
  height: 240px;               /* Valor compacto global */
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto 6px auto;      /* Centrado horizontal */
}

/* Fuerza el centrado de imagen ante posibles estilos heredados */
body.woocommerce ul.products li.product a img {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Título */
body.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-size: 16px;
  font-weight: 300;
  color: #000;
  min-height: 58px;            /* Altura ajustada para 2 líneas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

/* Precio más grueso (simulación) */
body.woocommerce ul.products li.product .price {
  font-size: 20px;             
  font-weight: 500; /* Máximo peso real disponible */
  color: #000;
  margin-bottom: 0px;
  min-height: 24px;

  /* Simula grosor extra */
  text-shadow: 
    0.03em 0 #000, 
    -0.03em 0 #000, 
    0 0.03em #000, 
    0 -0.03em #000;
}

/* Botón AGREGAR (catálogo) — unificado */
body.woocommerce ul.products li.product a.button.add_to_cart_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #FF0000;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  padding: 6px 12px;
  border: 2px solid #FF0000;
  border-radius: 4px;
  text-transform: uppercase;
  transition: all 0.2s ease-in-out;
  width: 100%;
  max-width: 220px;
  min-width: 0;
  line-height: 1;
  text-decoration: none !important;
  margin: 0 auto;
  box-sizing: border-box;
  position: relative;
}

/* ✅ Spinner de carga centrado */
body.woocommerce ul.products li.product a.button.add_to_cart_button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Hover del botón */
body.woocommerce ul.products li.product a.button.add_to_cart_button:hover {
  background-color: transparent;
  color: #FF0000;
}

/* 🔹 Elimina flecha en hover */
body.woocommerce ul.products li.product a.button.add_to_cart_button:hover::after,
body.woocommerce ul.products li.product a.button.add_to_cart_button:hover::before {
  content: none !important;
}

/* 🔹 Elimina ícono de etiqueta en estado agregado */
body.woocommerce ul.products li.product a.button.add_to_cart_button.added::after {
  content: none !important;
}

/* Enlace "Ver carrito" — personalizado */
body.woocommerce ul.products li.product a.added_to_cart {
  display: inline-block;
  font-size: 14px;
  font-weight: bold;
  color: #FF0000;
  margin-top: 6px;
  margin-left: 0;
  text-decoration: underline;
  transition: color 0.2s ease-in-out;
}

body.woocommerce ul.products li.product a.added_to_cart:hover {
  color: #C00000;
}

/* ===========================
   Prevención extra de desbordes
   =========================== */
body.woocommerce ul.products li.product * {
  max-width: 100%;
  box-sizing: border-box;
}

/* 🔹 1. Ocultar texto "Mostrando X–Y de Z resultados" */
.woocommerce-result-count {
  display: none !important;
}

/* 🔹 2. Eliminar hueco en móvil ajustando el selector de orden */
@media (max-width: 767px) {
  .woocommerce-ordering {
    margin-top: 0 !important;  /* Quita espacio arriba */
    padding-top: 0 !important;
  }
}
/* =========================================================
   SOLO categoría "libros" (página de archivo product_cat)
   Corrige huecos: anula floats/márgenes y usa CSS Grid
   ========================================================= */
.tax-product_cat.term-libros ul.products {
  /* Rompe herencia de Woo/Divi que usa floats */
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;                /* espacio entre tarjetas */
  margin: 0 !important;
  padding: 0 !important;
}

.tax-product_cat.term-libros ul.products::before,
.tax-product_cat.term-libros ul.products::after {
  content: none !important; /* elimina clearfix heredados */
}

/* Ítems de categoría */
.tax-product_cat.term-libros ul.products li.product-category {
  float: none !important;   /* anula floats de Woo */
  width: auto !important;   /* deja que Grid controle el ancho */
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
  min-height: auto !important;  /* por si un tema fija altura */
}

/* Enlace + imagen */
.tax-product_cat.term-libros ul.products li.product-category a {
  display: block;
}

.tax-product_cat.term-libros ul.products li.product-category img {
  display: block;
  width: 100%;
  height: auto;             /* evita estiramientos */
  margin: 0 !important;     /* quita margen inferior heredado */
}

/* Oculta el título redundante (ya aplicado, lo dejo aquí por completitud) */
.tax-product_cat.term-libros ul.products li.product-category .woocommerce-loop-category__title {
  display: none !important;
}

/* Ajuste fino móvil muy estrecho (opcional) */
@media (max-width: 380px) {
  .tax-product_cat.term-libros ul.products {
    gap: 10px;
  }
}
/* 🟥 Etiqueta superior para productos sin stock */
.product-outofstock {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: #8C0303; /* Rojo oscuro oficial */
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 2px;
  z-index: 5;
}

/* Asegura que el contenedor del producto esté posicionado */
body.woocommerce ul.products li.product {
  position: relative;
}

/* ==========================================
   🖥️ DISEÑO EN CAJA SOLO EN ESCRITORIO
   ========================================== */
@media (min-width: 992px) {
  body.et_boxed_layout #page-container {
    max-width: 1200px;  /* o el ancho que prefieras */
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    background-color: #fff;
  }
}

/* 🚫 En móviles y tablets: quitar caja */
@media (max-width: 991px) {
  body.et_boxed_layout #page-container {
    max-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    background-color: transparent !important;
  }
}

/* ==========================================
   📱 CORREGIR ALINEACIÓN EN MÓVILES (BOXED OFF)
   ========================================== */
@media (max-width: 991px) {
  body.et_boxed_layout #page-container {
    max-width: 100% !important;
    margin: 0 auto !important;   /* Centrar contenido */
    padding: 0 !important;
    box-shadow: none !important;
    background-color: transparent !important;
  }
}

.mi-checkout-envio {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.mi-checkout-envio .campo-checkout {
    margin-bottom: 15px;
}