/* MTG_UMH_HIDE_LEGACY_FIRST_PAINT_START */

/*
 * Desde el primer render móvil:
 *
 * - Ocultar topbar móvil antiguo.
 * - Ocultar header principal antiguo.
 * - Mostrar únicamente MTG Universal Mobile Header.
 *
 * Clases exactas del header global antiguo.
 * No toca heroes, builders ni contenido de templates.
 */
@media (max-width:780px) {

    body .mtg-header-topbar--mobile {
        display:none !important;
        visibility:hidden !important;
    }

    body header.mtg-header-main {
        display:none !important;
        visibility:hidden !important;
    }

    body #mtg-universal-mobile-header {
        display:block !important;
        visibility:visible !important;
    }
}

/* MTG_UMH_HIDE_LEGACY_FIRST_PAINT_END */

/*
 * MTG UNIVERSAL MOBILE HEADER
 * Un solo esqueleto para todos los templates.
 */

.mtg-umh {
    display:none;
}

@media (max-width:780px) {

    /*
     * Se oculta el header móvil antiguo completo cuando
     * el script identifica su contenedor.
     */
    .mtg-legacy-mobile-header {
        display:none !important;
    }

    /*
     * Respaldo cuando no existe un contenedor identificable.
     */
    .mtg-legacy-mobile-topbar {
        display:none !important;
    }

    #mtg-universal-mobile-header.mtg-umh {
        position:relative;
        z-index:10000;

        display:block !important;

        width:100%;
        max-width:100%;

        margin:0;
        padding:0;

        background:#fff;
        border:0;
        box-shadow:0 10px 28px rgba(15,23,42,.08);

        font-family:inherit;
        box-sizing:border-box;
    }

    #mtg-universal-mobile-header *,
    #mtg-universal-mobile-header *::before,
    #mtg-universal-mobile-header *::after {
        box-sizing:border-box;
    }

    /*
     * TOPBAR
     */
    .mtg-umh__topbar {
        display:flex;
        align-items:center;
        justify-content:center;

        width:100%;
        min-height:34px;

        margin:0;
        padding:6px 48px;

        gap:5px;

        background:#b58bb1;
        color:#fff;

        font-size:14px;
        font-weight:800;
        line-height:1.25;
        text-align:center;
        white-space:nowrap;
    }

    .mtg-umh__topbar-icon,
    .mtg-umh__topbar-text {
        display:inline;
        width:auto;
        margin:0;
        padding:0;
        flex:0 0 auto;
        white-space:nowrap;
    }

    /*
     * LOGO + HAMBURGUESA
     */
    .mtg-umh__brand-row {
        position:relative;

        display:grid;
        grid-template-columns:minmax(0,1fr) 46px;
        align-items:center;

        width:100%;
        min-height:98px;

        margin:0;
        padding:12px 14px 8px 18px;

        background:#fff;
    }

    .mtg-umh__brand {
        display:flex;
        align-items:center;
        justify-content:center;

        width:100%;
        min-width:0;
        height:78px;

        margin:0;
        padding:0 4px;

        color:#0f172a;
        text-decoration:none;
        overflow:hidden;
    }

    .mtg-umh__logo {
        display:block;

        width:auto !important;
        height:auto !important;

        max-width:100% !important;
        max-height:76px !important;

        min-width:0 !important;
        min-height:0 !important;

        margin:0 auto !important;
        padding:0 !important;

        object-fit:contain !important;
        object-position:center !important;

        transform:none !important;
    }

    .mtg-umh__site-name {
        display:block;

        width:100%;

        font-size:28px;
        font-weight:900;
        line-height:1.05;
        text-align:center;
        overflow-wrap:anywhere;
    }

    .mtg-umh__menu-button {
        display:flex;
        flex-direction:column;
        align-items:center;
        justify-content:center;

        width:42px;
        height:42px;

        margin:0;
        padding:8px;

        border:1px solid #d9e2ef;
        border-radius:14px;

        background:#fff;
        box-shadow:0 8px 20px rgba(15,23,42,.12);

        cursor:pointer;
    }

    .mtg-umh__menu-button span {
        display:block;

        width:21px;
        height:3px;

        margin:2px 0;
        padding:0;

        border-radius:999px;
        background:#153047;
    }

    /*
     * BOTONES
     */
    .mtg-umh__actions {
        display:flex;
        align-items:center;
        justify-content:center;
        flex-wrap:nowrap;

        width:100%;

        margin:0;
        padding:8px 12px 14px;

        gap:7px;

        background:#fff;
    }

    .mtg-umh__action {
        display:inline-flex;
        align-items:center;
        justify-content:center;

        min-height:40px;

        margin:0;
        padding:8px 15px;

        border:0;
        border-radius:11px;

        color:#fff;
        font-size:14px;
        font-weight:900;
        line-height:1;
        text-decoration:none;
        white-space:nowrap;
    }

    .mtg-umh__action--whatsapp {
        background:#159657;
    }

    .mtg-umh__action--offers {
        gap:4px;
        background:#111827;
    }

    .mtg-umh__action--offers span {
        color:#ff7417;
    }

    .mtg-umh__icon-button {
        display:inline-flex;
        align-items:center;
        justify-content:center;

        width:40px;
        height:40px;
        flex:0 0 40px;

        margin:0;
        padding:0;

        border:2px solid #142238;
        border-radius:11px;

        background:#fff;
        color:#142238;

        font-size:20px;
        font-weight:900;
        line-height:1;
        text-decoration:none;

        cursor:pointer;
    }

    /*
     * BUSCADOR
     */
    .mtg-umh__search {
        width:100%;
        margin:0;
        padding:10px 14px 16px;
        background:#fff;
        border-top:1px solid #eef2f7;
    }

    .mtg-umh__search[hidden] {
        display:none !important;
    }

    .mtg-umh__search form {
        display:flex;
        width:100%;
        margin:0;
    }

    .mtg-umh__search input[type="search"] {
        width:100%;
        min-height:44px;

        margin:0;
        padding:10px 14px;

        border:1px solid #d6deea;
        border-radius:10px 0 0 10px;

        font:inherit;
    }

    .mtg-umh__search input[type="submit"],
    .mtg-umh__search button[type="submit"] {
        min-height:44px;

        margin:0;
        padding:10px 16px;

        border:0;
        border-radius:0 10px 10px 0;

        background:#142238;
        color:#fff;

        font-weight:800;
    }

    /*
     * MENÚ DESPLEGABLE
     */
    .mtg-umh__drawer {
        width:100%;
        max-height:calc(100vh - 170px);

        margin:0;
        padding:10px 16px 18px;

        overflow-y:auto;

        background:#fff;
        border-top:1px solid #edf1f6;
        box-shadow:0 20px 40px rgba(15,23,42,.14);
    }

    .mtg-umh__drawer[hidden] {
        display:none !important;
    }

    .mtg-umh__menu,
    .mtg-umh__drawer ul {
        display:block;

        width:100%;

        margin:0;
        padding:0;

        list-style:none;
    }

    .mtg-umh__drawer li {
        display:block;
        width:100%;
        margin:0;
        padding:0;
    }

    .mtg-umh__drawer a {
        display:block;

        width:100%;

        margin:0;
        padding:12px 4px;

        border-bottom:1px solid #edf1f6;

        color:#142238;
        font-size:15px;
        font-weight:750;
        line-height:1.35;
        text-decoration:none;
    }

    .mtg-umh__drawer .children,
    .mtg-umh__drawer .sub-menu {
        padding-left:16px;
    }
}

