/* =============================================
   AapkaLove — Mobile Navigation Shell
   Applies ONLY at ≤768px.
   Desktop sidebar is completely untouched.
   ============================================= */

/* ── CSS Variables ── */
:root {
    --mob-header-h: 60px;
    --mob-nav-h: 52px;
    --mob-accent: #E0217A;
    --mob-bg: #ffffff;
    --mob-border: rgba(0, 0, 0, 0.07);
    --mob-text: #1a1a2e;
    --mob-muted: #888;
    --mob-radius: 12px;
    --mob-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    --mob-z-header: 9000;
    --mob-z-nav: 8900;
    --mob-z-menu: 9100;
    --mob-z-overlay: 9050;
}

/* ── Hide everything mobile on desktop ── */
.al-mob-header,
.al-mob-nav-wrap,
.al-mob-avatar-menu,
.al-mob-nav-drawer,
.al-mob-overlay {
    display: none;
}

/* ════════════════════════════════════════════
   MOBILE BREAKPOINT
   ════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Override body/html locked-scroll from sidebar CSS ── */
    html, body {
        height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* ── Fix SaaS layout for mobile ── */
    .al-saas-layout {
        flex-direction: column !important;
        height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 0 !important;
        gap: 0 !important;
        /* push content below header */
        padding-top: var(--mob-header-h) !important;
        padding-bottom: 70px !important;
    }

    /* ── Hide the desktop sidebar & header ── */
    .al-sidebar,
    .al-header-premium,
    .al-mobile-menu {
        display: none !important;
    }

    /* ── Main content reset ── */
    .al-main-content {
        margin-left: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow-y: visible !important;
        padding: calc(var(--mob-header-h) + 16px) 16px calc(var(--mob-nav-h) + 24px) 16px !important;
    }

    /* ════════
       MOBILE HEADER
       ════════ */
    .al-mob-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--mob-header-h);
        background: var(--mob-bg);
        border-bottom: 1px solid var(--mob-border);
        box-shadow: var(--mob-shadow);
        z-index: var(--mob-z-header);
        padding: 0 16px;
    }

    /* Brand / Logo */
    .al-mob-brand {
        font-family: var(--al-font-display, 'Inter', sans-serif);
        font-size: 22px;
        font-weight: 800;
        color: var(--mob-text);
        text-decoration: none;
        letter-spacing: -0.02em;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .al-mob-brand-accent { color: var(--mob-accent); }
    .al-mob-brand-dot {
        color: var(--mob-accent);
        font-size: 10px;
        margin-left: 3px;
        vertical-align: middle;
    }

    /* Avatar button */
    .al-mob-avatar-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        position: relative;
        flex-shrink: 0;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        overflow: visible;
    }
    .al-mob-avatar-btn img,
    .al-mob-avatar-btn svg {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--mob-border);
        display: block;
    }

    /* Header Right Container */
    .al-mob-header-right {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* Hamburger button */
    .al-mob-hamburger-btn {
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        margin: 0;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        border-radius: 8px;
        color: var(--mob-text);
        transition: background-color 0.2s ease, color 0.2s ease;
        touch-action: manipulation;
    }
    .al-mob-hamburger-btn * {
        pointer-events: none;
    }
    .al-mob-hamburger-btn:active {
        background-color: rgba(0,0,0,0.05);
    }
    
    .al-hamburger-icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .al-hamburger-icon svg {
        width: 20px;
        height: 20px;
        stroke-width: 2px;
        transition: transform 0.15s ease;
    }

    /* ── Hamburger Drawer ── */
    .al-mob-nav-drawer {
        position: fixed;
        top: calc(var(--mob-header-h) + 8px);
        right: 16px;
        width: 240px;
        background: #ffffff;
        border: 1px solid var(--mob-border);
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.08);
        z-index: var(--mob-z-menu);
        
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    }

    .al-mob-nav-drawer.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .al-mob-nav-drawer-links {
        display: flex;
        flex-direction: column;
        padding: 8px;
    }
    
    .al-mob-drawer-link {
        display: block;
        padding: 12px 16px;
        color: #2D3748;
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        border-radius: 8px;
        transition: background-color 0.2s ease, color 0.2s ease;
    }
    
    .al-mob-drawer-link:active {
        background-color: rgba(0,0,0,0.04);
    }
    
    .al-mob-drawer-link.active {
        color: var(--mob-accent);
        background-color: rgba(224, 33, 122, 0.05);
    }
    
    .al-mob-drawer-link.logout {
        color: #E53E3E;
        margin-top: 4px;
        border-top: 1px solid var(--mob-border);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    /* ════════
       BOTTOM NAV STRIP WRAPPER
       ════════ */
    .al-mob-nav-wrap {
        display: block;
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        z-index: var(--mob-z-nav);
        background: var(--mob-bg);
        border-top: 1px solid var(--mob-border);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* ── Bottom nav ── */
    .al-mob-nav-strip {
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 0;
        height: 64px;
    }

    /* ── Each nav item ── */
    .al-mob-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--mob-muted);
        font-size: 10px;
        font-weight: 500;
        text-decoration: none !important;
        flex: 1;
        height: 100%;
        transition: color 0.15s ease;
        font-family: var(--al-font-sans, 'Inter', sans-serif);
    }
    .al-mob-nav-item svg {
        width: 22px;
        height: 22px;
        margin-bottom: 4px;
        flex-shrink: 0;
        stroke: currentColor;
    }
    .al-mob-nav-item:hover,
    .al-mob-nav-item.active {
        color: var(--mob-accent);
        background: transparent;
        text-decoration: none !important;
    }
    .al-mob-nav-item.active {
        font-weight: 600;
    }
    .al-mob-nav-item.create-btn svg {
        background: var(--mob-accent);
        color: #fff;
        border-radius: 50%;
        padding: 4px;
        width: 28px !important;
        height: 28px !important;
        margin-bottom: 2px;
        border: none;
    }

    /* Notification badge inside nav item */
    .al-mob-notif-badge {
        position: absolute;
        top: 4px;
        right: calc(50% - 14px);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--mob-accent);
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        line-height: 1;
        border: 1px solid var(--mob-bg);
    }
    .al-mob-nav-item {
        position: relative; /* for badge positioning */
    }

    /* ════════
       AVATAR DROPDOWN MENU
       ════════ */
    .al-mob-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: var(--mob-z-overlay);
        background: transparent;
        opacity: 0;
        pointer-events: none;
    }
    .al-mob-overlay.open {
        pointer-events: all;
        opacity: 1;
    }

    .al-mob-avatar-menu {
        display: block;
        position: fixed;
        top: calc(var(--mob-header-h) + 6px);
        right: 12px;
        width: 220px;
        background: var(--mob-bg);
        border: 1px solid var(--mob-border);
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.12);
        z-index: var(--mob-z-menu);
        overflow: hidden;
        /* Hidden by default */
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
        pointer-events: none;
        transition: opacity 0.15s ease, transform 0.15s ease;
    }
    .al-mob-avatar-menu.open {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: all;
    }

    .al-mob-menu-profile {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 16px;
        border-bottom: 1px solid var(--mob-border);
    }
    .al-mob-menu-profile img,
    .al-mob-menu-profile svg {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
        border: 1.5px solid var(--mob-border);
    }
    .al-mob-menu-name {
        font-weight: 700;
        font-size: 14px;
        color: var(--mob-text);
        line-height: 1.2;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
    }
    .al-mob-menu-handle {
        font-size: 12px;
        color: var(--mob-muted);
        margin: 0;
    }

    .al-mob-menu-links {
        padding: 6px;
    }
    .al-mob-menu-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 10px;
        color: var(--mob-text);
        font-size: 14px;
        font-weight: 500;
        text-decoration: none !important;
        transition: background 0.12s ease;
    }
    .al-mob-menu-link svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        stroke: currentColor;
        color: var(--mob-muted);
    }
    .al-mob-menu-link:hover {
        background: rgba(0,0,0,0.04);
        text-decoration: none !important;
    }
    .al-mob-menu-divider {
        height: 1px;
        background: var(--mob-border);
        margin: 4px 6px;
    }
    .al-mob-menu-link.logout {
        color: var(--mob-muted);
    }

    /* ════════
       VERY SMALL PHONES ≤480px
       ════════ */
    @media (max-width: 480px) {
        .al-mob-brand { font-size: 19px; }
        .al-mob-nav-item {
            padding: 7px 11px;
            font-size: 12px;
        }
        .al-mob-nav-item svg { width: 15px; height: 15px; }
    }

} /* end @media ≤768px */
