/* UNIQR V2 - Mobile Responsive Styles */
/* Comprehensive iOS and Mobile Device Support */

/* ============================================
   BASE - iOS Safe Area Support
   ============================================ */

:root {
    /* iOS safe area insets */
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
    --safe-area-inset-left: env(safe-area-inset-left);
    --safe-area-inset-right: env(safe-area-inset-right);
}

/* Prevent horizontal scrolling on all devices */
html,
body {
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* iOS specific fixes */
body {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
}

/* ============================================
   CRITICAL MOBILE SCROLL FIX
   Prevents individual elements from becoming
   scroll containers. Forces natural page scroll.
   ============================================ */
@media (max-width: 768px) {

    /* Remove all scroll containers on mobile - force page scroll */
    .brutal-card,
    .student-content,
    .admin-content,
    .col-lg-6,
    .col-lg-12,
    .col-md-6,
    .col-md-12,
    .row,
    .container,
    .container-fluid,
    main,
    section,
    article,
    .card,
    .panel,
    .content-wrapper,
    .page-content {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        max-height: none !important;
        height: auto !important;
        -webkit-overflow-scrolling: auto !important;
    }

    /* Ensure body and html scroll normally */
    html,
    body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100% !important;
    }

    /* Student page specific - remove scroll from content */
    .student-content {
        min-height: auto !important;
        overflow: visible !important;
    }
}

/* ============================================
   TABLET (992px and below)
   ============================================ */