@media (max-width:390px) {
    .mtg-umh__topbar {
        font-size:13px;
        padding-left:42px;
        padding-right:42px;
    }

    .mtg-umh__brand-row {
        grid-template-columns:minmax(0,1fr) 42px;
        min-height:92px;
        padding-left:12px;
        padding-right:10px;
    }

    .mtg-umh__brand {
        height:72px;
    }

    .mtg-umh__logo {
        max-height:68px !important;
    }

    .mtg-umh__actions {
        gap:5px;
        padding-left:8px;
        padding-right:8px;
    }

    .mtg-umh__action {
        padding-left:11px;
        padding-right:11px;
        font-size:13px;
    }

    .mtg-umh__icon-button {
        width:37px;
        height:37px;
        flex-basis:37px;
    }
}

@media (min-width:781px) {
    #mtg-universal-mobile-header {
        display:none !important;
    }
}

/* MTG_HIDE_OLD_MOBILE_HEADER_START */
@media (max-width:780px) {

    .mtg-header-topbar--mobile {
        display:none !important;
    }

    header.mtg-header-main {
        display:none !important;
    }

    #mtg-universal-mobile-header {
        display:block !important;
    }

}
/* MTG_HIDE_OLD_MOBILE_HEADER_END */



/* ==========================================================
   MTG UNIVERSAL HEADER V2
   SOLO UN HEADER MÓVIL
   ========================================================== */

/* MTG_UMH_V2_LEGACY_HIDE_START */

