/* ==========================================================
   Mobile Header Offcanvas — Estilos
   Solo visible en dispositivos ≤1024px
   ========================================================== */

/* --- Variables CSS --- */
:root {
    --mho-header-height: 60px;
    --mho-header-bg: rgba(15, 15, 20, 0.95);
    --mho-header-bg-blur: blur(12px);
    --mho-text-color: #ffffff;
    --mho-text-muted: rgba(255, 255, 255, 0.6);
    --mho-accent: #6C63FF;
    --mho-accent-hover: #5A52D5;
    --mho-offcanvas-width: 85vw;
    --mho-offcanvas-max-width: 380px;
    --mho-offcanvas-bg: #111118;
    --mho-overlay-bg: rgba(0, 0, 0, 0.55);
    --mho-border-color: rgba(255, 255, 255, 0.08);
    --mho-transition-speed: 0.35s;
    --mho-transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --mho-search-bg: rgba(255, 255, 255, 0.08);
    --mho-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* --- Header Principal (oculto por defecto) --- */
.mho-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--mho-header-bg);
    backdrop-filter: var(--mho-header-bg-blur);
    -webkit-backdrop-filter: var(--mho-header-bg-blur);
    box-shadow: var(--mho-shadow);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Body padding cuando el header está visible */
@media (max-width: 1024px) {
    body {
        padding-top: var(--mho-header-height) !important;
    }
}

/* Soporte para la barra de administración nativa de WP */
.admin-bar .mho-mobile-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .mho-mobile-header {
        top: 46px;
        /* WP admin-bar más alta en móviles */
    }
}

.mho-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--mho-header-height);
    padding: 0 12px;
    max-width: 100%;
}

/* --- Visible solo en móvil/tablet --- */
@media (max-width: 1024px) {
    .mho-mobile-header {
        display: block;
    }
}

/* --- Botón Hamburguesa --- */
.mho-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    gap: 5px;
    flex-shrink: 0;
    border-radius: 10px;
    transition: background var(--mho-transition-speed) var(--mho-transition-ease);
}

.mho-hamburger:hover,
.mho-hamburger:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.mho-hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--mho-hamburger-color, var(--mho-text-color));
    border-radius: 2px;
    transition: all var(--mho-transition-speed) var(--mho-transition-ease);
    transform-origin: center;
}

/* Animación hamburguesa → X */
.mho-hamburger.is-active .mho-hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mho-hamburger.is-active .mho-hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mho-hamburger.is-active .mho-hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Logo --- */
.mho-header-logo {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 8px;
    min-width: 0;
}

.mho-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.mho-logo-img {
    max-height: 38px;
    width: auto;
    object-fit: contain;
}

.mho-logo-text {
    color: var(--mho-text-color);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Botón Buscador (header) --- */
.mho-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--mho-search-icon-color, var(--mho-text-color));
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 10px;
    transition: background var(--mho-transition-speed) var(--mho-transition-ease);
}

.mho-search-toggle:hover,
.mho-search-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

/* --- Barra de Búsqueda Desplegable (header) --- */
.mho-search-bar {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--mho-transition-speed) var(--mho-transition-ease),
        padding var(--mho-transition-speed) var(--mho-transition-ease);
    padding: 0 12px;
    border-top: 0px solid transparent;
}

.mho-search-bar.is-open {
    max-height: 70px;
    padding: 8px 12px 12px;
    border-top: 1px solid var(--mho-border-color);
}

/* --- Formulario de Búsqueda (compartido) --- */
.mho-search-form {
    display: flex;
    align-items: center;
    background: var(--mho-search-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--mho-border-color);
    transition: border-color var(--mho-transition-speed) var(--mho-transition-ease),
        box-shadow var(--mho-transition-speed) var(--mho-transition-ease);
}

.mho-search-form:focus-within {
    border-color: var(--mho-accent);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.mho-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--mho-text-color);
    padding: 10px 14px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

.mho-search-input::placeholder {
    color: var(--mho-text-muted);
}

.mho-search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--mho-text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.mho-search-submit:hover {
    color: var(--mho-accent);
}

/* ==========================================================
   OVERLAY
   ========================================================== */
.mho-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mho-overlay-bg);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 100000;
    opacity: 0;
    transition: opacity var(--mho-transition-speed) var(--mho-transition-ease);
}

.mho-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ==========================================================
   PANEL OFFCANVAS
   ========================================================== */
