/* ==========================================
   MOBILE BOTTOM NAVIGATION
   ========================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    border-top: 1px solid #e5e7eb;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 0;
    text-decoration: none;
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
}

.bottom-nav-item i {
    font-size: 20px;
    transition: all 0.2s ease;
}

.bottom-nav-item > span:not(.bottom-nav-badge) {
    margin-top: 2px;
    font-weight: 600;
}

.bottom-nav-item.active {
    color: #cb0001;
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

/* Badge for cart count */
.bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(12px);
    background: linear-gradient(135deg, #cb0001 0%, #ff4444 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(203, 0, 1, 0.4);
}

/* Mobile body padding to prevent bottom nav overlap */
@media (max-width: 991px) {
    body {
        padding-bottom: 70px;
    }
    
    .main-footer {
        margin-bottom: 0;
    }
}

/* ==========================================
   MOBILE HEADER OPTIMIZATIONS
   ========================================== */

@media (max-width: 991px) {
    .header-wrapper {
        display: grid;
        grid-template-columns: 50px 1fr 50px;
        padding: 12px 0;
        gap: 0;
        align-items: center;
    }
    
    .header-logo {
        justify-self: center;
        grid-column: 2;
    }
    
    .header-logo img {
        height: 45px;
    }
    
    .mobile-menu-toggle {
        grid-column: 1;
        justify-self: start;
    }
    
    .mobile-search-btn {
        grid-column: 3;
        justify-self: end;
    }
    
    .mobile-menu-toggle,
    .mobile-search-btn {
        background: none;
        border: none;
        font-size: 22px;
        color: #2c3e50;
        padding: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: color 0.2s ease;
    }
    
    .mobile-menu-toggle:active,
    .mobile-search-btn:active {
        color: #cb0001;
    }
    
    
    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* ==========================================
   MOBILE SIDEBAR
   ========================================== */

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 80%;
    height: 100vh;
    background: #fff;
    z-index: 1100;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.mobile-sidebar.active {
    left: 0;
}

.mobile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #cb0001 0%, #ff4444 100%);
    color: #fff;
}

.mobile-sidebar-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.mobile-sidebar-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-sidebar-content {
    padding: 20px 0;
}

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

.mobile-sidebar-menu li {
    margin: 0;
}

.mobile-sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
}

.mobile-sidebar-menu a:hover {
    background: linear-gradient(135deg, rgba(203, 0, 1, 0.05) 0%, rgba(255, 68, 68, 0.05) 100%);
    color: #cb0001;
}

.mobile-sidebar-menu i {
    width: 20px;
    color: #cb0001;
    font-size: 18px;
}

.mobile-sidebar-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 15px 20px;
}

.mobile-user-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(203, 0, 1, 0.05) 0%, rgba(255, 68, 68, 0.05) 100%);
    margin: 0 15px 15px;
    border-radius: 12px;
}

.mobile-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #cb0001 0%, #ff4444 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mobile-user-avatar i {
    font-size: 28px;
    color: #fff;
}

.mobile-user-details {
    flex: 1;
}

.mobile-user-details strong {
    display: block;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.mobile-user-details small {
    display: block;
    color: #6b7280;
    font-size: 12px;
}

.mobile-logout-form {
    padding: 0 15px;
}

.mobile-logout-btn {
    width: 100%;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.mobile-logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    color: #fff;
    text-decoration: none;
}

.mobile-auth-buttons {
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-btn-login,
.mobile-btn-register {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-btn-login {
    background: #fff;
    color: #1f2937;
    border: 2px solid #e5e7eb;
}

.mobile-btn-login:hover {
    border-color: #cb0001;
    color: #cb0001;
}

.mobile-btn-register {
    background: linear-gradient(135deg, #cb0001 0%, #ff4444 100%);
    color: #fff;
}

.mobile-btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(203, 0, 1, 0.3);
}

/* Sidebar Overlay */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   MOBILE COURSE CARDS
   ========================================== */

@media (max-width: 767px) {
    .course-card {
        max-width: 100%;
    }
    
    .courses-page {
        padding: 0;
    }
    
    .page-header-section {
        padding: 30px 0;
    }
}

/* ==========================================
   MOBILE FILTER SIDEBAR
   ========================================== */

@media (max-width: 991px) {
    /* Hide desktop sidebar */
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        max-width: 85%;
        height: 100vh;
        background: #fff;
        z-index: 1100;
        transition: left 0.3s ease;
        overflow-y: auto;
        overflow-x: hidden;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        padding: 0;
    }
    
    .filters-sidebar.active {
        left: 0;
    }
    
    /* Filter sidebar header */
    .filter-sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        background: linear-gradient(135deg, #cb0001 0%, #ff4444 100%);
        color: #fff;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .filter-sidebar-header h3 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .filter-close-btn {
        background: none;
        border: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        padding: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Add padding to filter groups in mobile */
    .filters-sidebar .filter-group {
        padding: 20px;
    }
    
    .filters-sidebar .filter-group:first-of-type {
        padding-top: 0;
    }
    
    .filters-sidebar .btn-clear-filters {
        margin: 0 20px 20px;
    }
    
    /* Prevent body scroll when filter sidebar is open */
    body.filter-sidebar-open {
        overflow: hidden;
    }
}

/* Mobile Filter FAB Button */
.mobile-filter-fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #cb0001 0%, #ff4444 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(203, 0, 1, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 998;
    transition: all 0.3s ease;
}

.mobile-filter-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(203, 0, 1, 0.5);
}

.mobile-filter-fab:active {
    transform: scale(0.95);
}

/* Filter Sidebar Overlay */
.filter-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.filter-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   MOBILE RESPONSIVE SPACING
   ========================================== */

@media (max-width: 575px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Course detail page mobile */
    .course-hero {
        padding: 20px 0;
    }
    
    .purchase-card {
        position: relative;
        top: 0;
        margin-bottom: 20px;
    }
    
    /* Video player mobile */
    .video-watch-page {
        padding: 0;
    }
    
    .video-player-container {
        height: 250px;
    }
}

/* ==========================================
   SAFE AREA INSETS (iPhone X+)
   ========================================== */

@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}
