/**
 * Custom Styles - Muebles Para Hogar
 * Arreglos para responsividad y ménu duplicado
 * 
 * Cambios:
 * 1. Arreglar menú duplicado en móvil
 * 2. Mejorar responsividad general
 * 3. Mover banner al tope
 * 4. Mejorar vista en dispositivos pequeños
 */

/* ============================================================
   1. SOLUCIÓN MENÚ DUPLICADO - VISIBILIDAD CORRECTA
   ============================================================ */

/* Ocultar menú primario en móvil de forma EXPLÍCITA */
@media screen and (max-width: 991px) {
    #site-navigation.main-navigation {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Asegurar que el menú de hamburguesa funcione */
    .alt-menu-icon {
        display: block !important;
    }
}

/* Mostrar menú primario en desktop */
@media screen and (min-width: 992px) {
    #site-navigation.main-navigation {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Ocultar menú offcanvas completamente en desktop */
    #offcanvas-menu {
        display: none !important;
    }
    
    .offcanvas-menu-toggler {
        display: none !important;
    }
}

/* ============================================================
   2. MEJORAS RESPONSIVAS - CONTENEDOR Y ESPACIADO
   ============================================================ */

/* Contenedores responsivos */
.container {
    max-width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

@media screen and (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media screen and (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media screen and (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media screen and (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Elementos que salen de su recuadro - texto y contenido */
.site-content > * {
    max-width: 100%;
    overflow-x: hidden;
}

/* Imágenes responsivas */
img {
    max-width: 100% !important;
    height: auto !important;
}

.wp-block-image img,
.post-content img,
.entry-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* Videos responsivos */
iframe,
video,
embed,
.video-container {
    max-width: 100% !important;
    height: auto !important;
}

/* ============================================================
   3. BANNER PRINCIPAL - MOVER AL TOPE
   ============================================================ */

/* Reposicionar header al tope */
.site-header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Banner/Slider al tope */
.header-image-wrap {
    position: relative;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.bottom-header.header-image-wrap {
    position: relative;
    top: 0;
    z-index: 2;
}

/* Slider de imágenes responsivo */
.header-image-slider {
    width: 100%;
    height: auto;
    min-height: 300px;
}

@media screen and (max-width: 576px) {
    .header-image-slider {
        min-height: 200px;
    }
}

@media screen and (min-width: 577px) and (max-width: 991px) {
    .header-image-slider {
        min-height: 250px;
    }
}

@media screen and (min-width: 992px) {
    .header-image-slider {
        min-height: 400px;
    }
}

/* Overlay del banner */
.header-image-wrap .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    z-index: 1;
}

/* ============================================================
   4. NAVEGACIÓN RESPONSIVA - MEJORAS
   ============================================================ */

/* Menu principal */
nav.main-navigation {
    width: 100%;
}

nav.main-navigation .menu,
nav.main-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

nav.main-navigation .menu li,
nav.main-navigation ul li {
    padding: 0;
    margin: 0;
}

/* Top header responsivo */
.top-header {
    width: 100%;
}

.top-header-inner {
    width: 100%;
}

/* Iconos header en móvil */
.header-icons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

@media screen and (max-width: 991px) {
    .header-icons {
        gap: 10px;
    }
}

/* ============================================================
   5. MEJORAS GRID Y LAYOUTS EN MÓVIL
   ============================================================ */

/* Filas responsivas */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.row > [class^="col-"],
.row > [class*=" col-"] {
    padding-right: 15px;
    padding-left: 15px;
    min-height: 1px;
}

/* Columnas en móvil */
@media screen and (max-width: 575px) {
    .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .col-md-4,
    .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .col-lg-3,
    .col-lg-4,
    .col-lg-6,
    .col-lg-8 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Columnas en tablets */
@media screen and (min-width: 576px) and (max-width: 991px) {
    .col-md-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    .col-md-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    .col-lg-3,
    .col-lg-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    .col-lg-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================================
   6. TEXTO Y CONTENIDO RESPONSIVO
   ============================================================ */

/* Encabezados responsivos */
h1 {
    font-size: clamp(24px, 5vw, 48px);
    overflow-wrap: break-word;
    word-break: break-word;
}

h2 {
    font-size: clamp(20px, 4vw, 36px);
    overflow-wrap: break-word;
}

h3 {
    font-size: clamp(18px, 3.5vw, 28px);
    overflow-wrap: break-word;
}

h4,
h5,
h6 {
    font-size: clamp(16px, 3vw, 22px);
    overflow-wrap: break-word;
}

/* Párrafos responsivos */
p {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

@media screen and (max-width: 575px) {
    p {
        font-size: 14px;
        line-height: 1.6;
    }
}

/* Links responsivos */
a {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================================
   7. FORMULARIOS RESPONSIVOS
   ============================================================ */

form,
.form-group {
    width: 100%;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.5;
    box-sizing: border-box;
}

/* ============================================================
   8. WOOCOMMERCE - RESPONSIVIDAD DE PRODUCTOS
   ============================================================ */

.woocommerce-products {
    width: 100%;
    overflow-x: hidden;
}

.products {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

@media screen and (max-width: 575px) {
    .products {
        gap: 10px;
    }
    
    .products li {
        width: calc(50% - 5px) !important;
        flex: 0 0 calc(50% - 5px);
    }
}

@media screen and (min-width: 576px) and (max-width: 991px) {
    .products li {
        width: calc(50% - 7.5px) !important;
        flex: 0 0 calc(50% - 7.5px);
    }
}

@media screen and (min-width: 992px) {
    .products li {
        width: calc(33.333% - 10px) !important;
        flex: 0 0 calc(33.333% - 10px);
    }
}

/* ============================================================
   9. TABLA RESPONSIVA
   ============================================================ */

table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

@media screen and (max-width: 767px) {
    table {
        font-size: 14px;
    }
    
    table thead {
        display: none;
    }
    
    table tbody,
    table tr,
    table td {
        display: block;
        width: 100%;
    }
    
    table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        padding: 10px;
    }
    
    table td:before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 120px;
    }
}

/* ============================================================
   10. ELEMENTOS ESPECÍFICOS - CORRECCIONES
   ============================================================ */

/* Asegurar que site-branding no se recorte */
.site-branding {
    max-width: 100%;
    overflow-x: hidden;
}

/* Header button responsivo */
.header-btn {
    width: 100%;
}

.header-btn a {
    display: inline-block;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Top header contact */
.top-header-inner .container {
    width: 100%;
    padding: 0 15px;
}

/* Search form */
#search-form,
.header-search {
    max-width: 100%;
    width: 100%;
}

.header-search-wrap input,
.header-search-wrap button {
    max-width: 100%;
}

/* ============================================================
   11. SCROLLING Y OVERFLOW - PREVENCIÓN
   ============================================================ */

html,
body {
    overflow-x: hidden;
}

body {
    max-width: 100vw;
    overflow-x: hidden;
}

.site {
    max-width: 100%;
    overflow-x: hidden;
}

#page {
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================================
   12. FIX BOOTSTRAP CLASSES ADICIONALES
   ============================================================ */

/* Asegurar que d-none funciona correctamente */
.d-none {
    display: none !important;
}

/* Asegurar que d-lg-block funciona correctamente */
@media screen and (min-width: 992px) {
    .d-lg-block {
        display: block !important;
    }
}

/* Asegurar que d-lg-none funciona correctamente */
@media screen and (min-width: 992px) {
    .d-lg-none {
        display: none !important;
    }
}

/* Visible con condiciones adicionales */
@media screen and (max-width: 991px) {
    .d-lg-none {
        display: block !important;
    }
}

/* ============================================================
   13. CARGA DE PÁGINA - ANIMACIONES
   ============================================================ */

/* Suavizar transiciones */
* {
    transition-property: background-color, color, border-color;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* Bloquear transiciones en carga */
*:not(.no-transitions) {
    /* Las transiciones ayudan pero no ralentizan */
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    nav,
    .header-btn,
    .site-header {
        display: none;
    }
}
