/* Mobile Responsiveness Improvements for SBA LMS */
/* Optimized for student panel and overall mobile experience */

/* Base Mobile Optimizations */
@media (max-width: 768px) {
    /* Global Container Adjustments */
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Main Content Area */
    .main-content {
        padding: 10px !important;
        width: 100%;
    }

    .content-wrapper {
        flex-direction: column;
    }

    /* Sidebar Mobile Optimization */
    .sidebar-wrapper {
        width: 100% !important;
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 9999;
        transition: left 0.3s ease;
        background: white;
        overflow-y: auto;
    }

    .sidebar-wrapper.mobile-open {
        left: 0;
    }

    .sidebar-wrapper button,
    .sidebar-wrapper a {
        font-size: 16px !important;
        padding: 12px 15px !important;
    }

    /* Dashboard Cards */
    .dashboard-card {
        margin-bottom: 15px;
    }

    .dashboard-card .card-body {
        padding: 15px !important;
    }

    /* Tables - Make them scrollable */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .universal-table {
        overflow-x: auto;
        width: 100%;
    }

    table {
        font-size: 14px !important;
    }

    table th,
    table td {
        padding: 8px !important;
        white-space: nowrap;
    }

    /* Forms */
    .form-group {
        margin-bottom: 15px;
    }

    .form-control {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 10px !important;
    }

    select.form-control {
        font-size: 16px !important;
    }

    /* Buttons */
    .btn {
        padding: 10px 15px;
        font-size: 14px;
        width: 100%;
        margin-bottom: 10px;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
    }

    .btn-group .btn {
        margin-bottom: 5px;
        border-radius: 4px !important;
    }

    /* Cards */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }

    .card-header {
        padding: 12px 15px !important;
        font-size: 16px !important;
    }

    .card-body {
        padding: 15px !important;
    }

    /* Navigation Tabs */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 10px 15px;
        font-size: 14px;
    }

    /* Modals */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-body {
        padding: 15px !important;
    }

    /* Title Sections */
    .title-wrapper h5,
    .title-wrapper .title {
        font-size: 20px !important;
    }

    /* Top Section Headers */
    .top-section {
        padding: 15px !important;
        flex-wrap: wrap;
    }

    .top-section span {
        font-size: 18px !important;
    }

    /* Attendance Mobile Improvements */
    .attendance-section {
        padding: 10px !important;
    }

    .attending-hours-wrapper {
        flex-wrap: wrap;
    }

    .attending-hours-wrapper input {
        margin-bottom: 5px;
        width: 60px !important;
        flex: 0 0 60px;
    }

    /* Evaluation Mobile Improvements */
    .evaluation-section {
        padding: 10px !important;
    }

    /* Exam Countdown Timer Mobile */
    .countdown-timer {
        padding: 10px !important;
        margin-top: 15px;
    }

    .countdown-timer .timer-display {
        font-size: 1.5rem !important;
    }

    /* File List Mobile */
    .list-group-item {
        padding: 10px !important;
        flex-direction: column;
        align-items: flex-start !important;
    }

    .list-group-item .btn {
        margin-top: 10px;
        width: 100%;
    }

    /* Row Adjustments */
    .row {
        margin-left: -5px;
        margin-right: -5px;
    }

    .row > [class*='col-'] {
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Hide Desktop Elements on Mobile */
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    /* Profile Picture */
    .user-profile img {
        width: 60px !important;
        height: 60px !important;
    }

    /* Navbar Mobile */
    .navbar {
        padding: 10px 15px !important;
    }

    .navbar-brand {
        font-size: 18px !important;
    }

    /* Select2 Dropdown Mobile */
    .select2-container {
        width: 100% !important;
    }

    .select2-container .select2-selection--single {
        height: 45px !important;
        padding: 8px !important;
    }

    /* Datepicker Mobile */
    .datepicker {
        font-size: 16px !important;
    }

    /* Student Dashboard Specific */
    .student-dashboard .card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .student-dashboard .stat-card {
        text-align: center;
        padding: 20px !important;
    }

    /* Improve Touch Targets */
    a, button, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Material Icons Size */
    .material-icons {
        font-size: 20px !important;
        vertical-align: middle;
    }

    /* Alerts */
    .alert {
        padding: 12px !important;
        font-size: 14px !important;
        margin-bottom: 15px;
    }

    /* Text Sizing */
    body {
        font-size: 14px !important;
    }

    h1 { font-size: 24px !important; }
    h2 { font-size: 22px !important; }
    h3 { font-size: 20px !important; }
    h4 { font-size: 18px !important; }
    h5 { font-size: 16px !important; }
    h6 { font-size: 14px !important; }

    /* Spacing Utilities */
    .mb-3 { margin-bottom: 15px !important; }
    .mt-3 { margin-top: 15px !important; }
    .p-3 { padding: 15px !important; }
}

/* Extra Small Devices (phones in portrait, less than 576px) */
@media (max-width: 576px) {
    .card-body {
        padding: 10px !important;
    }

    .btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    h5, .title {
        font-size: 18px !important;
    }

    table {
        font-size: 12px !important;
    }

    .form-control {
        font-size: 14px !important;
    }
}

/* Tablet Optimizations (768px - 992px) */
@media (min-width: 768px) and (max-width: 992px) {
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }

    .sidebar-wrapper {
        width: 250px !important;
    }

    .main-content {
        width: calc(100% - 250px);
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar-wrapper {
        width: 300px !important;
    }

    .countdown-timer {
        flex-direction: row;
        justify-content: space-around;
    }
}

/* Print Styles */
@media print {
    .sidebar-wrapper,
    .navbar,
    .btn,
    button {
        display: none !important;
    }

    .main-content {
        width: 100% !important;
        padding: 0 !important;
    }

    .card {
        page-break-inside: avoid;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
    /* Uncomment when dark mode is implemented */
    /*
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }

    .card {
        background-color: #2d2d2d;
        border-color: #444;
    }
    */
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Fix for iOS bottom bar overlap */
    .content-wrapper {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