@media (max-width: 992px) {

    /* Footer */
    footer {
        margin-left: 0 !important;
    }

    footer .row {
        text-align: center;
    }

    footer .col-md-6 {
        width: 100%;
        margin-bottom: 15px;
    }

    footer .text-end {
        text-align: center !important;
    }

    footer>div>div {
        flex-direction: column;
    }

    /* Sidebar Navigation */
    .sidebar {
        width: 100%;
        position: relative !important;
        transform: none !important;
        border-right: none;
        border-bottom: 3px solid #000;
        margin-bottom: 20px;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Navigation Menu */
    .nav-menu {
        flex-direction: column;
    }

    .nav-menu li {
        width: 100%;
        margin-bottom: 0;
    }

    .nav-menu a {
        justify-content: flex-start;
        padding: 15px 20px;
        border-bottom: 3px solid #000;
    }

    .nav-menu a:last-child {
        border-bottom: none;
    }

    /* Settings Tabs */
    .settings-tabs {
        flex-wrap: wrap;
    }

    .settings-tabs .brutal-btn {
        flex: 1 1 calc(50% - 10px);
        margin: 5px;
        padding: 10px;
        font-size: 0.85rem;
    }

    /* Grid Layouts */
    .row>[class*='col-md-'] {
        width: 100%;
        padding: 0 15px;
    }
}

/* ============================================
   TABLET (768px and below)
   ============================================ */

@media (max-width: 768px) {

    /* Typography */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    /* Container */
    .container {
        padding: 0 15px;
    }

    /* Footer Responsive */
    footer {
        margin-left: 0 !important;
        padding: 15px !important;
    }

    footer .row {
        text-align: center !important;
    }

    footer .col-md-6 {
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 15px;
    }

    footer .text-end {
        text-align: center !important;
    }

    footer>div:first-child {
        justify-content: center !important;
    }

    footer img {
        height: 35px !important;
    }

    footer div[style*="font-size: 12px"] {
        font-size: 11px !important;
        line-height: 1.4;
    }

    /* Cards */
    .brutal-card {
        padding: 15px !important;
        box-shadow: 4px 4px 0 #000 !important;
        margin-bottom: 20px;
    }

    .brutal-card:hover {
        transform: translate(-1px, -1px);
        box-shadow: 5px 5px 0 #000 !important;
    }

    /* Buttons */
    .brutal-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .brutal-btn i {
        margin-right: 5px;
    }

    /* Make buttons stack on very small screens */
    .btn-group .brutal-btn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }

    /* Tables - Prevent overflow and ensure responsiveness */
    .table-responsive,
    .brutal-table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        display: block;
    }

    .brutal-table {
        font-size: 0.85rem;
        width: 100%;
        min-width: 600px;
        /* Ensures readability on mobile */
        display: table;
        border-collapse: collapse;
    }

    .brutal-table thead,
    .brutal-table tbody,
    .brutal-table tr {
        display: table-row;
        width: 100%;
    }

    .brutal-table th,
    .brutal-table td {
        padding: 8px 6px;
        font-size: 0.7rem;
        word-break: break-word;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
        white-space: normal !important;
        max-width: 150px;
        min-width: 60px;
        display: table-cell;
        vertical-align: middle;
    }

    /* Prevent text overflow in table cells */
    .brutal-table td {
        white-space: normal !important;
        line-height: 1.4;
    }

    /* Long text in cells */
    .brutal-table td.text-truncate {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Make action buttons stack vertically in tables */
    .brutal-table .btn-group {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .brutal-table .btn-group .brutal-btn {
        width: 100%;
        font-size: 0.65rem;
        padding: 4px 6px;
        white-space: nowrap;
    }

    /* Ensure brutal-card content flows naturally - NO separate scroll */
    .brutal-card {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        max-height: none !important;
        height: auto !important;
    }

    /* Forms */
    .brutal-input,
    .brutal-select,
    .brutal-textarea {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
        padding: 10px;
    }

    .brutal-label {
        font-size: 0.85rem;
    }

    /* Filter Rows */
    .row .col-md-2,
    .row .col-md-3,
    .row .col-md-4 {
        margin-bottom: 15px;
    }

    /* Stats Cards */
    .stat-card {
        margin-bottom: 15px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    /* Admin Dashboard - Compact 2 cards per row on mobile */
    .row>.col-md-3 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 5px !important;
        margin-bottom: 10px !important;
    }

    /* Compact brutal-card stats for mobile */
    .row>.col-md-3 .brutal-card {
        padding: 10px !important;
        margin-bottom: 0 !important;
    }

    .row>.col-md-3 .brutal-card>div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 5px;
    }

    .row>.col-md-3 .brutal-card div[style*="font-size: 32px"],
    .row>.col-md-3 .brutal-card div[style*="font-size:32px"] {
        font-size: 22px !important;
        margin-top: 5px !important;
    }

    .row>.col-md-3 .brutal-card div[style*="font-size: 14px"],
    .row>.col-md-3 .brutal-card div[style*="font-size:14px"] {
        font-size: 11px !important;
    }

    .row>.col-md-3 .brutal-card i[style*="font-size: 48px"],
    .row>.col-md-3 .brutal-card i[style*="font-size:48px"] {
        font-size: 28px !important;
        position: absolute;
        right: 10px;
        top: 10px;
    }

    .row>.col-md-3 .brutal-card>div[style*="display: flex"] {
        position: relative;
    }

    /* Login Page */
    .login-container {
        padding: 20px 15px;
    }

    .login-card {
        padding: 20px;
    }

    .login-gif-container {
        min-height: 160px;
    }

    .login-gif-container img {
        max-height: 140px !important;
    }

    /* Footer Extra Small */
    footer {
        padding: 10px 8px !important;
    }

    footer img {
        height: 25px !important;
    }

    footer div[style*="font-weight: 900"] {
        font-size: 11px !important;
    }

    footer div[style*="font-size: 12px"],
    footer div[style*="font-size: 11px"] {
        font-size: 9px !important;
    }

    /* Modal */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 0;
    }

    /* Badges */
    .badge-brutal {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* Alerts */
    .alert {
        padding: 12px;
        font-size: 0.9rem;
    }

    /* Pagination - Compact Inline Style */
    .pagination-container,
    .brutal-pagination {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
    }

    .pagination-container button,
    .brutal-pagination .brutal-btn {
        margin: 3px;
        padding: 6px 12px;
        font-size: 0.8rem;
        min-width: 36px;
        height: 36px;
        width: auto;
    }
}

/* ============================================
   MOBILE (576px and below)
   ============================================ */

