/*
Theme Name: BodyMaster Black
Theme URI: https://bodymasterblack.com
Author: 01Digital.mx
Description: Tema catálogo para BodyMaster Black.
Version: 1.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bm-black
*/

/* ==========================================================================
   Variables - Dark mode
   ========================================================================== */
:root {
  --bm-black: #17161B;
  --bm-dark: #0f0e12;
  --bm-gray: #1e1d22;
  --bm-gray-light: #2a292e;
  --bm-accent: #FA0915;
  --bm-accent-hover: #ff1f2a;
  --bm-text: #ffffff;
  --bm-text-muted: #b0b0b0;
  --bm-border: #333;
  --bm-radius: 6px;
  --bm-font: "Oswald", sans-serif;
  --bm-header-height: 64px;
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--bm-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--bm-text);
  background: var(--bm-black);
}

a {
  color: var(--bm-text);
  text-decoration: none;
}

a:hover {
  color: var(--bm-accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

@media (max-width: 480px) {
  .site-container {
    padding: 0 1rem;
  }
}

/* ==========================================================================
   Header - Barra de navegación
   ========================================================================== */
.site-header {
  background: var(--bm-black);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Más espacio arriba cuando está visible la barra de administración de WordPress */
body.admin-bar .site-header {
  padding-top: 20px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--bm-header-height);
}

/* Búsqueda en la portada (debajo del título/descripción) - especificidad alta para producción */
.site-main .site-container .catalog-intro .index-search-form,
.catalog-intro .index-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.site-main .site-container .catalog-intro .index-search-form input[type="search"],
.catalog-intro .index-search-form input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--bm-font), sans-serif;
  color: #ffffff;
  color: var(--bm-text);
  background: #1e1d22;
  background: var(--bm-gray);
  border: 1px solid #333;
  border: 1px solid var(--bm-border);
  border-radius: 6px;
  border-radius: var(--bm-radius);
  -webkit-appearance: none;
  appearance: none;
}

.site-main .site-container .catalog-intro .index-search-form input[type="search"]::placeholder,
.catalog-intro .index-search-form input[type="search"]::placeholder {
  color: #b0b0b0;
  color: var(--bm-text-muted);
}

.site-main .site-container .catalog-intro .index-search-form input[type="search"]:focus,
.catalog-intro .index-search-form input[type="search"]:focus {
  outline: none;
  border-color: #FA0915;
  border-color: var(--bm-accent);
}

.site-main .site-container .catalog-intro .index-search-form .index-search-submit,
.catalog-intro .index-search-form .index-search-submit {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-family: var(--bm-font), sans-serif;
  font-weight: 600;
  color: #17161B;
  color: var(--bm-black);
  background: #FA0915;
  background: var(--bm-accent);
  border: none;
  border-radius: 6px;
  border-radius: var(--bm-radius);
  cursor: pointer;
  transition: background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.site-main .site-container .catalog-intro .index-search-form .index-search-submit:hover,
.catalog-intro .index-search-form .index-search-submit:hover {
  background: #ff1f2a;
  background: var(--bm-accent-hover);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-branding {
  flex-shrink: 0;
}

.site-branding .logo-link {
  display: block;
  line-height: 0;
}

.site-branding .logo-wrap {
  display: block;
  line-height: 0;
}

.site-branding a.custom-logo-link {
  display: block;
  line-height: 0;
  max-height: var(--bm-header-height);
}

.site-branding .custom-logo,
.site-branding .logo-wrap img,
.site-branding .site-logo-svg {
  display: block !important;
  max-height: 52px;
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.site-branding a.logo-svg {
  display: block;
  line-height: 0;
}

.site-branding .site-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--bm-text);
}

/* Botón hamburger (solo móvil) */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--bm-border);
  background: var(--bm-gray);
  color: var(--bm-text);
  cursor: pointer;
  border-radius: var(--bm-radius);
  transition: background 0.2s;
}

.menu-toggle:hover {
  background: var(--bm-gray-light);
}

.menu-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  margin: 0 auto;
  transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Menú principal - Desktop */
.main-nav {
  display: flex;
  align-items: center;
}

.primary-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.primary-menu > li {
  position: relative;
}

.primary-menu > li > a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--bm-text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
  border-radius: var(--bm-radius);
}

