/* Barra global + drawer móvil. La navegación principal está en cabecera / drawer (sin bottom bar por defecto). */

/* Todo el shell por encima del contenido (mapas Leaflet, paneles a pantalla completa, etc.) */
#mtb-shell-mount {
    position: relative;
    z-index: 500000;
}

:root {
    --mtb-shell-top-pad: 56px;
    --mtb-shell-ink: #0f2942;
    --mtb-shell-slate: #2b5b84;
    --mtb-shell-bg: #eef2f6;
}

.mtb-shell-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    /* Por encima del drawer (#map .app-sidebar llega a 10500 en móvil con shell) */
    z-index: 12110;
    background: var(--mtb-shell-slate);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 41, 66, 0.15);
}

.mtb-shell-inner {
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    min-height: 52px;
}

.mtb-shell-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    margin-right: auto;
}

.mtb-shell-brand img {
    display: block;
    border-radius: 8px;
}

.mtb-shell-burger {
    display: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.mtb-shell-nav-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mtb-shell-nav-item {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.mtb-shell-nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.mtb-shell-nav-item.is-active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}

.mtb-shell-nav-cta {
    background: #ea580c;
    color: #fff !important;
    font-weight: 600;
}

.mtb-shell-nav-cta:hover {
    background: #c2410c;
}

.mtb-shell-nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    cursor: pointer;
}

.mtb-shell-nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Drawer */
.mtb-shell-drawer {
    position: fixed;
    inset: 0;
    z-index: 12100;
    pointer-events: none;
}

.mtb-shell-drawer:not(.hidden) {
    pointer-events: auto;
}

.mtb-shell-drawer.hidden {
    visibility: hidden;
}

.mtb-shell-drawer-scrim {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 41, 66, 0.45);
}

.mtb-shell-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    width: min(320px, 92vw);
    height: 100%;
    background: #fff;
    color: var(--mtb-shell-ink);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s ease;
}

.mtb-shell-drawer:not(.hidden) .mtb-shell-drawer-panel {
    transform: translateX(0);
}

.mtb-shell-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e2eaf0;
    font-weight: 700;
    color: var(--mtb-shell-slate);
    flex-shrink: 0;
}

.mtb-shell-drawer-head button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--mtb-shell-slate);
}

.mtb-shell-drawer-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    gap: 10px;
}

/*
  Enlaces del drawer llevan también .mtb-shell-nav-item (cabecera escritorio).
  Hace falta mayor especificidad o los estilos de .mtb-shell-nav-item.is-active
  pueden dejar fondo blanco / texto invisible sobre el panel claro.
*/
.mtb-shell-drawer-nav a.mtb-shell-nav-item {
    display: block;
    box-sizing: border-box;
    text-align: center;
    padding: 14px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 700;
    border: none !important;
    background: var(--mtb-shell-slate) !important;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(43, 91, 132, 0.28);
}

.mtb-shell-drawer-nav a.mtb-shell-nav-item:hover {
    filter: brightness(1.07);
}

.mtb-shell-drawer-nav a.mtb-shell-nav-item:active {
    transform: scale(0.98);
}

.mtb-shell-drawer-nav a.mtb-shell-nav-item.is-active {
    color: #fff !important;
    background: var(--mtb-shell-slate) !important;
    border: none !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #ea580c, 0 4px 14px rgba(43, 91, 132, 0.35);
}

.mtb-shell-drawer-nav a.mtb-shell-drawer-cta {
    background: #ea580c !important;
}

.mtb-shell-drawer-nav button.mtb-shell-drawer-logout {
    display: block;
    box-sizing: border-box;
    width: 100%;
    text-align: center;
    padding: 14px 14px;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    color: #991b1b !important;
    background: #fff !important;
    border: 2px solid #fecaca !important;
    box-shadow: none !important;
    font-weight: 700 !important;
}

.mtb-shell-drawer-nav button.mtb-shell-drawer-logout:active {
    transform: scale(0.98);
}

.mtb-shell-drawer-footer {
    flex-shrink: 0;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e2eaf0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
    display: flex;
    gap: 12px;
    align-items: center;
}

.mtb-shell-drawer-footer-logo {
    flex-shrink: 0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(43, 91, 132, 0.15);
}

.mtb-shell-drawer-footer-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mtb-shell-drawer-footer-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--mtb-shell-slate);
}

.mtb-shell-drawer-footer-tag {
    font-size: 0.78rem;
    color: #5c7a90;
    line-height: 1.3;
}

.mtb-shell-drawer-version {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 4px;
    word-break: break-word;
}

/* Bottom nav solo si body tiene .mtb-shell-pad-bottom (legacy) */
.mtb-shell-bottom {
    display: none !important;
}

@media (max-width: 899px) {
    .mtb-shell-burger {
        display: inline-flex;
    }

    .mtb-shell-nav-desktop {
        display: none !important;
    }

    body.mtb-shell-pad-bottom .mtb-shell-bottom {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: #fff;
        border-top: 1px solid #e2eaf0;
        padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0));
        justify-content: space-around;
        align-items: stretch;
        gap: 4px;
        box-shadow: 0 -2px 12px rgba(15, 41, 66, 0.06);
    }

    body.mtb-shell-pad-bottom.mtb-has-shell {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
    }

    body.mtb-shell-pad-bottom .mtb-shell-bottom a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px;
        text-decoration: none;
        color: var(--mtb-shell-slate);
        font-size: 0.72rem;
        font-weight: 600;
        border-radius: 10px;
        min-width: 0;
    }

    body.mtb-shell-pad-bottom .mtb-shell-bottom a.is-active {
        background: rgba(43, 91, 132, 0.12);
        color: var(--mtb-shell-slate);
    }

    .mtb-sb-ico {
        font-size: 1.25rem;
        line-height: 1;
    }
}

@media (min-width: 900px) {
    .mtb-shell-drawer {
        display: none !important;
    }
}

.hidden {
    display: none !important;
}

.mtb-has-shell #mtb-shell-mount + #appShell {
    padding-top: var(--mtb-shell-top-pad);
}

.mtb-has-shell #mtb-page-body {
    padding-top: var(--mtb-shell-top-pad);
}