@media (max-width: 576px) {

    /* Root Variables */
    :root {
        --border-width: 3px;
        --shadow-offset: 4px;
    }

    /* Typography */
    body {
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
        font-weight: 900;
    }

    h4 {
        font-size: 1rem;
    }

    /* Container */
    .container {
        padding: 0 10px;
    }

    /* Footer Mobile */
    footer {
        margin-left: 0 !important;
        padding: 12px 10px !important;
        margin-top: 20px !important;
    }

    footer .container-fluid {
        padding: 0;
    }

    footer .row {
        margin: 0;
    }

    footer .col-md-6 {
        width: 100%;
        padding: 0;
        margin-bottom: 12px;
    }

    footer .col-md-6:last-child {
        margin-bottom: 0;
    }

    footer .text-end {
        text-align: center !important;
    }

    footer div[style*="display: flex"] {
        justify-content: center !important;
        gap: 10px !important;
    }

    footer img {
        height: 30px !important;
    }

    footer div[style*="font-weight: 900"] {
        font-size: 12px !important;
    }

    footer div[style*="font-size: 12px"] {
        font-size: 10px !important;
        line-height: 1.3;
        word-break: break-word;
    }

    footer div[style*="font-size: 11px"] {
        font-size: 9px !important;
    }

    /* Cards - No separate scroll containers */
    .brutal-card {
        padding: 12px !important;
        box-shadow: 3px 3px 0 #000 !important;
        margin-bottom: 15px;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
    }

    .brutal-card:hover {
        transform: none;
        box-shadow: 3px 3px 0 #000 !important;
    }

    .brutal-card h3 {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    /* Buttons */
    .brutal-btn {
        padding: 10px 15px;
        font-size: 0.85rem;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .brutal-btn:last-child {
        margin-bottom: 0;
    }

    .brutal-btn:hover {
        transform: translate(-1px, -1px);
        box-shadow: 3px 3px 0 #000;
    }

    /* Small buttons */
    .brutal-btn.btn-sm {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Button groups - stack vertically */
    .btn-toolbar,
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-toolbar .brutal-btn,
    .btn-group .brutal-btn {
        width: 100%;
        margin: 5px 0;
    }

    /* Tables - Responsive cards on mobile */
    .brutal-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    .brutal-table {
        font-size: 0.75rem;
        min-width: 600px;
    }

    .brutal-table th,
    .brutal-table td {
        padding: 8px 6px;
    }

    .brutal-table th {
        font-size: 0.7rem;
        letter-spacing: 0;
    }

    /* Alternative: Card-based table for very small screens */
    .table-card-mobile {
        display: none;
    }

    @supports (-webkit-touch-callout: none) {

        /* iOS specific table fixes */
        .brutal-table {
            border-spacing: 0;
        }
    }

    /* Forms */
    .brutal-input,
    .brutal-select,
    .brutal-textarea {
        font-size: 16px !important;
        /* Prevent iOS zoom */
        padding: 12px 10px;
        margin-bottom: 12px;
    }

    .brutal-label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    /* Form rows - stack vertically */
    .row .col-md-1,
    .row .col-md-2,
    .row .col-md-3,
    .row .col-md-4,
    .row .col-md-6,
    .row .col-md-8 {
        width: 100%;
        margin-bottom: 12px;
        padding: 0 10px;
    }

    /* Filter forms */
    .filter-form .row {
        margin: 0;
    }

    /* Stats */
    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }

    /* Icons in stats */
    .stat-icon {
        font-size: 2rem;
    }

    /* Login Page */
    .login-container {
        padding: 15px 10px;
    }

    .login-card {
        padding: 15px;
        box-shadow: 3px 3px 0 #000;
    }

    .login-gif-container {
        min-height: 140px;
        margin-bottom: 15px;
    }

    .login-gif-container img {
        max-height: 160px !important;
    }

    .google-signin-btn {
        font-size: 0.85rem;
        padding: 12px;
        width: 100%;
    }

    .divider {
        margin: 15px 0;
    }

    .divider span {
        font-size: 0.75rem;
        padding: 0 10px;
    }

    /* Modal */
    .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 12px;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }

    /* SweetAlert2 Mobile */
    .swal2-popup {
        font-size: 0.9rem !important;
        padding: 15px !important;
    }

    .swal2-title {
        font-size: 1.2rem !important;
    }

    .swal2-html-container {
        font-size: 0.85rem !important;
    }

    .swal2-confirm,
    .swal2-cancel {
        font-size: 0.85rem !important;
        padding: 10px 20px !important;
    }

    /* Badges */
    .badge-brutal {
        font-size: 0.7rem;
        padding: 3px 6px;
        white-space: nowrap;
    }

    /* Alerts */
    .alert {
        padding: 10px;
        font-size: 0.85rem;
        border-width: 2px;
    }

    .alert i {
        font-size: 0.9rem;
    }

    /* Pagination - Compact Inline Style */
    .pagination-container,
    .brutal-pagination,
    #paginationContainer .brutal-pagination {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .pagination-container button,
    .brutal-pagination .brutal-btn,
    #paginationContainer .brutal-btn {
        margin: 2px !important;
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        min-width: 32px !important;
        height: 32px !important;
        width: auto !important;
        flex: 0 0 auto !important;
    }

    .pagination-info,
    .brutal-pagination .pagination-info {
        display: none !important;
    }

    /* Hide ellipsis on very small screens to save space */
    .pagination-ellipsis {
        padding: 0 3px !important;
        font-size: 0.75rem !important;
    }

    /* Sidebar (if used) */
    .sidebar {
        position: fixed !important;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
        width: 80%;
        max-width: 300px;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: var(--secondary);
        border: 3px solid #000;
        padding: 10px 15px;
        cursor: pointer;
    }

    @media (min-width: 577px) {
        .mobile-menu-toggle {
            display: none;
        }
    }

    /* Upload/File Input */
    input[type="file"] {
        font-size: 0.85rem;
        padding: 8px;
    }

    /* Scrollbar */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 0;
    }

    /* Settings Navigation */
    .settings-tabs {
        flex-direction: column;
    }

    .settings-tabs .brutal-btn {
        width: 100%;
        margin: 5px 0;
        text-align: left;
    }

    /* Attendance Upload */
    .upload-section {
        padding: 15px;
    }

    /* CSV Preview Table */
    .csv-preview {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Student Profile */
    .profile-picture {
        width: 80px;
        height: 80px;
    }

    /* Dashboard Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Finalize Attendance */
    .finalize-card {
        padding: 15px;
    }

    /* Sanctions Table */
    .sanctions-table th,
    .sanctions-table td {
        min-width: 80px;
    }
}

