/**
 * Mobile Responsive CSS for School Management System
 * Mobile-First Approach with App-Like Design
 * Optimized for Mobile (320px-767px) and Tablet (768px-1024px)
 */

/* ============================================
   BASE MOBILE STYLES
   ============================================ */
:root {
    --mobile-header-height: 60px;
    --mobile-bottom-nav-height: 60px;
    --mobile-padding: 15px;
    --tablet-padding: 20px;
    --sidebar-mobile-width: 280px;
}

/* Mobile body adjustments */
@media (max-width: 767px) {
    body {
        font-size: 14px;
        overflow-x: hidden;
        -webkit-font-smoothing: antialiased;
    }

    .container-fluid {
        padding-left: var(--mobile-padding) !important;
        padding-right: var(--mobile-padding) !important;
    }
}

/* ============================================
   SIDEBAR MOBILE NAVIGATION - FIXED FOR 100% VISIBILITY
   ============================================ */
@media (max-width: 991px) {
    /* Force sidebar to be fully visible on mobile */
    .sidebar,
    .adminux-sidebar,
    nav[id="sidebar"],
    .modern-sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        transform: none !important;
        transition: left 0.3s ease-in-out !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3) !important;
        margin: 0 !important;
    }

    /* Show sidebar when active */
    body.mobile-sidebar-active .sidebar,
    body.mobile-sidebar-active .adminux-sidebar,
    body.mobile-sidebar-active nav[id="sidebar"],
    body.mobile-sidebar-active .modern-sidebar,
    .mobile-sidebar-active .sidebar,
    .mobile-sidebar-active .adminux-sidebar {
        left: 0 !important;
    }

    /* Backdrop overlay */
    .sidebar-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.6) !important;
        z-index: 9998 !important;
        display: none !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
    }

    body.mobile-sidebar-active .sidebar-backdrop,
    .mobile-sidebar-active .sidebar-backdrop {
        display: block !important;
        opacity: 1 !important;
    }

    /* Content area - no margin on mobile, zero padding for full width */
    .content,
    .adminux-content,
    #content,
    .modern-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }
}

/* ============================================
   MOBILE TOPBAR
   ============================================ */
@media (max-width: 991px) {
    .topbar,
    .adminux-topbar,
    .navbar {
        height: var(--mobile-header-height) !important;
        padding: 0 var(--mobile-padding) !important;
        position: sticky !important;
        top: 0;
        z-index: 1030;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    }

    .toggle-sidebar,
    #sidebarToggle {
        display: flex !important;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .navbar-nav .d-lg-inline {
        display: none !important;
    }
}

/* ============================================
   MOBILE CARDS & DASHBOARD
   ============================================ */
@media (max-width: 767px) {
    .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    .card {
        margin-bottom: 15px !important;
        border-radius: 12px !important;
    }

    .card-header {
        padding: 12px 15px !important;
        font-size: 14px !important;
    }

    .card-body {
        padding: 15px !important;
    }

    h1, .h1 { font-size: 24px !important; }
    h2, .h2 { font-size: 20px !important; }
    h3, .h3 { font-size: 18px !important; }
    h4, .h4 { font-size: 16px !important; }
}

/* ============================================
   MOBILE TABLES
   ============================================ */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 13px !important;
        min-width: 600px;
    }

    .table thead th {
        font-size: 12px !important;
        padding: 10px 8px !important;
    }

    .table tbody td {
        padding: 10px 8px !important;
    }
}

/* ============================================
   MOBILE FORMS
   ============================================ */
@media (max-width: 767px) {
    .form-control,
    .form-select,
    input,
    textarea {
        font-size: 14px !important;
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }

    .btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
    }
}

/* ============================================
   MOBILE MODALS
   ============================================ */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }

    .modal-header {
        padding: 15px !important;
    }

    .modal-body {
        padding: 15px !important;
    }
}

/* ============================================
   TABLET (768px - 1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .row > .col-xl-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
