/* css/responsive.css */

/* --- Mobile Navigation Variables --- */
:root {
    --header-height: 80px;
    --mobile-nav-bg: var(--bg-surface);
}

/* --- Global Responsive Resets --- */
/* Prevent horizontal overflow on mobile */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Make images responsive by default */
img {
    max-width: 100%;
    height: auto;
}

/* --- Header & Navigation (Mobile) --- */
@media (max-width: 991px) {

    /* Reset body padding (Header is relative now) */
    body {
        padding-top: 0;
    }

    .main-header {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        background: var(--bg-surface);
        position: relative;
        /* Not Sticky on Mobile */
        top: 0;
        left: 0;
        transform: none;
        z-index: 1001;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-container {
        padding: 15px 20px;
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Hide Logo when menu is active */
    .mobile-menu-active .logo {
        display: none !important;
    }

    /* Absolute Position for Close Button (Top Right) */
    .mobile-menu-active .nav-toggle {
        position: absolute !important;
        top: 20px;
        right: 20px;
        z-index: 1005;
        /* Above everything */
        background: rgba(255, 255, 255, 0.05) !important;
        /* Subtle background */
        border-radius: 50%;
        width: 44px !important;
        /* Touch target */
        height: 44px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .logo img {
        height: 40px !important;
    }

    /* Hide standard nav and actions on mobile initially */
    .main-nav,
    .header-actions {
        display: none;
    }

    /* Hamburger Menu Button */
    .nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        color: var(--text-main);
        background: none;
        border: none;
        cursor: pointer;
        padding: 5px;
        /* Minimal padding */
        z-index: 1002;
    }

    .hamburger-box {
        width: 30px;
        height: 24px;
        display: inline-block;
        position: relative;
    }

    .hamburger-inner {
        width: 100%;
        height: 3px;
        background-color: var(--text-main);
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        transition: background-color 0s 0.2s;
        border-radius: 2px;
    }

    .hamburger-inner::before,
    .hamburger-inner::after {
        content: '';
        width: 100%;
        height: 3px;
        background-color: var(--text-main);
        position: absolute;
        left: 0;
        transition: transform 0.2s ease, top 0.2s 0.2s;
        border-radius: 2px;
    }

    .hamburger-inner::before {
        top: -10px;
    }

    .hamburger-inner::after {
        top: 10px;
    }

    /* Active Animation */
    .mobile-menu-active .hamburger-inner {
        background-color: transparent !important;
    }

    .mobile-menu-active .hamburger-inner::before {
        top: 0;
        transform: rotate(45deg);
        transition: top 0.2s, transform 0.2s 0.2s;
    }

    .mobile-menu-active .hamburger-inner::after {
        top: 0;
        transform: rotate(-45deg);
        transition: top 0.2s, transform 0.2s 0.2s;
    }

    /* Mobile Menu Drawer */
    .mobile-menu-active .main-nav {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-surface);
        padding: 30px 20px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
        border-bottom: 1px solid var(--glass-border);
        z-index: 999;
        animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .mobile-menu-active .main-nav ul {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        width: 100%;
    }

    .mobile-menu-active .main-nav a {
        display: block;
        padding: 15px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 15px;
        font-size: 1.1rem;
        border: 1px solid transparent;
        transition: all 0.2s;
    }

    .mobile-menu-active .main-nav a:active {
        background: rgba(255, 140, 66, 0.1);
        border-color: var(--accent-orange);
        transform: scale(0.98);
    }

    /* Mobile User Profile Section */
    .mobile-menu-active .header-actions {
        display: flex !important;
        flex-direction: column;
        gap: 20px;
        padding: 30px 20px;
        background: linear-gradient(180deg, var(--bg-surface), #1a120b);
        border-top: 1px solid var(--glass-border);
        width: 100%;
        align-items: center;
        /* Push below nav roughly (dynamic JS would be better but CSS stacking words if parent is relative) */
        /* Actually simpler: just let it flow if main-nav and header-actions were siblings in the same container, but they are siblings in header. 
           In header.php, .main-nav comes before .header-actions.
           So we need to position .header-actions correctly relative to the opened menu.
        */
        position: static;
        /* Let it flow */
    }

    /* We need to ensure .nav-container allows wrapping or column flex on mobile when active? 
       Actually header.php structure: .nav-container > logo, toggle, nav, actions.
       If we want a drawer, usually we toggle a class on a wrapper. 
       Currently main.js toggles 'mobile-menu-active' on body or header? 
       Let's check main.js next. Assuming it works, let's style the contents.
    */

    /* Mobile User Widget Styling */
    .mobile-menu-active .user-controls {
        flex-direction: column;
        width: 100%;
        gap: 20px;
    }

    .mobile-menu-active .user-profile-widget {
        flex-direction: column !important;
        /* Stack avatar and text */
        margin-right: 0 !important;
        text-align: center;
        padding: 20px;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 20px;
        width: 100%;
        border: 1px solid var(--glass-border);
    }

    .mobile-menu-active .avatar-circle {
        width: 80px !important;
        height: 80px !important;
        font-size: 2.5rem !important;
        box-shadow: 0 0 20px rgba(255, 140, 66, 0.3);
        margin-bottom: 10px;
    }

    .mobile-menu-active .user-info-text {
        align-items: center !important;
    }

    .mobile-menu-active .user-info-text span:first-child {
        font-size: 1.5rem !important;
        margin-bottom: 5px;
    }

    .mobile-menu-active .user-info-text span:last-child {
        font-size: 1rem !important;
        opacity: 0.7;
    }

    /* Mobile Buttons */
    .mobile-menu-active .btn {
        width: 100%;
        justify-content: center;
        padding: 15px !important;
        font-size: 1.1rem !important;
    }

    /* Ensure the mobile menu is part of the flow when active, or overlaid */
    /* Since we're injecting into existing structure, we accept the structure */
    .mobile-menu-container {
        position: absolute;
        top: 70px;
        /* Below header */
        left: 0;
        right: 0;
        background: var(--bg-surface);
        display: none;
        flex-direction: column;
        padding: 20px;
        border-top: 1px solid var(--glass-border);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    .mobile-menu-open {
        display: flex !important;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure hamburger is hidden on desktop */
.nav-toggle {
    display: none;
}

/* --- General Utilities --- */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    h1 {
        font-size: 2.2rem !important;
    }

    h2 {
        font-size: 1.8rem !important;
    }

    h3 {
        font-size: 1.5rem !important;
    }

    .hero-title {
        font-size: 2.5rem !important;
    }

    .section-title {
        font-size: 2rem !important;
        margin-bottom: 2rem !important;
    }

    /* Stack flex containers that are rows on desktop */
    .hero-wrapper,
    .footer-grid,
    .course-layout-grid {
        flex-direction: column !important;
        gap: 30px !important;
    }

    /* Course Page Specifics */
    .course-layout-grid {
        grid-template-columns: 1fr !important;
    }

    .video-wrapper {
        padding-bottom: 56.25%;
        /* Maintain aspect ratio */
    }

    /* Buttons */
    .btn,
    .btn-primary {
        width: 100%;
        /* Full width buttons often look better on mobile */
        max-width: 300px;
        margin: 0 auto;
        display: block !important;
        /* Override potential flex/inline-block */
        text-align: center;
        margin-bottom: 10px;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 20px !important;
    }
}

/* --- Classroom Sidebar Toggle --- */
@media (max-width: 991px) {
    .classroom-container {
        position: relative;
    }

    .classroom-sidebar {
        position: fixed;
        left: -320px;
        top: 70px;
        /* Below header */
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        height: calc(100vh - 70px);
    }

    .classroom-sidebar.active {
        left: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    #classroomSidebarToggle {
        display: block !important;
    }

    /* --- Brand Marquee --- */
    .marquee-content {
        animation: scroll 20s linear infinite;
    }

    .brand-logo {
        flex-shrink: 0;
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--text-main);
    }

    /* --- Career Paths Page --- */
    .path-card {
        padding: 20px !important;
        /* Reduce padding on mobile */
    }

    .path-header {
        flex-direction: column !important;
        text-align: center;
        gap: 15px !important;
    }

    .path-icon {
        margin: 0 auto;
    }

    .path-header>div:last-child {
        text-align: center !important;
        margin-left: 0 !important;
        margin-top: 10px;
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        /* Subtle separator */
        padding-top: 15px;
        display: flex;
        justify-content: space-around;
    }

    .path-steps {
        flex-direction: column !important;
        gap: 0 !important;
        border-left: 2px solid var(--glass-border);
        padding-left: 20px !important;
        margin-top: 30px;
    }

    .step-line {
        display: none !important;
    }

    .step-item {
        text-align: left;
        margin-bottom: 30px;
        display: flex;
        gap: 20px;
        padding: 0 !important;
    }

    .step-num {
        margin-bottom: 0 !important;
        min-width: 40px;
        /* Position relative to the line on the left */
        position: relative;
        right: 41px;
        /* Pull left to cover the border line */
    }

    .step-content {
        padding-top: 5px;
        /* Align with circle */
        margin-left: -30px;
        /* Pull back */
    }

    /* --- Bundle Registration Page --- */
    .bundle-card {
        padding: 30px 20px !important;
        /* Compact padding */
    }

    .bundle-icon {
        font-size: 3rem !important;
        /* Smaller icon */
        margin-bottom: 15px !important;
    }

    .bundle-title {
        font-size: 1.8rem !important;
        /* Smaller title */
        margin-bottom: 15px !important;
    }

    .bundle-name {
        font-size: 1.2rem !important;
    }

    .bundle-price {
        font-size: 2rem !important;
        margin-bottom: 20px !important;
    }

    .bundle-actions .btn {
        width: 100%;
        /* Stack buttons on mobile */
        margin-bottom: 10px;
    }
}

.footer-col {
    text-align: center;
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* --- Mobile Category Filters & Hero Fixes (Wrapped in Media Query) --- */
@media (max-width: 991px) {

    /* Filters */
    .mobile-scroll-wrapper {
        position: relative;
        margin: 0 -20px 30px !important;
        width: calc(100% + 40px) !important;
    }

    .filter-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 15px !important;
        padding: 5px 20px 15px !important;
        margin: 0 !important;
        width: 100% !important;
        justify-content: flex-start !important;
        scrollbar-width: none;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }

    .scroll-cue-overlay {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 60px;
        background: linear-gradient(to right, transparent, var(--bg-main));
        pointer-events: none;
        z-index: 5;
    }

    .filter-container::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
        border-radius: 50px !important;
        background: var(--bg-surface) !important;
        border: 1px solid var(--glass-border) !important;
        scroll-snap-align: start;
    }

    .filter-btn.active {
        background: var(--accent-orange) !important;
        color: white !important;
        border-color: var(--accent-orange) !important;
        box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4);
    }

    /* Hero Fix */
    .hero-section {
        padding-top: 40px !important;
    }

    .hero-wrapper {
        flex-direction: column-reverse !important;
        gap: 40px !important;
        padding-top: 10px !important;
    }

    .image-stack {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        position: relative;
        margin-top: 20px;
    }

    .image-stack img {
        position: relative;
        z-index: 1;
        order: 2;
        max-width: 90% !important;
        transform: none !important;
        margin: 0 !important;
    }

    .image-stack .glass-panel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 90% !important;
        max-width: 320px;
        margin: 0 !important;
        z-index: 2;
    }

    .image-stack .glass-panel:nth-child(2) {
        order: 1;
    }

    .image-stack .glass-panel:nth-child(3) {
        order: 3;
    }

    .hero-stats {
        flex-direction: column !important;
        gap: 30px !important;
        align-items: center;
    }

    .hero-stats>div {
        width: 100%;
        text-align: center;
    }

    /* --- Footer Fixes for Mobile --- */
    .footer-grid {
        grid-template-columns: 1fr !important;
        /* Stack vertically */
        gap: 40px !important;
        text-align: center;
    }

    /* Reset footer items to center on mobile */
    .footer-col {
        align-items: center;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }

    .brand-col {
        align-items: center !important;
        text-align: center !important;
    }

    /* Reset logo size for mobile to avoid being too huge */
    .logo img {
        height: 40px !important;
    }

    .footer-logo img {
        height: 50px !important;
    }

    /* Force Hamburger Visibility (Reverted Style) */
    .nav-toggle {
        display: block !important;
        /* Reverted from flex */
        font-size: 1.5rem;
        color: var(--text-main);
        background: none;
        border: none;
        cursor: pointer;
        padding: 5px;
        /* Reverted padding */
        z-index: 1002;
        width: auto;
        /* Reset width */
        height: auto;
        /* Reset height */
    }

    .hamburger-box {
        width: 30px;
        height: 24px;
        display: inline-block;
        position: relative;
    }

    .hamburger-inner,
    .hamburger-inner::before,
    .hamburger-inner::after {
        background-color: var(--text-main) !important;
        /* Reverted color to variable */
        height: 3px;
    }
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* --- Mobile Menu Fixes (Appended) --- */
@media (max-width: 991px) {

    /* 1. Reveal Dashboard Text in Mobile Menu */
    .mobile-menu-active .hide-on-mobile {
        display: inline !important;
    }

    /* 2. Stack Header Actions & User Controls */
    .nav-container.mobile-menu-active .header-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
        margin-bottom: 20px;
    }

    .nav-container.mobile-menu-active .user-controls {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }

    .nav-container.mobile-menu-active .btn {
        width: 100%;
        justify-content: center;
        height: 50px !important;
        /* Larger touch target */
    }

    /* 3. Transform Profile Dropdown to Static List */
    .nav-container.mobile-menu-active .profile-dropdown {
        width: 100%;
        padding-bottom: 0 !important;
        /* Remove gap fix */
        margin-bottom: 0 !important;
    }

    /* Hide the dropdown toggle button */
    .nav-container.mobile-menu-active .profile-dropdown>button {
        display: none !important;
    }

    /* Show the content permanently */
    .nav-container.mobile-menu-active .profile-dropdown .dropdown-content {
        display: flex !important;
        flex-direction: column;
        /* Stack items */
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
        gap: 10px;
        margin-top: 0 !important;
        animation: none !important;
    }

    /* Style the links to look like main buttons */
    .nav-container.mobile-menu-active .profile-dropdown .dropdown-content a {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        padding: 15px;
        text-align: center;
        justify-content: center;
        color: var(--text-main);
        font-size: 1.1rem;
    }

    .nav-container.mobile-menu-active .profile-dropdown .dropdown-content a:hover {
        background: var(--accent-orange);
        color: white;
        border-color: var(--accent-orange);
    }
}