.primary-menu > li > a:hover {
  color: var(--bm-accent);
}

/* Submenú - Dropdown hover */
.primary-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  min-width: 200px;
  background: var(--bm-dark);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: absolute;
  top: 100%;
  left: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.primary-menu > .menu-item-has-children:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.primary-menu .sub-menu li a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--bm-text);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.primary-menu .sub-menu li a:hover {
  background: var(--bm-gray);
  color: var(--bm-accent);
}

/* Indicador de submenú (flecha) */
.primary-menu > .menu-item-has-children > a::after {
  content: "";
  display: inline-block;
  margin-left: 0.35em;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  vertical-align: middle;
}

/* ==========================================================================
   Navegación móvil
   ========================================================================== */
@media (max-width: 767px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bm-dark);
    border-bottom: 1px solid var(--bm-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .main-nav.is-open {
    max-height: 80vh;
    overflow-y: auto;
  }

  .primary-menu {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 1rem;
    gap: 0;
  }

  .primary-menu > li {
    border-bottom: 1px solid var(--bm-border);
  }

  .primary-menu > li:last-child {
    border-bottom: none;
  }

  .primary-menu > li > a {
    padding: 0.85rem 0.5rem;
  }

  /* Submenú en móvil: oculto por defecto, se abre con JS */
  .primary-menu .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--bm-gray);
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0 0 0 0.5rem;
    min-width: auto;
    transition: max-height 0.3s ease;
  }

  .primary-menu > .menu-item-has-children.submenu-open > .sub-menu {
    max-height: 500px;
    padding: 0.25rem 0 0.5rem;
  }

  .primary-menu .sub-menu li a {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .primary-menu > .menu-item-has-children > a::after {
    float: right;
    transition: transform 0.25s;
  }

  .primary-menu > .menu-item-has-children.submenu-open > a::after {
    transform: rotate(180deg);
  }
}

/* ==========================================================================
   Hero Slider (solo página principal) - mismo max-width que nav y footer
   ========================================================================== */
.hero-slider {
  position: relative;
  width: 100%;
  margin-bottom: 2rem;
  overflow: hidden;
  background: var(--bm-black);
}

.hero-slider .hero-slider-wrap {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

/* Slider pensado para imágenes 1200×500: max 500px de alto, misma proporción */
.hero-slider-inner {
  position: relative;
  width: 100%;
  max-height: 500px;
  aspect-ratio: 1200 / 500;
  border-radius: var(--bm-radius);
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 0;
}

.hero-slide.is-active {
  opacity: 1;
  z-index: 1;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-slider-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 2;
}

.hero-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.hero-dot:hover {
  background: rgba(255, 255, 255, 0.7);
}

.hero-dot.is-active {
  background: var(--bm-accent);
  transform: scale(1.2);
}

@media (max-width: 767px) {
  .hero-slider .hero-slider-wrap {
    padding: 0 1rem;
  }

  .hero-slider-dots {
    bottom: 0.75rem;
  }

  .hero-dot {
    width: 8px;
    height: 8px;
  }
}

@media (max-width: 480px) {
  .hero-slider .hero-slider-wrap {
    padding: 0 1rem;
  }
}

/* ==========================================================================
   Navegación - Categorías (debajo del header)
   ========================================================================== */
.categories-nav {
  background: var(--bm-gray);
  border-bottom: 1px solid var(--bm-border);
  padding: 0.75rem 0;
  margin-bottom: 2rem;
}

.categories-nav .site-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.categories-nav a {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bm-gray-light);
  color: var(--bm-text);
  border-radius: var(--bm-radius);
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.categories-nav a:hover,
.categories-nav a.active {
  background: var(--bm-accent);
  color: var(--bm-black);
}

/* ==========================================================================
   Main content
   ========================================================================== */
.site-main {
  flex: 1;
  padding: 2rem 0 4rem;
  min-height: 40vh;
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--bm-text);
}

.catalog-intro {
  text-align: center;
  margin-bottom: 2rem;
}

.catalog-intro .page-title {
  margin-bottom: 0.5rem;
}

.catalog-intro-text {
  margin: 0;
  color: var(--bm-text-muted);
  font-size: 1rem;
}

.entry-content,
.entry-title a {
  color: var(--bm-text);
}

