/* ===========================================================
   SOULFULSYNC — MOBILE DRAWER (estilo SocialV)
   Panel desde la izquierda + perfil + lista limpia
   =========================================================== */

@media (max-width: 1023px) {

    .ssx-mobile-menu-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        width: min(82vw, 340px);
        height: 100dvh;
        max-height: 100dvh;
        padding:
            calc(14px + env(safe-area-inset-top, 0px))
            16px
            calc(14px + env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-105%);
        transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
        box-sizing: border-box;
        z-index: 100000;
        background: #ffffff;
        border-right: 1px solid #E8E4F2;
        box-shadow: 12px 0 36px rgba(12, 10, 20, 0.18);
    }

    .ssx-mobile-menu-panel[hidden] {
        display: flex !important;
    }

    body.admin-bar .ssx-mobile-menu-panel {
        top: 0;
        height: 100dvh;
        max-height: 100dvh;
    }

    @media screen and (min-width: 783px) {
        body.admin-bar .ssx-mobile-menu-panel {
            top: 0;
            height: 100dvh;
            max-height: 100dvh;
        }
    }

    .ssx-mobile-menu-panel.active {
        transform: translateX(0);
    }

    html[data-theme="dark"] .ssx-mobile-menu-panel {
        background: #151222;
        border-right-color: #322E44;
        box-shadow: 12px 0 36px rgba(0, 0, 0, 0.45);
    }

    .sse-mobile-drawer__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 14px;
        position: relative;
    }

    .sse-mobile-drawer__brand {
        display: inline-flex;
        align-items: center;
        min-width: 0;
        text-decoration: none;
        color: inherit;
    }

    .sse-mobile-drawer__logo {
        max-height: 32px;
        width: auto;
        max-width: 160px;
        object-fit: contain;
    }

    .sse-mobile-drawer__brand-text {
        font-weight: 800;
        font-size: 1.1rem;
        letter-spacing: -0.03em;
        color: #6E5CE6;
    }

    .sse-mobile-close {
        position: absolute;
        top: 50%;
        right: -28px;
        transform: translateY(-50%);
        width: 36px;
        height: 40px;
        font-size: 22px;
        font-weight: 700;
        background: #fff;
        border: 1px solid #E4DFF2;
        border-left: 0;
        border-radius: 0 12px 12px 0;
        color: #4A4268;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        box-shadow: 4px 0 12px rgba(12, 10, 20, 0.08);
    }

    html[data-theme="dark"] .sse-mobile-close {
        background: #1C1929;
        border-color: #322E44;
        color: #F0ECFA;
    }

    .sse-mobile-drawer__profile {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        margin-bottom: 16px;
        border-radius: 16px;
        background: #F7F4FF;
        text-decoration: none;
        color: inherit;
    }

    html[data-theme="dark"] .sse-mobile-drawer__profile {
        background: rgba(155, 140, 255, 0.1);
    }

    .sse-mobile-drawer__profile--guest {
        justify-content: space-between;
    }

    .sse-mobile-drawer__avatar {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        overflow: hidden;
        display: block;
        background: #EDE8F8;
        align-self: center;
    }

    html[data-theme="dark"] .sse-mobile-drawer__avatar {
        background: #2A2640;
    }

    /* base.css usa img{height:auto} — hay que forzar el recorte circular */
    .sse-mobile-drawer__avatar img,
    .sse-mobile-drawer__avatar .avatar {
        width: 48px !important;
        height: 48px !important;
        max-width: none !important;
        max-height: none !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 50% !important;
        display: block !important;
        float: none !important;
        margin: 0 !important;
    }

    .sse-mobile-drawer__who {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    .sse-mobile-drawer__name {
        font-size: 0.98rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: #12131A;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    html[data-theme="dark"] .sse-mobile-drawer__name {
        color: #F0ECFA;
    }

    .sse-mobile-drawer__handle {
        font-size: 0.78rem;
        color: #6B6580;
    }

    html[data-theme="dark"] .sse-mobile-drawer__handle {
        color: #A39BB8;
    }

    .sse-mobile-drawer__section-label {
        margin: 0 0 10px;
        font-size: 0.68rem;
        font-weight: 800;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #8B849E;
    }

    .sse-mobile-nav {
        flex: 1 1 auto;
        min-height: 0;
    }

    .sse-mobile-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .sse-mobile-list li a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 12px 14px;
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        text-decoration: none;
        color: #2A2640;
        border-radius: 14px;
        border: 0;
        background: transparent;
        box-shadow: none;
        transition: background 0.18s ease, color 0.18s ease;
    }

    html[data-theme="dark"] .sse-mobile-list li a {
        color: #E8E2F5;
    }

    .sse-mobile-list li a:hover,
    .sse-mobile-list li a:active {
        background: rgba(110, 92, 230, 0.1);
        color: #5A4AD4;
        transform: none;
    }

    .sse-mobile-list li.current-menu-item > a,
    .sse-mobile-list li.current_page_item > a,
    .sse-mobile-list li.current-menu-ancestor > a,
    .sse-mobile-list a[aria-current="page"] {
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        background: #6E5CE6 !important;
        box-shadow: 0 8px 18px rgba(110, 92, 230, 0.28) !important;
    }

    .sse-mobile-drawer__foot {
        margin-top: auto;
        padding-top: 14px;
        border-top: 1px solid #EDE8F8;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow: visible;
        position: relative;
        z-index: 20;
    }

    html[data-theme="dark"] .sse-mobile-drawer__foot {
        border-top-color: #322E44;
    }

    /* Toggle Claro / Oscuro dentro del drawer */
    .sse-mobile-drawer__theme {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 14px;
        background: #F7F4FF;
        border: 1px solid #E4DFF2;
    }

    html[data-theme="dark"] .sse-mobile-drawer__theme {
        background: rgba(155, 140, 255, 0.1);
        border-color: #322E44;
    }

    .sse-mobile-drawer__theme-label {
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: #4A4268;
        flex-shrink: 0;
    }

    html[data-theme="dark"] .sse-mobile-drawer__theme-label {
        color: #D8D0EE;
    }

    .ssx-theme-toggle--drawer {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 210px;
        margin-left: auto;
    }

    .ssx-theme-toggle--drawer .ssx-theme-toggle__track {
        width: 100%;
        min-width: 0;
        height: 40px;
        padding: 3px;
    }

    .ssx-theme-toggle--drawer .ssx-theme-toggle__option {
        gap: 5px;
        font-size: 12px;
        padding: 0 6px;
    }

    .ssx-theme-toggle--drawer .ssx-theme-toggle__txt {
        display: inline !important;
    }

    .ssx-theme-toggle--drawer .ssx-theme-toggle__ico {
        font-size: 14px;
    }

    .sse-mobile-drawer__foot-icons {
        display: flex;
        align-items: center;
        justify-content: space-around;
        gap: 8px;
        overflow: visible;
        position: relative;
        z-index: 21;
    }

    .sse-mobile-drawer__foot-icons .ssx-mobile-icon-btn,
    .sse-mobile-drawer__lang .ss-lang-btn {
        width: 42px;
        height: 42px;
        padding: 0;
        color: #6B6580;
        border-radius: 12px;
        overflow: hidden;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    html[data-theme="dark"] .sse-mobile-drawer__foot-icons .ssx-mobile-icon-btn,
    html[data-theme="dark"] .sse-mobile-drawer__lang .ss-lang-btn {
        color: #A39BB8;
    }

    /* MentorSync: llena el chip y se recorta en círculo (el PNG es cuadrado). */
    .sse-mobile-drawer__mentor {
        padding: 0 !important;
        background: transparent !important;
        border-color: transparent !important;
    }

    .sse-mobile-drawer__mentor img {
        width: 42px !important;
        height: 42px !important;
        max-width: none !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 50% !important;
        display: block !important;
        float: none !important;
        margin: 0 !important;
    }

    .sse-mobile-drawer__lang .ss-lang-btn .ss-lang-flag {
        width: 22px;
        height: 22px;
        border-radius: 50%;
        object-fit: cover;
        box-shadow: none;
    }

    html[data-theme="light"] .ssx-mobile-menu-panel {
        background: #FCFAFF;
        border-right-color: #E4DFF2;
    }

    html[data-theme="light"] .sse-mobile-list li a {
        color: #12131A;
    }

    html[data-theme="light"] .sse-mobile-close {
        background: #fff;
        border-color: #E4DFF2;
        color: #4A4268;
    }

    .sse-mobile-drawer__lang {
        position: relative;
        z-index: 30;
        overflow: visible;
    }

    .sse-mobile-drawer__lang .ss-lang-btn {
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
        border-radius: 12px;
        gap: 0;
    }

    .sse-mobile-drawer__lang .ss-lang-code,
    .sse-mobile-drawer__lang .ss-lang-arrow {
        display: none;
    }

    /* Abre hacia arriba e izquierda para no salirse del drawer (overflow-x: hidden). */
    .sse-mobile-drawer__lang .ss-lang--header .ss-lang-dropdown {
        top: auto;
        bottom: calc(100% + 8px);
        left: auto;
        right: 0;
        min-width: 200px;
        width: max-content;
        max-width: min(240px, calc(100vw - 48px));
        z-index: 40;
    }

    .sse-mobile-drawer__lang .ss-lang-dropdown a {
        white-space: nowrap;
    }

    #sse-mobile-overlay {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100dvh;
        background: rgba(12, 10, 20, 0.55);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 99999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    #sse-mobile-overlay.active,
    body.ssx-mobile-open #sse-mobile-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    @media (min-width: 1024px) {
        .ssx-mobile-menu-panel,
        #sse-mobile-overlay {
            display: none !important;
        }
    }
}
