/* Floating Bell Button Styles */
.pwa-bell-btn {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ffffff;
    border: 3.5px solid #7c3aed;
    color: #7c3aed;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3), 0 0 15px rgba(124, 58, 237, 0.2);
    z-index: 999998;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-bell-btn:hover {
    transform: scale(1.15) rotate(15deg);
    background: #ffffff;
    border-color: #6d28d9;
    color: #6d28d9;
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.45), 0 0 20px rgba(124, 58, 237, 0.3);
}

.pwa-bell-btn i, .pwa-bell-btn svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}

/* Red dot indicator if action needed */
.pwa-bell-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f43f5e;
    border: 2px solid #0b0c16;
    animation: pwa-pulse 2s infinite;
}

@keyframes pwa-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* ── Vibrant page: bigger bell, lower position ── */
body.page-vibrant .pwa-bell-btn {
    width: 74px;
    height: 74px;
    bottom: 60px;
    right: 15px;
    border-width: 4px;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.45), 0 0 0 6px rgba(255,255,255,0.9);
    z-index: 999999;
}
body.page-vibrant .pwa-bell-btn i,
body.page-vibrant .pwa-bell-btn svg {
    width: 28px;
    height: 28px;
    font-size: 28px;
}


/* Modal Overlay */
.pwa-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 12, 22, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pwa-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Modal Card */
.pwa-modal {
    background: linear-gradient(135deg, #ffffff 0%, #f6f3ff 100%);
    border: 2px solid rgba(124, 58, 237, 0.35);
    border-radius: 24px;
    width: min(380px, 90%);
    padding: 24px;
    box-shadow: 0 20px 40px rgba(124, 58, 237, 0.18), 0 0 25px rgba(124, 58, 237, 0.12);
    transform: scale(0.9) translateY(30px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    color: #1e1b4b;
    font-family: 'Outfit', sans-serif;
}

.pwa-overlay.active .pwa-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Header */
.pwa-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pwa-title {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pwa-close-btn {
    background: none;
    border: none;
    color: #7c3aed;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s;
}

.pwa-close-btn:hover {
    color: #6d28d9;
}

/* Option Row inside Modal */
.pwa-opt-row {
    background: rgba(124, 58, 237, 0.04);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: background 0.2s;
}

.pwa-opt-row:hover {
    background: rgba(124, 58, 237, 0.08);
}

.pwa-opt-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pwa-opt-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e1b4b;
}

.pwa-opt-desc {
    font-size: 11px;
    color: #4b5563;
    line-height: 1.4;
}

.pwa-btn {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.pwa-btn-primary {
    background: #7c3aed;
    color: #fff;
}

.pwa-btn-primary:hover {
    background: #6d28d9;
    box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

.pwa-btn-success {
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    color: #34d399;
    cursor: default;
}

.pwa-btn-secondary {
    background: rgba(124, 58, 237, 0.06);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.pwa-btn-secondary:hover {
    background: rgba(124, 58, 237, 0.12);
}

/* Hide original local bottom navigation bars */
.bottom-nav, #bottomNav, .local-bottom-bar {
    display: none !important;
}

/* Safe padding-bottom for body to prevent footer overlapping */
body {
    padding-bottom: 75px !important;
}

/* Universal Bottom Taskbar */
.pwa-bottom-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(480px, 92%);
    height: 65px;
    background: rgba(var(--bg-glass-rgb, 11, 12, 22), 0.75) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(var(--border-glass-rgb, 124, 58, 237), 0.25) !important;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    gap: 5px;
    padding: 8px;
    min-width: 70px;
    transition: all 0.2s ease-in-out;
}

.pwa-nav-item i, .pwa-nav-item svg {
    font-size: 18px;
    transition: transform 0.2s;
}

.pwa-nav-item:hover {
    color: #c084fc;
}

.pwa-nav-item:hover i {
    transform: translateY(-2px);
}

.pwa-nav-item.active {
    color: #7c3aed;
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

/* Portal Switcher Grid */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 15px;
}

.portal-card {
    background: rgba(124, 58, 237, 0.04);
    border: 1.5px solid rgba(124, 58, 237, 0.15);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease-in-out;
}

.portal-card:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: #7c3aed;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.15);
}

.portal-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(124, 58, 237, 0.2);
}

.portal-card span {
    font-size: 13px;
    font-weight: 800;
    color: #1e1b4b;
    text-align: center;
}

/* Universal Top-Right Player Watch Time Badge */
.rxc-universal-watch-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Auto-hide badge when parent overlay is hidden or inactive */
.hidden .rxc-universal-watch-badge,
.v-container:not(:hover) .rxc-universal-watch-badge,
.player-container:not(:hover) .rxc-universal-watch-badge {
    opacity: 0;
    transform: translateY(-5px);
}

/* ==========================================================================
   MOBILE DESIGN SYSTEM & RESPONSIVE OPTIMIZATIONS (PW, NT, MJ)
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* 1. Global Touch & Container Spacing */
    body {
        padding-bottom: 75px !important;
        font-size: 14px !important;
    }

    /* 2. Universal Bottom Navigation Bar for Mobile */
    .pwa-nav-bar {
        height: 62px !important;
        padding: 0 8px !important;
        bottom: 8px !important;
        width: calc(100% - 24px) !important;
        left: 12px !important;
        border-radius: 30px !important;
        background: rgba(11, 15, 25, 0.92) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
    }

    .pwa-nav-item {
        padding: 6px 4px !important;
        font-size: 10px !important;
        gap: 3px !important;
    }

    .pwa-nav-item i, .pwa-nav-item svg {
        font-size: 17px !important;
        width: 17px !important;
        height: 17px !important;
    }

    /* 3. Universal Mobile Batch & Subject Card Grids */
    .grid, .batch-grid, .course-grid, .subjects-grid, .lectures-grid, .list-container {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 8px !important;
    }

    .card, .batch-card, .course-card, .lecture-card, .subject-card {
        padding: 14px 16px !important;
        border-radius: 16px !important;
    }

    .card h2, .batch-title, .course-title, .lecture-title {
        font-size: 15px !important;
        line-height: 1.35 !important;
    }

    /* 4. Leaderboard Top 3 Podium Grid Mobile Layout */
    .podium-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .podium-card {
        width: 100% !important;
        margin: 0 !important;
        padding: 14px 18px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-radius: 16px !important;
    }

    .podium-card.rank-1 {
        order: 1 !important;
        transform: none !important;
    }
    .podium-card.rank-2 { order: 2 !important; }
    .podium-card.rank-3 { order: 3 !important; }

    /* 5. Mobile Player Header & Top-Right Watch Badge */
    .rxc-universal-watch-badge {
        top: 10px !important;
        right: 10px !important;
        font-size: 10.5px !important;
        padding: 4px 9px !important;
    }

    /* Floating Bell Button Position on Mobile */
    .pwa-bell-btn {
        bottom: 80px !important;
        right: 14px !important;
        width: 50px !important;
        height: 50px !important;
    }
    .pwa-bell-btn i, .pwa-bell-btn svg {
        font-size: 18px !important;
        width: 18px !important;
        height: 18px !important;
    }
}

/* Hide local page settings container overrides removed */

