/* General improvements */
body {
    overflow-x: hidden;
}

/* --- Mobile Header Customization --- */
.custom-mobile-nav { display: none; }
.custom-mobile-menu { display: none; }

@media only screen and (max-width: 980px) {
    /* Hide default Divi navigation */
    #et-top-navigation, 
    .logo_container {
        display: none !important;
    }

    /* Force header container to full width */
    #main-header .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Custom Mobile Header */
    .custom-mobile-nav {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: relative;
        width: 100% !important;
        padding: 10px 15px;
        background-color: #d6d6d6;
        box-sizing: border-box;
        min-height: 80px;
    }

    .et-fixed-header .custom-mobile-nav {
        padding: 5px 15px !important;
        min-height: 60px !important;
    }

    .mobile-logo-centered img {
        max-height: 70px;
        width: auto;
        transition: max-height 0.3s;
    }

    .et-fixed-header .mobile-logo-centered img {
        max-height: 50px !important;
    }

    .hamburger-icon {
        position: absolute;
        right: 15px;
        font-size: 30px;
        cursor: pointer;
        color: #7c9a75;
    }

    .custom-mobile-menu {
        display: none;
        list-style: none;
        padding: 20px;
        margin: 0;
        background: #fff;
        width: 100%;
        box-sizing: border-box;
        border-top: 2px solid #eee;
        position: relative;
        z-index: 999999;
    }

    .custom-mobile-menu.active { display: block !important; }
    .custom-mobile-menu li { margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
    .custom-mobile-menu li a { font-family: 'Open Sans Condensed', sans-serif; font-size: 18px; color: #333 !important; text-decoration: none; font-weight: bold; display: block; }
    .custom-mobile-menu li.current-menu-item > a { color: #7c9a75 !important; }

    #main-header { height: auto !important; min-height: unset !important; padding: 0 !important; z-index: 999999 !important; position: relative; }
    #main-header .et_menu_container { display: block !important; padding: 0 !important; height: auto !important; }
    .et_pb_row .et_pb_column_1_4 { width: 100% !important; float: none !important; margin-bottom: 20px; }
    #footer-info { text-align: center; padding: 10px; }
    .et-pb-slider-arrows { z-index: 1 !important; }

    /* Sub-menú en mobile: oculto por defecto, visible en active-parent */
    /* Sub-menú en mobile: siempre visible, tabulado */
    .custom-mobile-menu .sub-menu {
        display: block !important;
        list-style: none;
        padding: 0 0 0 25px;
        margin: 5px 0 0 0;
        border-left: 1px solid #eee;
    }
    .custom-mobile-menu .sub-menu li {
        margin-bottom: 5px;
        border-bottom: none;
        padding-bottom: 0;
    }
    .custom-mobile-menu .sub-menu li a {
        font-size: 16px !important;
        font-weight: normal;
        color: #666 !important;
        padding: 5px 0;
    }
    .custom-mobile-menu li.current-menu-item > .sub-menu li.current-menu-item a {
        color: #7c9a75 !important;
    }
    /* Asegurar que las imágenes hero (slider) se vean más completas en móviles */
    .et_pb_slider, .et_pb_slides, .et_pb_slide {
        min-height: 250px !important;
    }
    .et_pb_slide_description {
        padding-top: 100px !important;
        padding-bottom: 100px !important;
    }
}

/* Ensure custom nav is hidden on desktop */
@media only screen and (min-width: 981px) {
    .custom-mobile-nav, .custom-mobile-menu {
        display: none !important;
    }
}

/* --- WhatsApp Floating Button --- */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 40px;
    right: 40px;
    background-color: #7c9a75; /* Brand Green */
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 2px 5px 15px rgba(0,0,0,0.3);
    background-color: #6a8564;
}

.whatsapp-float svg {
    width: 35px;
    height: 35px;
    fill: white;
}

/* --- Google Maps Section --- */
.map-container {
    margin-top: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #7c9a75;
}

.map-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.map-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    background: #7c9a75;
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.map-btn:hover {
    background: #6a8564;
    transform: translateY(-2px);
}

.map-btn.secondary {
    background: #555;
}

.map-btn.secondary:hover {
    background: #333;
}

/* --- Fix submenú en Desktop --- */
#top-menu li.menu-item-has-children {
    position: relative;
}
#top-menu li.menu-item-has-children ul.sub-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    background-color: #d6d6d6;
    min-width: 180px;
    padding: 10px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    list-style: none;
    margin: 0;
}
#top-menu li.menu-item-has-children:hover ul.sub-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
#top-menu li.menu-item-has-children ul.sub-menu li a {
    display: block;
    padding: 8px 20px;
    color: #555;
    font-size: 16px;
    white-space: nowrap;
}
#top-menu li.menu-item-has-children ul.sub-menu li a:hover {
    color: #7c9a75;
}

/* --- Centrar el logo en el menú split (Desktop) --- */
@media only screen and (min-width: 981px) {
    #top-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100% !important;
    }

    #top-menu li.centered-logo-menu {
        flex: 0 0 auto !important;
        margin: 0 30px !important;
    }

    #top-menu > li:not(.centered-logo-menu) {
        flex: 1 !important;
    }

    /* Los dos ítems de la izquierda alineados a la derecha */
    #top-menu > li:nth-child(1),
    #top-menu > li:nth-child(2) {
        text-align: right;
        justify-content: flex-end !important;
    }

    /* Los dos ítems de la derecha alineados a la izquierda */
    #top-menu > li:nth-child(4),
    #top-menu > li:nth-child(5) {
        text-align: left;
        justify-content: flex-start !important;
    }

    /* Agrandar logo y dar más espacio a la barra superior en desktop */
    #page-container {
        padding-top: 94px !important;
    }
    
    /* Estado Normal (Cabecera Grande) */
    #main-header:not(.et-fixed-header) {
        height: 94px !important;
        padding: 0 !important;
        display: flex;
        align-items: center;
    }
    #main-header:not(.et-fixed-header) .container {
        padding: 0 !important;
        height: 100%;
        display: flex;
        align-items: center;
        width: 100%;
    }
    #main-header:not(.et-fixed-header) #top-menu li.centered-logo-menu img#logo-centered {
        max-height: 70px !important;
        width: auto !important;
        transition: all 0.3s ease-in-out;
    }

    #main-header:not(.et-fixed-header) .centered-logo-menu {
        padding: 12px 0 !important; /* margen arriba y abajo del logo */
    }

    /* Estado Fixed (Cabecera reducida al hacer scroll) */
    #main-header.et-fixed-header {
        height: 70px !important; /* Altura de la barra reducida */
        padding: 0 !important;
        display: flex;
        align-items: center;
    }
    #main-header.et-fixed-header .container {
        height: 100%;
        display: flex;
        align-items: center;
        width: 100%;
    }
    #main-header.et-fixed-header #top-menu li.centered-logo-menu img#logo-centered {
        max-height: 60px !important; /* Logo más pequeño para que quepa en la barra pegajosa */
        width: auto !important;
        transition: all 0.3s ease-in-out;
    }

    #et-top-navigation {
        display: flex !important;
        width: 100%;
        height: 100%;
        align-items: center;
    }
    #top-menu li > a {
        font-size: 18px !important; /* Agrandar un poquito la fuente de los menús también para balancear */
        line-height: normal !important;
        padding-bottom: 0 !important;
        transition: all 0.3s ease-in-out;
    }
    #main-header.et-fixed-header #top-menu li > a {
        font-size: 16px !important; /* Reducir letra al hacer scroll */
    }
}