.entry-title a:hover {
  color: var(--bm-accent);
}

/* ==========================================================================
   Grid de categorías (home)
   ========================================================================== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.category-card {
  background: var(--bm-dark);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.category-card:hover {
  border-color: var(--bm-accent);
  transform: translateY(-2px);
}

.category-card a {
  color: var(--bm-text);
}

.category-card a:hover {
  color: var(--bm-accent);
}

.category-card .count {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--bm-text-muted);
}

/* ==========================================================================
   Grid de productos
   ========================================================================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--bm-dark);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.product-card:hover {
  border-color: var(--bm-accent);
  transform: translateY(-2px);
}

.product-card .thumb {
  aspect-ratio: 1;
  background: var(--bm-gray);
  overflow: hidden;
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .content {
  padding: 1.25rem;
}

.product-card .title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
}

.product-card .title a {
  color: var(--bm-text);
}

.product-card .price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bm-accent);
  margin-bottom: 0.5rem;
}

.product-card .price .amount {
  font-weight: 700;
}

/* ==========================================================================
   Leyenda WhatsApp / CTA
   ========================================================================== */
.whatsapp-cta {
  background: var(--bm-gray);
  border: 1px solid var(--bm-accent);
  border-radius: var(--bm-radius);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  text-align: center;
}

.whatsapp-cta p {
  margin: 0 0 1rem;
  color: var(--bm-text);
  font-size: 1rem;
}

.whatsapp-cta .btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #25d366;
  color: #fff !important;
  border-radius: var(--bm-radius);
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}

.whatsapp-cta .btn-whatsapp:hover {
  background: #20bd5a;
  transform: scale(1.02);
  color: #fff !important;
}

/* ==========================================================================
   Single producto
   ========================================================================== */
.single-product-wrap {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .single-product-wrap {
    grid-template-columns: 1fr 1fr;
  }
}

.single-product-wrap .gallery {
  background: var(--bm-dark);
  border-radius: var(--bm-radius);
  overflow: hidden;
  aspect-ratio: 1;
}

.single-product-wrap .gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.single-product-wrap .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bm-accent);
  margin: 1rem 0;
}

.single-product-wrap .description {
  color: var(--bm-text-muted);
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bm-black);
  padding: 1.5rem 0;
  margin-top: auto;
  color: var(--bm-text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-copy {
  margin: 0;
  color: var(--bm-text-muted);
}

.footer-copy a {
  color: var(--bm-text);
}

.footer-copy a:hover {
  color: var(--bm-accent);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bm-gray);
  color: var(--bm-text);
  border-radius: var(--bm-radius);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.social-link:hover {
  background: var(--bm-accent);
  color: var(--bm-black);
  transform: scale(1.05);
}

.social-link svg {
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   Utilidades
   ========================================================================== */
.no-products {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--bm-text-muted);
}

.breadcrumb {
  font-family: "Roboto", sans-serif;
  font-size: 0.9rem;
  color: var(--bm-text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--bm-text-muted);
}

.breadcrumb a:hover {
  color: var(--bm-accent);
}

.breadcrumb-sep {
  margin: 0 0.4rem;
  opacity: 0.85;
}

.breadcrumb-current {
  color: var(--bm-text);
}

/* Descripción del producto: fuente legible (Roboto) */
.product-description-readable {
  font-family: "Roboto", sans-serif;
  line-height: 1.65;
}

/* Productos destacados en portada */
.front-products-section {
  margin-bottom: 3rem;
}

.front-products-title {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--bm-text);
}

/* =====================================================================
   Productos destacados (portada) – estructura independiente
   ===================================================================== */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.featured-product-card {
  display: block;
  background: #111111;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.featured-product-card:hover {
  border-color: #FA0915;
  transform: translateY(-2px);
}

.featured-product-img {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #1e1d22;
}

.featured-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-product-noimg {
  display: block;
  width: 100%;
  height: 100%;
  background: #1e1d22;
}

.featured-product-info {
  padding: 1rem 1.25rem 1.25rem;
}

.featured-product-name {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
}

.featured-product-price {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #FA0915;
}

/* Evitar scroll del body cuando menú móvil abierto */
body.menu-open {
  overflow: hidden;
}

/* Responsive: grids más pequeños en móvil */
@media (max-width: 480px) {
  .categories-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

}