/* ============================================
   EXTRA SMALL DEVICES (400px and below)
   ============================================ */

@media (max-width: 400px) {
    body {
        font-size: 0.85rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    h3 {
        font-size: 1rem;
    }

    .brutal-card {
        padding: 10px !important;
    }

    .brutal-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .brutal-table {
        font-size: 0.7rem;
    }

    .brutal-table th,
    .brutal-table td {
        padding: 6px 4px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .login-gif-container {
        min-height: 120px;
    }

    .login-gif-container img {
        max-height: 140px !important;
    }

    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border: none;
    }
}

/* ============================================
   LANDSCAPE MOBILE (Height constraint)
   ============================================ */

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .login-container {
        padding: 10px;
    }

    .login-card {
        padding: 15px;
    }

    .login-gif-container {
        display: none;
    }

    .modal-body {
        max-height: 50vh;
    }

    h1,
    h2,
    h3 {
        margin-top: 10px;
        margin-bottom: 10px;
    }
}

/* ============================================
   iOS SPECIFIC FIXES
   ============================================ */

/* Fix iOS Safari bottom bar overlap */
@supports (-webkit-touch-callout: none) {
    .fixed-bottom {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .main-content {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    /* Fix input zoom on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Enable smooth scrolling on iOS */
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        min-height: 100%;
    }

    .main-content,
    .container {
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   TOUCH OPTIMIZATIONS
   ============================================ */

/* Larger tap targets for mobile */
@media (max-width: 768px) {

    a,
    button,
    .clickable {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Remove tap highlight */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    /* Smooth scrolling */
    * {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide/Show on Mobile */
@media (max-width: 576px) {
    .hide-mobile {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }
}

@media (min-width: 577px) {
    .show-mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: block !important;
    }
}

/* Mobile Text Alignment */
@media (max-width: 576px) {
    .text-mobile-center {
        text-align: center !important;
    }

    .text-mobile-left {
        text-align: left !important;
    }
}

/* Mobile Spacing */
@media (max-width: 576px) {
    .mb-mobile-2 {
        margin-bottom: 0.5rem !important;
    }

    .mb-mobile-3 {
        margin-bottom: 1rem !important;
    }

    .mt-mobile-2 {
        margin-top: 0.5rem !important;
    }

    .mt-mobile-3 {
        margin-top: 1rem !important;
    }

    .p-mobile-2 {
        padding: 0.5rem !important;
    }

    .p-mobile-3 {
        padding: 1rem !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {

    .brutal-btn,
    .sidebar,
    .mobile-menu-toggle,
    .pagination-container,
    .filter-form,
    .no-print {
        display: none !important;
    }

    .brutal-card {
        border: 1px solid #000;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .brutal-table {
        border: 1px solid #000;
    }

    body {
        font-size: 12pt;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Focus visible for keyboard navigation */
@media (max-width: 768px) {
    *:focus-visible {
        outline: 3px solid var(--primary);
        outline-offset: 2px;
    }

    /* Skip to main content link */
    .skip-to-main {
        position: absolute;
        top: -40px;
        left: 0;
        background: var(--secondary);
        color: #000;
        padding: 8px;
        text-decoration: none;
        border: 3px solid #000;
        z-index: 9999;
    }

    .skip-to-main:focus {
        top: 0;
    }
}

/* ============================================
   GLOBAL MOBILE OVERFLOW FIXES
   ============================================ */

/* Ensure all containers don't overflow */
@media (max-width: 768px) {

    /* Prevent all horizontal overflow */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Cards and containers */
    .brutal-card,
    .card,
    .container,
    .container-fluid,
    .row {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Pre and code blocks */
    pre,
    code {
        max-width: 100%;
        overflow-x: auto;
        word-wrap: break-word;
        white-space: pre-wrap;
    }

    /* Long text and URLs */
    p,
    div,
    span,
    td,
    th {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Forms */
    input,
    select,
    textarea {
        max-width: 100%;
    }

    /* Buttons */
    .brutal-btn,
    .btn {
        max-width: 100%;
        white-space: normal;
        word-wrap: break-word;
    }

    /* Admin sidebar - Mobile behavior matching student sidebar */
    .admin-sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        width: 280px !important;
        max-width: 280px !important;
        height: 100vh;
        transform: translateX(-100%) !important;
        z-index: 2000 !important;
        overflow-y: auto;
        transition: transform 0.3s ease-in-out;
    }

    .admin-sidebar.active {
        transform: translateX(0) !important;
    }

    .admin-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px !important;
        padding-top: 70px !important;
    }

    /* Bootstrap columns */
    .col-1,
    .col-2,
    .col-3,
    .col-4,
    .col-5,
    .col-6,
    .col-7,
    .col-8,
    .col-9,
    .col-10,
    .col-11,
    .col-12,
    .col-md-1,
    .col-md-2,
    .col-md-3,
    .col-md-4,
    .col-md-5,
    .col-md-6,
    .col-md-7,
    .col-md-8,
    .col-md-9,
    .col-md-10,
    .col-md-11,
    .col-md-12 {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Modals */
    .modal-dialog {
        width: 95%;
        max-width: 95%;
        margin: 10px auto;
    }

    .modal-content {
        max-width: 100%;
    }

    /* SweetAlert modals */
    .swal2-popup {
        width: 90% !important;
        max-width: 90% !important;
    }

    /* Charts */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Table wrappers */
    .table-wrapper,
    .table-container,
    div[style*="overflow"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ============================================
   STUDENT DASHBOARD - RECENT ATTENDANCE MOBILE
   Compact row layout for mobile devices
   ============================================ */

@media (max-width: 576px) {

    /* Recent Attendance - Compact Row Layout */
    .student-content .brutal-card .table-responsive {
        overflow: visible !important;
    }

    .student-content .brutal-card .brutal-table {
        min-width: unset !important;
        display: block !important;
    }

    .student-content .brutal-card .brutal-table thead {
        display: none !important;
    }

    .student-content .brutal-card .brutal-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .student-content .brutal-card .brutal-table tbody tr {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        background: #fff !important;
        border: 2px solid #000 !important;
        padding: 10px 12px !important;
        gap: 6px 12px !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td {
        display: inline-block !important;
        padding: 0 !important;
        border: none !important;
        max-width: unset !important;
        min-width: unset !important;
        background: transparent !important;
        font-size: 13px !important;
    }

    /* Date column - bold, stays on left */
    .student-content .brutal-card .brutal-table tbody tr td:first-child {
        font-weight: 900 !important;
        color: #333 !important;
        flex-shrink: 0 !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:first-child::before {
        display: none !important;
    }

    /* Event column - takes remaining space */
    .student-content .brutal-card .brutal-table tbody tr td:nth-child(2) {
        flex: 1 !important;
        color: #555 !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:nth-child(2)::before {
        display: none !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:nth-child(2) strong {
        font-weight: 700 !important;
        font-size: 12px !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:nth-child(2) small {
        display: block !important;
        font-size: 10px !important;
        color: #777 !important;
    }

    /* Status column - badge on right */
    .student-content .brutal-card .brutal-table tbody tr td:last-child {
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:last-child::before {
        display: none !important;
    }

    /* Status badges - compact */
    .student-content .brutal-card .brutal-table tbody tr td:last-child span {
        padding: 4px 8px !important;
        font-size: 10px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        white-space: nowrap !important;
    }

    /* View All Attendance button */
    .student-content .brutal-card>div[style*="text-align: center"] .brutal-btn {
        width: 100% !important;
        margin-top: 5px !important;
    }
}

/* Extra small screens (400px and below) */
@media (max-width: 400px) {
    .student-content .brutal-card .brutal-table tbody tr {
        padding: 8px 10px !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td {
        font-size: 12px !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:nth-child(2) strong {
        font-size: 11px !important;
    }

    .student-content .brutal-card .brutal-table tbody tr td:last-child span {
        padding: 3px 6px !important;
        font-size: 9px !important;
    }
}

/* ============================================
   STUDENT PAGES - MOBILE CARD LAYOUTS
   Professional card-based layouts for mobile
   ============================================ */

@media (max-width: 576px) {

    /* ===== PAYMENT HISTORY (fees.php) ===== */
    .student-content .brutal-card:has(h3 i.fa-list) .table-responsive {
        overflow: visible !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table {
        display: block !important;
        min-width: unset !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table thead {
        display: none !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #fff !important;
        border: 3px solid #000 !important;
        padding: 15px !important;
        box-shadow: 4px 4px 0 #000 !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 6px 0 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        max-width: 100% !important;
        min-width: 100% !important;
        font-size: 13px !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:last-child {
        border-bottom: none !important;
        padding-top: 12px !important;
    }

    /* Fee Type - First row with label */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:first-child::before {
        content: "Fee Type";
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        margin-right: 10px;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:first-child {
        font-weight: 900 !important;
        color: #000 !important;
    }

    /* Academic Year */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(2)::before {
        content: "Year";
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        margin-right: 10px;
    }

    /* Description - hidden on mobile for cleaner look */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(3) {
        display: none !important;
    }

    /* Amount */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(4)::before {
        content: "Amount";
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        margin-right: 10px;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(4) {
        font-size: 16px !important;
        font-weight: 900 !important;
    }

    /* Status */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(5)::before {
        content: "Status";
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        margin-right: 10px;
    }

    /* Payment Date */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(6)::before {
        content: "Paid";
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        margin-right: 10px;
    }

    /* Action Button - Full width */
    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(7) {
        justify-content: center !important;
    }

    .student-content .brutal-card:has(h3 i.fa-list) .brutal-table tbody tr td:nth-child(7) .brutal-btn {
        width: 100% !important;
        text-align: center !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
    }

    /* ===== MY SANCTIONS (sanctions.php) ===== */
    /* Styles for sanctions are defined below using body:has() selector */

    /* ===== MY SUBMITTED APPEALS (appeals.php) ===== */
    /* Styles for appeals are defined below using body:has() selector */

    /* ===== LEADERBOARD (leaderboard.php) ===== */
    /* Styles for leaderboard are defined below using body:has() selector */


}

/* ============================================
   UNIVERSAL MOBILE TABLE TO CARD CONVERTER
   Works for all .brutal-table inside student-content
   ============================================ */

@media (max-width: 576px) {

    /* Generic mobile table card styles for all student pages */
    .student-content .brutal-card:not(:has(.student-content)) .table-responsive {
        overflow: visible !important;
    }

    /* Sanctions Page - My Sanctions Table */
    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .table-responsive {
        overflow: visible !important;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table {
        display: block !important;
        min-width: unset !important;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table thead {
        display: none !important;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #fff !important;
        border: 3px solid #000 !important;
        padding: 15px !important;
        box-shadow: 4px 4px 0 #000 !important;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        padding: 8px 0 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        max-width: 100% !important;
        min-width: 100% !important;
        font-size: 13px !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:last-child {
        border-bottom: none !important;
    }

    /* Sanction Name */
    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(1)::before {
        content: "Sanction";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 80px;
    }

    /* Description */
    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(2)::before {
        content: "Description";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 80px;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(2) {
        flex-wrap: wrap;
    }

    /* Amount */
    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(3)::before {
        content: "Amount";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 80px;
    }

    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(3) {
        font-size: 16px !important;
        font-weight: 900 !important;
        color: #FF6B6B !important;
    }

    /* Date Issued */
    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(4)::before {
        content: "Date";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 80px;
    }

    /* Status */
    body:has(.student-topbar h1 i.fa-exclamation-triangle) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(5)::before {
        content: "Status";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 80px;
    }

    /* ===== APPEALS PAGE ===== */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .table-responsive {
        overflow: visible !important;
    }

    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table {
        display: block !important;
        min-width: unset !important;
    }

    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table thead {
        display: none !important;
    }

    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #fff !important;
        border: 3px solid #000 !important;
        padding: 15px !important;
        box-shadow: 4px 4px 0 #000 !important;
    }

    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        padding: 8px 0 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        max-width: 100% !important;
        min-width: 100% !important;
        font-size: 13px !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:last-child {
        border-bottom: none !important;
    }

    /* Date Submitted */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(1)::before {
        content: "Submitted";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 75px;
    }

    /* Event */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(2)::before {
        content: "Event";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 75px;
    }

    /* Absence Date */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(3)::before {
        content: "Absence";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 75px;
    }

    /* Reason - Hide on mobile, too long */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(4) {
        display: none !important;
    }

    /* Document */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(5)::before {
        content: "Document";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 75px;
    }

    /* Status */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(6)::before {
        content: "Status";
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        color: #666;
        flex-shrink: 0;
        min-width: 75px;
    }

    /* Admin Response - Hide on mobile */
    body:has(.student-topbar h1 i.fa-gavel) .brutal-card:last-of-type .brutal-table tbody tr td:nth-child(7) {
        display: none !important;
    }

    /* ===== LEADERBOARD PAGE ===== */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .table-responsive {
        overflow: visible !important;
    }

    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table {
        display: block !important;
        min-width: unset !important;
    }

    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table thead {
        display: none !important;
    }

    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 8px 15px !important;
        background: #fff !important;
        border: 3px solid #000 !important;
        padding: 15px !important;
        box-shadow: 4px 4px 0 #000 !important;
        align-items: center !important;
    }

    /* Rank - Right side, spans 3 rows */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(1) {
        grid-row: 1 / 4 !important;
        grid-column: 2 !important;
        padding: 0 !important;
        border: none !important;
        max-width: unset !important;
        min-width: unset !important;
        font-size: 28px !important;
        text-align: right !important;
    }

    /* Student - Top left */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(2) {
        grid-row: 1 !important;
        grid-column: 1 !important;
        padding: 0 !important;
        border: none !important;
        max-width: unset !important;
        min-width: unset !important;
    }

    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(2)>div {
        gap: 8px !important;
    }

    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(2) img {
        width: 35px !important;
        height: 35px !important;
    }

    /* College - Middle left */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(3) {
        grid-row: 2 !important;
        grid-column: 1 !important;
        padding: 0 !important;
        border: none !important;
        max-width: unset !important;
        min-width: unset !important;
        font-size: 11px !important;
        color: #666 !important;
        font-weight: 700 !important;
    }

    /* Course - Same row as college */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(4) {
        display: none !important;
    }

    /* Year - Hide */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(5) {
        display: none !important;
    }

    /* Present Count - Bottom left */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(6) {
        grid-row: 3 !important;
        grid-column: 1 !important;
        padding: 0 !important;
        border: none !important;
        max-width: unset !important;
        min-width: unset !important;
        font-size: 12px !important;
    }

    /* Rate - Inline with present */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(7) {
        display: none !important;
    }

    /* Show rate in present cell */
    body:has(.student-topbar h1 i.fa-trophy) .brutal-card:has(h3 i.fa-medal) .brutal-table tbody tr td:nth-child(6)::after {
        content: " events attended";
        color: #666;
        font-weight: 400;
    }
}

/* ============================================
   COMPACT STAT CARDS FOR MOBILE
   2-column grid layout for stat-cards
   ============================================ */

@media (max-width: 576px) {

    /* Make stat card rows display as 2-column grid */
    .student-content .row:has(.stat-card) {
        display: flex !important;
        flex-wrap: wrap !important;
        margin: 0 -5px !important;
    }

    .student-content .row:has(.stat-card)>[class*="col-"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 5px !important;
        margin-bottom: 10px !important;
    }

    /* For 4-column layouts (appeals has 4 stat cards), keep 2x2 grid */
    .student-content .row:has(.stat-card)>.col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    /* Compact stat card styling */
    .student-content .stat-card {
        padding: 12px 10px !important;
        margin-bottom: 0 !important;
        min-height: auto !important;
    }

    .student-content .stat-card .stat-card-icon {
        font-size: 20px !important;
        margin-bottom: 5px !important;
    }

    .student-content .stat-card .stat-card-icon i {
        font-size: 20px !important;
    }

    .student-content .stat-card .stat-card-value {
        font-size: 22px !important;
        margin-bottom: 2px !important;
        line-height: 1.1 !important;
    }

    .student-content .stat-card .stat-card-label {
        font-size: 9px !important;
        letter-spacing: 0.5px !important;
    }

    /* For 3-column layouts, use 2+1 pattern */
    .student-content .row:has(.stat-card)>.col-md-4:last-child:nth-child(3) {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Dashboard stat cards - even more compact */
    .student-content .brutal-card .stat-card,
    .student-content>.row>.col-md-4 .stat-card {
        text-align: center !important;
    }
}

/* Extra small screens - keep 2-column but more compact */
@media (max-width: 400px) {

    .student-content .stat-card {
        padding: 10px 8px !important;
    }

    .student-content .stat-card .stat-card-icon {
        font-size: 18px !important;
    }

    .student-content .stat-card .stat-card-icon i {
        font-size: 18px !important;
    }

    .student-content .stat-card .stat-card-value {
        font-size: 18px !important;
    }

    .student-content .stat-card .stat-card-label {
        font-size: 8px !important;
    }
}

/* ============================================
   STUDENT SETTINGS PAGE - ACADEMIC INFO GRID
   ============================================ */

/* Base mobile responsive for settings academic grid */
@media (max-width: 768px) {

    /* Force single column layout on tablets and below */
    .settings-academic-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Improve card design for mobile */
    .settings-info-card {
        padding: 16px !important;
        display: flex !important;
        align-items: center !important;
        gap: 14px !important;
        box-shadow: 3px 3px 0 #000 !important;
    }

    /* Icon box styling */
    .settings-info-card>div:first-child {
        width: 44px !important;
        height: 44px !important;
        flex-shrink: 0 !important;
    }

    .settings-info-card>div:first-child i {
        font-size: 18px !important;
    }

    /* Content area - take remaining space */
    .settings-info-card>div:last-child {
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* Label styling */
    .settings-info-card>div:last-child>div:first-child {
        font-size: 10px !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 3px !important;
    }

    /* Value styling - allow text to wrap naturally */
    .settings-info-card>div:last-child>div:last-child {
        font-size: 14px !important;
        line-height: 1.4 !important;
        word-break: break-word !important;
    }
}

/* Small Mobile (576px and below) */
@media (max-width: 576px) {
    .settings-academic-grid {
        gap: 10px !important;
        margin-bottom: 16px !important;
    }

    .settings-info-card {
        padding: 14px !important;
        gap: 12px !important;
    }

    .settings-info-card>div:first-child {
        width: 40px !important;
        height: 40px !important;
    }

    .settings-info-card>div:first-child i {
        font-size: 16px !important;
    }

    .settings-info-card>div:last-child>div:first-child {
        font-size: 9px !important;
    }

    .settings-info-card>div:last-child>div:last-child {
        font-size: 13px !important;
    }

    /* Student settings page profile section mobile improvements */
    #profile-section .brutal-card {
        padding: 16px !important;
    }

    #profile-section #profile-picture-upload img {
        width: 100px !important;
        height: 100px !important;
    }

    #profile-section input[type="text"],
    #profile-section .form-control {
        font-size: 14px !important;
        padding: 10px !important;
    }

    /* UNIQR ID section mobile */
    #profile-section div[style*="font-family: 'Courier Prime'"] {
        font-size: 13px !important;
    }

    /* Security section mobile improvements */
    #google-section,
    #password-section {
        margin-bottom: 16px !important;
    }

    #google-section .brutal-card,
    #password-section .brutal-card {
        padding: 16px !important;
    }

    #password-section input[type="password"],
    #password-section .form-control {
        font-size: 14px !important;
        padding: 10px !important;
        padding-right: 40px !important;
    }

    /* Password strength meter mobile */
    #settingsStrengthChecks div {
        font-size: 10px !important;
    }
}

/* Extra small screens (below 400px) */
@media (max-width: 400px) {
    .settings-academic-grid {
        gap: 8px !important;
    }

    .settings-info-card {
        padding: 12px !important;
        gap: 10px !important;
    }

    .settings-info-card>div:first-child {
        width: 36px !important;
        height: 36px !important;
    }

    .settings-info-card>div:first-child i {
        font-size: 14px !important;
    }

    .settings-info-card>div:last-child>div:last-child {
        font-size: 12px !important;
    }

    #profile-section #profile-picture-upload img {
        width: 90px !important;
        height: 90px !important;
    }
}