/* ==========================================================================
   EOXON GLOBAL RESPONSIVE ENGINE
   Comprehensive responsiveness for Mobile, Tablet, Laptop, and Desktop
   ========================================================================== */

/* 1. Global Box-Sizing & Media Safeguards */
*, *::before, *::after {
    box-sizing: border-box;
}

img, video, iframe, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Ensure smooth scrolling & responsive containers */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0;
    padding: 0;
}

/* Force User Name to ALWAYS be visible in header profile dropdown on all screens including mobile */
.user-name-text,
.twm-login-user-menu .user-name,
.dashboard-user-section .user-name,
.listing-user .user-name {
    font-size: 13px !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #111827 !important;
    font-weight: 600 !important;
}

/* 2. Responsive Table Wrappers */
.table-responsive,
.twm-D_table {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.table-responsive table,
.twm-D_table table {
    width: 100%;
    min-width: 600px;
}

/* 3. General Dashboard & Sidebars Responsiveness */
#page-content-wrapper,
.twm-right-section-panel,
.wt-admin-right-page-header {
    width: 100% !important;
    max-width: 100% !important;
    transition: all 0.3s ease;
}

/* Flexbox / Grid Utilities for Dynamic Wrapping */
.d-flex.flex-wrap-mobile {
    flex-wrap: wrap !important;
}

/* ==========================================================================
   MOBILE & TABLET DASHBOARD LAYOUT & OVERFLOW FIX (max-width: 991.98px)
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Top offset to prevent sticky top navbar (60px) from covering header without extra gap */
    #content,
    .site-bg-gray {
        padding-top: 70px !important;
    }

    .content-admin-main,
    .twm-right-section-panel {
        padding-top: 0 !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-bottom: 20px !important;
    }

    /* Prevent sidebar from crushing page content width on mobile */
    #content,
    #content.active,
    #content.active .content-admin-main,
    #header-admin,
    #header-admin.active,
    .content-admin-main,
    .twm-right-section-panel,
    .wt-admin-right-page-header,
    .site-bg-gray {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin-left: 0 !important;
        box-sizing: border-box !important;
    }

    /* Fixed overlay sidebar for mobile */
    #sidebar-admin-wraper,
    #sidebar-admin-wraper-new {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        z-index: 99999 !important;
        transform: translateX(-100%) !important;
        margin-left: 0 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
    }

    #sidebar-admin-wraper.active,
    #sidebar-admin-wraper-new.active {
        transform: translateX(0) !important;
        margin-left: 0 !important;
        box-shadow: 4px 0 28px rgba(0, 0, 0, 0.25) !important;
    }

    /* Top Navigation Bar Header Container */
    #header-admin,
    #header-admin.active {
        height: 60px !important;
        display: flex !important;
        align-items: center !important;
        background: #ffffff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
        overflow: visible !important;
    }

    #header-admin .container,
    #header-admin.active .container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 0 10px !important;
        margin: 0 !important;
        height: 100% !important;
        overflow: visible !important;
    }

    .header-left {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        float: none !important;
    }

    .header-left .nav-btn-wrap {
        display: flex !important;
        align-items: center !important;
    }

    .header-left .nav-btn-admin {
        line-height: normal !important;
        font-size: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 34px !important;
        height: 34px !important;
        color: #1e293b !important;
    }

    .header-left .btn-back-to-home {
        padding: 6px 8px !important;
        font-size: 13px !important;
        gap: 4px !important;
        border-radius: 50% !important;
        width: 34px !important;
        height: 34px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    .header-left .btn-back-to-home span {
        display: none !important;
    }

    /* Header Nav & Extra Cell alignment */
    .site-header .main-bar .extra-nav,
    .extra-cell,
    .header-right,
    .header-widget-wrap {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
        overflow: visible !important;
        position: static !important;
    }

    .header-nav-btn-section,
    .header-widget {
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
        padding: 0 !important;
        margin-left: 0 !important;
        position: relative !important;
    }

    .header-widget-wrap > .header-widget {
        margin-left: 0 !important;
    }

    .header-widget a.dropdown-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 15px !important;
        width: 32px !important;
        height: 32px !important;
        position: relative !important;
        color: #1e293b !important;
        padding: 0 !important;
    }

    .header-widget a.dropdown-toggle::after {
        display: none !important;
    }

    .header-widget .notification-animate {
        top: -2px !important;
        right: -2px !important;
        min-width: 15px !important;
        height: 15px !important;
        line-height: 15px !important;
        font-size: 9px !important;
        padding: 0 3px !important;
    }

    .dashboard-user-section {
        display: flex !important;
        align-items: center !important;
    }

    .dashboard-user-section .listing-user {
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
    }

    .listing-user .dropdown-toggle {
        padding: 0 12px 0 0 !important;
        display: flex !important;
        align-items: center !important;
        position: relative !important;
        width: auto !important;
        height: auto !important;
    }

    .listing-user span {
        width: auto !important;
        margin-right: 4px !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .listing-user span img {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        margin-right: 0 !important;
    }

    .listing-user .user-name:before {
        right: 0 !important;
        font-size: 10px !important;
        color: #64748b !important;
    }

    .user-name-text,
    .twm-login-user-menu .user-name,
    .dashboard-user-section .user-name {
        display: inline-flex !important;
        align-items: center !important;
        max-width: 55px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        vertical-align: middle !important;
        visibility: visible !important;
        opacity: 1 !important;
        line-height: normal !important;
    }

    /* All dropdown menus on mobile & tablet */
    .header-widget .dropdown-menu,
    .dashboard-noti-dropdown .dropdown-menu,
    .dashboard-message-dropdown .dropdown-menu,
    .listing-user .dropdown-menu {
        position: fixed !important;
        top: 62px !important;
        left: 10px !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: 380px !important;
        min-width: 0 !important;
        margin: 0 auto !important;
        z-index: 999999 !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
        border-radius: 14px !important;
        background: #ffffff !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        transform: none !important;
    }

    /* Show 2 messages in view on mobile/tablet and scroll the rest */
    .dashboard-message-dropdown .message-list {
        max-height: 140px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }

    .dashboard-noti-dropdown .noti-list {
        max-height: 180px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }

    @media (max-width: 480px) {
        #header-admin .container,
        #header-admin.active .container {
            padding: 0 6px !important;
        }

        .header-left {
            gap: 4px !important;
        }

        .header-widget-wrap {
            gap: 4px !important;
        }

        .user-name-text,
        .twm-login-user-menu .user-name,
        .dashboard-user-section .user-name {
            max-width: 45px !important;
            font-size: 10px !important;
        }
    }

    /* Dashboard Header & Greeting Title */
    .wt-admin-right-page-header {
        padding: 12px 16px !important;
        margin-top: 0 !important;
        margin-bottom: 12px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        position: relative !important;
        z-index: 2 !important;
    }

    .wt-admin-right-page-header h2 {
        font-size: 20px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #111827 !important;
        margin: 0 0 4px 0 !important;
    }

    /* Cards & Panels */
    .twm-right-section-panel {
        padding: 14px !important;
    }

    .panel-heading {
        padding: 12px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* Stats Grids */
    .minimal-stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .minimal-stat-card {
        padding: 12px !important;
    }

    .student-dashboard-overview .dashboard-card {
        padding: 12px !important;
        border-radius: 12px !important;
    }

    .student-dashboard-overview .dashboard-card .wt-card-icon i {
        font-size: 24px !important;
    }

    .student-dashboard-overview .dashboard-card .counter {
        font-size: 22px !important;
    }

    .student-dashboard-overview .dashboard-card .wt-card-bottom h4 {
        font-size: 12px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Filter Wrappers & Select Dropdowns */
    .twm-filter-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .twm-filter-wrap .btn-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 5px !important;
        width: 100% !important;
    }

    .twm-filter-wrap .btn-group .btn {
        flex: 1 1 auto !important;
        text-align: center !important;
    }

    /* Student Profile Information Cards (Title on Left, Info on Right on Mobile) */
    .twm-profile-list-item {
        padding: 10px 14px !important;
        margin-bottom: 8px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 8px !important;
        border-left: 1px solid #e5e7eb !important;
        box-shadow: none !important;
    }

    .twm-profile-list-item.highlight-card {
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        border-left: 1px solid #e5e7eb !important;
    }

    .twm-profile-list-icon {
        display: none !important;
    }

    .twm-profile-list-detail {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .twm-profile-list-label {
        font-size: 12.5px !important;
        font-weight: 600 !important;
        color: #4b5563 !important;
        margin-bottom: 0 !important;
        text-transform: capitalize !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .twm-profile-list-label::after {
        content: " :" !important;
        margin-right: 4px !important;
    }

    .twm-profile-list-value {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #111827 !important;
        text-align: right !important;
        word-break: break-word !important;
    }

    .twm-profile-list-item.highlight-card .twm-profile-list-value {
        font-size: 13px !important;
        color: #111827 !important;
        letter-spacing: normal !important;
    }

    /* Course & Admission List Items */
    .twm-courses-list-style1 {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 14px !important;
        gap: 12px !important;
    }

    .twm-courses-list-style1 .twm-media {
        width: 50px !important;
        height: 50px !important;
    }

    .twm-courses-list-style1 .twm-mid-content {
        width: 100% !important;
    }

    .twm-courses-list-style1 .twm-right-content {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-top: 8px !important;
    }

    /* Footers */
    .footer-dark .footer-top .row {
        gap: 24px !important;
    }

    /* Search Filters & Form Columns */
    .form-group,
    .input-group {
        margin-bottom: 12px !important;
    }

    /* Buttons */
    .btn,
    .site-button {
        white-space: normal !important;
        word-break: break-word !important;
    }
}

/* ==========================================================================
   BREAKPOINT: Large Desktops (min-width: 992px)
   ========================================================================== */
@media (min-width: 992px) {
    .minimal-stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    .mobile-sidebar-backdrop {
        display: none !important;
    }
}