.mho-offcanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--mho-offcanvas-width);
    max-width: var(--mho-offcanvas-max-width);
    height: 100%;
    background: var(--mho-offcanvas-bg);
    z-index: 100001;
    transform: translateX(-105%);
    transition: transform var(--mho-transition-speed) var(--mho-transition-ease);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
}

.mho-offcanvas.is-open {
    transform: translateX(0);
}

/* --- Cabecera del Offcanvas --- */
.mho-offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--mho-border-color);
    flex-shrink: 0;
}

.mho-offcanvas-logo .mho-logo-img {
    max-height: 34px;
}

.mho-offcanvas-logo .mho-logo-text {
    font-size: 16px;
}

.mho-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--mho-text-color);
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.mho-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: rotate(90deg);
}

/* --- Buscador del Offcanvas --- */
.mho-offcanvas-search {
    padding: 16px 20px 8px;
    flex-shrink: 0;
}

/* --- Menú del Offcanvas --- */
.mho-offcanvas-menu {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.mho-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mho-menu-list li {
    border-bottom: 1px solid var(--mho-border-color);
}

.mho-menu-list li:last-child {
    border-bottom: none;
}

.mho-menu-list li a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: var(--mho-text-color);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.mho-menu-list li a:hover,
.mho-menu-list li a:focus {
    background: rgba(108, 99, 255, 0.08);
    color: var(--mho-accent);
    padding-left: 30px;
}

.mho-menu-list li.current-menu-item>a,
.mho-menu-list li.current_page_item>a {
    color: var(--mho-accent);
    background: rgba(108, 99, 255, 0.06);
    border-left: 3px solid var(--mho-accent);
}

/* Sub-menús */
.mho-menu-list .menu-item-has-children {
    position: relative;
}

.mho-submenu-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--mho-text-color);
    cursor: pointer;
    z-index: 10;
    border-left: 1px solid var(--mho-border-color);
}

.mho-submenu-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s var(--mho-transition-ease);
}

.mho-submenu-toggle.is-open svg {
    transform: rotate(180deg);
}

.mho-menu-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.15);
    display: none !important;
}

.mho-menu-list .sub-menu.is-open {
    display: block !important;
    animation: mho-fade-in 0.3s ease;
}

.mho-menu-list .sub-menu li a {
    padding-left: 40px;
    font-size: 14px;
    font-weight: 400;
    color: var(--mho-text-muted);
}

.mho-menu-list .sub-menu li a:hover {
    color: var(--mho-text-color);
    padding-left: 46px;
}

.mho-menu-list .sub-menu .sub-menu li a {
    padding-left: 56px;
    font-size: 13px;
}

/* --- Footer del Offcanvas --- */
.mho-offcanvas-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--mho-border-color);
    flex-shrink: 0;
}

.mho-offcanvas-footer p {
    margin: 0;
    color: var(--mho-text-muted);
    font-size: 12px;
    text-align: center;
}

/* ==========================================================
   BODY LOCK (cuando offcanvas está abierto)
   ========================================================== */
body.mho-body-locked {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* ==========================================================
   ANIMACIONES DE ENTRADA
   ========================================================== */
@keyframes mho-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes mho-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mho-offcanvas.is-open .mho-menu-list li {
    animation: mho-slide-up 0.3s var(--mho-transition-ease) both;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(1) {
    animation-delay: 0.05s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(2) {
    animation-delay: 0.1s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(3) {
    animation-delay: 0.15s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(4) {
    animation-delay: 0.2s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(5) {
    animation-delay: 0.25s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(6) {
    animation-delay: 0.3s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(7) {
    animation-delay: 0.35s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(8) {
    animation-delay: 0.4s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(9) {
    animation-delay: 0.45s;
}

.mho-offcanvas.is-open .mho-menu-list li:nth-child(10) {
    animation-delay: 0.5s;
}

/* ==========================================================
   RESPONSIVE REFINEMENTS
   ========================================================== */
@media (max-width: 480px) {
    :root {
        --mho-offcanvas-width: 90vw;
    }

    .mho-header-inner {
        padding: 0 8px;
    }

    .mho-menu-list li a {
        padding: 13px 20px;
        font-size: 14px;
    }
}

/* Ocultar en desktop */
@media (min-width: 1025px) {

    .mho-mobile-header,
    .mho-overlay,
    .mho-offcanvas {
        display: none !important;
    }
}