@media (max-width:780px) {

    /*
     * TOPBAR ANTIGUO
     *
     * Especificidad deliberadamente mayor que la regla
     * inline del viejo header.
     */
    html body
    .mtg-header-topbar.mtg-header-topbar--mobile {
        display:none !important;
        visibility:hidden !important;
        opacity:0 !important;
        height:0 !important;
        min-height:0 !important;
        max-height:0 !important;
        margin:0 !important;
        padding:0 !important;
        overflow:hidden !important;
        pointer-events:none !important;
    }

    /*
     * HEADER PRINCIPAL ANTIGUO.
     */
    html body
    header.mtg-header-main {
        display:none !important;
        visibility:hidden !important;
        opacity:0 !important;
        height:0 !important;
        min-height:0 !important;
        max-height:0 !important;
        margin:0 !important;
        padding:0 !important;
        overflow:hidden !important;
        pointer-events:none !important;
    }

    /*
     * El header universal siempre visible.
     */
    html body
    #mtg-universal-mobile-header.mtg-umh {
        display:block !important;
        visibility:visible !important;
        opacity:1 !important;
        height:auto !important;
        max-height:none !important;
        overflow:visible !important;
        pointer-events:auto !important;
    }

    /*
     * El botón nuevo queda exactamente a la altura del logo.
     */
    html body
    #mtg-universal-mobile-header
    .mtg-umh__brand-row {
        position:relative !important;

        display:grid !important;
        grid-template-columns:minmax(0,1fr) 46px !important;

        align-items:center !important;

        width:100% !important;
    }

    html body
    #mtg-universal-mobile-header
    .mtg-umh__menu-button {
        position:static !important;

        display:flex !important;
        align-items:center !important;
        justify-content:center !important;

        width:42px !important;
        height:42px !important;

        min-width:42px !important;
        min-height:42px !important;

        max-width:42px !important;
        max-height:42px !important;

        margin:0 !important;

        transform:none !important;

        z-index:5 !important;
    }

    /*
     * Ya no usamos el dropdown propio del header universal.
     */
    html body
    #mtg-universal-mobile-header
    #mtg-umh-menu {
        display:none !important;
    }

}

/* MTG_UMH_V2_LEGACY_HIDE_END */

/* MTG_UMH_VISUAL_FIX_V1_START */

@media (max-width:780px) {

    /*
     * HAMBURGUESA BLANCO EN TODOS LOS TM
     */
    html body #mtg-universal-mobile-header .mtg-umh__menu-button,
    html body #mtg-universal-mobile-header button.mtg-umh__menu-button,
    html body #mtg-universal-mobile-header .mtg-umh__brand-row .mtg-umh__menu-button {
        background: #ffffff !important;
        color: #243b53 !important;
        border: 1px solid rgba(148,163,184,.38) !important;
        box-shadow: 0 10px 24px rgba(15,23,42,.14) !important;
        border-radius: 14px !important;
    }

    html body #mtg-universal-mobile-header .mtg-umh__menu-button svg,
    html body #mtg-universal-mobile-header .mtg-umh__menu-button i,
    html body #mtg-universal-mobile-header .mtg-umh__menu-button span,
    html body #mtg-universal-mobile-header .mtg-umh__menu-button::before,
    html body #mtg-universal-mobile-header .mtg-umh__menu-button::after {
        color: #243b53 !important;
        stroke: currentColor !important;
        fill: none !important;
    }

    /*
     * BOTÓN OFERTAS SIN PUNTOS NARANJAS
     */
    html body #mtg-universal-mobile-header [data-mtg-offers-button]::before,
    html body #mtg-universal-mobile-header [data-mtg-offers-button]::after,
    html body #mtg-universal-mobile-header [data-mtg-offers-button] *::before,
    html body #mtg-universal-mobile-header [data-mtg-offers-button] *::after {
        content: none !important;
        box-shadow: none !important;
    }

    html body #mtg-universal-mobile-header [data-mtg-offers-button] [data-mtg-remove-dot="1"] {
        display: none !important;
    }

    /*
     * ZONA DE LOGO
     */
    html body #mtg-universal-mobile-header .mtg-umh__brand-row {
        align-items: center !important;
        grid-template-columns: minmax(0,1fr) 46px !important;
        gap: 12px !important;
    }

    html body #mtg-universal-mobile-header .mtg-umh__brand-row > :first-child {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    html body #mtg-universal-mobile-header .mtg-umh__brand-logo-replaced {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        min-width: 0 !important;
        text-decoration: none !important;
    }

    html body #mtg-universal-mobile-header .mtg-umh__brand-logo-replaced img {
        display: block !important;
        width: auto !important;
        max-width: 100% !important;
        max-height: 58px !important;
        height: auto !important;
        object-fit: contain !important;
    }
}

/* MTG_UMH_VISUAL_FIX_V1_END */


/* MTG_MAIN_SITE_HEADER_RESTORE_START */

/*
 * El sitio principal NO usa MTG Universal Mobile Header.
 */
body.home #mtg-universal-mobile-header,
body.blog-id-1 #mtg-universal-mobile-header {
    display:none !important;
}

/*
 * Restaurar header original del main site.
 * Estas reglas prevalecen sobre parches legacy recientes.
 */
body.home header,
body.blog-id-1 header {
    visibility:visible !important;
    opacity:1 !important;
}

body.home .site-header,
body.blog-id-1 .site-header {
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
    pointer-events:auto !important;
}

/* MTG_MAIN_SITE_HEADER_RESTORE_END */
