@media (max-width: 768px) {
    .table-info {
        /* Already visible, just ensure proper styling on mobile */
        font-size: 0.8rem;
        padding: 0.6rem;
    }

    .table-wrapper {
        border-radius: 12px;
        overflow: visible; /* Allow scrolling */
    }

    /* Hide scroll indicators on mobile */
    .scroll-indicator {
        display: none !important;
    }

    /* Ensure table container can scroll horizontally and vertically */
    #tableContainer {
        max-height: 500px; /* Increased height for better viewing */
        overflow-y: auto !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important; /* Enable smooth touch scrolling on iOS */
        scroll-behavior: smooth !important; /* Smooth scrolling behavior */
        touch-action: pan-x pan-y !important; /* Allow both horizontal and vertical panning */
        scrollbar-width: thin; /* Thin scrollbars for Firefox */
        width: 100% !important; /* Ensure full width */
        position: relative !important;
        display: block !important; /* Ensure proper display */
    }

    .data-table {
        min-width: 100%;
        white-space: nowrap;
        width: auto; /* Let table expand naturally */
        display: table !important; /* Ensure proper table display */
    }

    /* Remove sticky positioning - allow all columns to scroll together */
    .data-table th,
    .data-table td {
        position: static !important;
        left: auto !important;
        background: inherit !important;
        z-index: auto !important;
        box-shadow: none !important;
        white-space: nowrap !important; /* Prevent text wrapping */
        min-width: 60px !important; /* Minimum column width */
    }

    /* Force table to be wider than container to enable horizontal scroll */
    .data-table {
        min-width: 1000px !important; /* Increased minimum width to force horizontal scroll */
        table-layout: auto !important; /* Allow natural column sizing */
        width: max-content !important; /* Let table size naturally */
    }

    /* Ensure table fits in container properly */
    .table-container {
        overflow: visible !important;
    }

    /* Custom scrollbar styling for mobile WebKit browsers */
    #tableContainer::-webkit-scrollbar {
        width: 8px !important;
        height: 8px !important;
    }

    #tableContainer::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1) !important;
        border-radius: 4px !important;
    }

    #tableContainer::-webkit-scrollbar-thumb {
        background: rgba(59, 130, 246, 0.6) !important;
        border-radius: 4px !important;
    }

    #tableContainer::-webkit-scrollbar-thumb:hover {
        background: rgba(59, 130, 246, 0.8) !important;
    }
}

@media (max-width: 768px) {
    .scroll-indicator {
        display: block;
    }
}

@media (max-width: 768px) {
    /* Mobile: Hide scroll controls, show touch info */
    .scroll-controls {
        display: none !important;
    }

    .mobile-scroll-info {
        display: block !important;
    }
}

@media (max-width: 480px) {
    /* Extra Small Mobile Devices - Extremely compact layout */
    .container {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    /* Header adjustments - much more compact */
    .main-header .container {
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }

    .main-header .flex {
        flex-direction: row !important;
        gap: 0.25rem !important;
        align-items: center !important;
    }

    .main-header .system-title {
        font-size: 0.5rem !important;
        line-height: 1.0 !important;
        text-align: left !important;
        margin-bottom: 0 !important;
    }

    .main-header .report-logo {
        width: 25px !important;
        height: 30px !important;
        flex-shrink: 0 !important;
    }

    .main-header p {
        font-size: 0.45rem !important;
        text-align: left !important;
        margin-top: 0.1rem !important;
    }

    /* Navigation buttons - ultra compact */
    .main-header .btn-secondary {
        font-size: 0.45rem !important;
        padding: 0.2rem 0.3rem !important;
    }

    .main-header .flex.flex-col.sm\:flex-row {
        flex-direction: row !important;
        gap: 0.15rem !important;
    }

    /* Filter form - ultra compact */
    .filter-form {
        margin: 0.25rem 0 !important;
        padding: 0.3rem !important;
        border-radius: 6px !important;
    }

    .filter-form .grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.15rem !important;
    }

    .filter-form h2 {
        font-size: 0.55rem !important;
        margin-bottom: 0.1rem !important;
    }

    .filter-form p {
        font-size: 0.45rem !important;
    }

    .form-control {
        padding: 0.25rem 0.3rem !important;
        font-size: 0.5rem !important;
        border-radius: 4px !important;
    }

    .form-label {
        font-size: 0.45rem !important;
        margin-bottom: 0.1rem !important;
    }

    /* Action buttons - ultra compact */
    .action-buttons {
        padding: 0.4rem !important;
        margin: 0.25rem 0 !important;
        flex-direction: row !important;
        gap: 0.3rem !important;
    }

    .btn-download {
        width: auto !important;
        flex: 1 !important;
        font-size: 0.5rem !important;
        padding: 0.3rem 0.4rem !important;
        border-radius: 6px !important;
    }

    /* Table info - ultra compact */
    .table-info {
        padding: 0.3rem !important;
        margin: 0.25rem 0 !important;
        font-size: 0.45rem !important;
        border-radius: 4px !important;
    }

    /* Table container - ultra compact */
    .table-container {
        margin: 0.25rem 0 !important;
        border-radius: 8px !important;
    }

    .data-table th,
    .data-table td {
        padding: 0.2rem 0.1rem !important;
        font-size: 0.45rem !important;
    }

    /* Scroll controls - ultra compact */
    .scroll-controls {
        padding: 0.3rem !important;
        margin: 0.25rem 0 !important;
        flex-direction: column !important;
        gap: 0.4rem !important;
        border-radius: 8px !important;
    }

    .horizontal-scroll-controls,
    .vertical-scroll-controls {
        gap: 0.3rem !important;
    }

    .vertical-scroll-controls {
        display: none !important; /* Always hide - use natural touch scrolling */
        flex-direction: row !important;
    }

    .scroll-info {
        font-size: 0.45rem !important;
        text-align: center;
    }

    .scroll-info.vertical {
        writing-mode: initial !important;
        text-orientation: initial !important;
        font-size: 0.45rem !important;
    }

    .scroll-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.65rem !important;
        border-radius: 6px !important;
    }

    /* Ultra compact table wrapper - enhanced touch scrolling */
    #tableContainer {
        max-height: 300px !important;
        -webkit-overflow-scrolling: touch !important; /* Enhanced touch scrolling */
        scroll-behavior: smooth !important;
    }
}

@media (max-width: 768px) {
    /* Tablet and Small Mobile Devices - Compact layout */

    /* Header responsive - compact horizontal layout */
    .main-header .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        padding-top: 0.4rem !important;
        padding-bottom: 0.4rem !important;
    }

    .main-header .flex.items-center.justify-between {
        flex-direction: row !important;
        gap: 0.5rem !important;
        align-items: center !important;
    }

    .main-header .system-title {
        font-size: 0.65rem !important;
        text-align: left !important;
        line-height: 1.1 !important;
        margin-bottom: 0.1rem !important;
    }

    .main-header .report-logo {
        width: 35px !important;
        height: 40px !important;
    }

    .main-header p {
        font-size: 0.55rem !important;
        margin-top: 0.1rem !important;
    }

    /* Filter form responsive - compact grid layout */
    .filter-form {
        padding: 0.4rem !important;
        margin: 0.4rem 0 !important;
        border-radius: 8px !important;
    }

    .filter-form .grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.3rem !important;
    }

    .filter-form h2 {
        font-size: 0.65rem !important;
        margin-bottom: 0.15rem !important;
    }

    .filter-form p {
        font-size: 0.55rem !important;
    }

    .filter-form .form-group:last-child {
        grid-column: span 4 !important;
    }

    .form-control {
        padding: 0.35rem 0.4rem !important;
        font-size: 0.6rem !important;
        border-radius: 4px !important;
    }

    .form-label {
        font-size: 0.55rem !important;
        margin-bottom: 0.1rem !important;
    }

    /* Navigation buttons compact */
    .main-header .btn-secondary {
        font-size: 0.5rem !important;
        padding: 0.25rem 0.35rem !important;
    }

    .main-header .flex.flex-col.sm\:flex-row {
        flex-direction: row !important;
        gap: 0.2rem !important;
    }

    /* Stats grid - compact */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 0.5rem !important;
        margin: 0.75rem 0 !important;
    }

    /* Action buttons - compact horizontal */
    .action-buttons {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.5rem !important;
        justify-content: center !important;
        padding: 0.5rem !important;
        margin: 0.4rem 0 !important;
    }

    .btn-download,
    .btn-primary,
    .btn-secondary {
        width: auto !important;
        flex: 1 !important;
        max-width: none !important;
        font-size: 0.6rem !important;
        padding: 0.4rem 0.6rem !important;
        border-radius: 6px !important;
    }

    /* Table info compact */
    .table-info {
        padding: 0.4rem !important;
        margin: 0.4rem 0 !important;
        font-size: 0.55rem !important;
        border-radius: 6px !important;
    }

    /* Legend responsive - compact horizontal */
    .legend-items {
        flex-direction: row !important;
        gap: 0.5rem !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    .legend-item {
        font-size: 0.55rem !important;
        padding: 0.3rem 0.5rem !important;
    }

    /* Table responsive - compact structure */
    .data-table {
        font-size: 0.55rem !important;
    }

    .data-table th,
    .data-table td {
        padding: 0.25rem 0.15rem !important;
    }

    .table-container {
        margin: 0.4rem 0 !important;
        border-radius: 10px !important;
    }

    /* Scroll controls - compact */
    .scroll-controls {
        flex-direction: column !important;
        padding: 0.4rem !important;
        margin: 0.4rem 0 !important;
        gap: 0.5rem !important;
        border-radius: 8px !important;
    }

    .horizontal-scroll-controls,
    .vertical-scroll-controls {
        gap: 0.4rem !important;
    }

    .vertical-scroll-controls {
        display: none !important; /* Always hide - use natural touch scrolling */
        flex-direction: row !important;
    }

    .scroll-info {
        font-size: 0.55rem !important;
        padding: 0 0.3rem;
    }

    .scroll-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.7rem !important;
        border-radius: 6px !important;
    }

    /* Compact table wrapper - enhanced touch scrolling */
    #tableContainer {
        max-height: 350px !important;
        -webkit-overflow-scrolling: touch !important; /* Enhanced touch scrolling */
        scroll-behavior: smooth !important;
    }
}

@media (max-width: 1024px) {
    /* Laptop and Large Tablet */

    .filter-form .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }

    .filter-form .form-group:last-child {
        grid-column: 1 / -1 !important;
    }

    .legend-items {
        justify-content: center !important;
        gap: 1.25rem !important;
    }
}

@media (max-width: 768px) {
    /* Global container spacing reduction */
    .container {
        padding-top: 0.3rem !important;
        padding-bottom: 0.3rem !important;
    }

    /* Reduce all margins globally on mobile */
    .mb-6 { margin-bottom: 0.75rem !important; }
    .mb-4 { margin-bottom: 0.5rem !important; }
    .mb-2 { margin-bottom: 0.25rem !important; }
    .mt-12 { margin-top: 1.5rem !important; }
    .p-8 { padding: 1rem !important; }
    .p-6 { padding: 0.75rem !important; }
    .py-8 { padding-top: 0.4rem !important; padding-bottom: 0.4rem !important; }

    /* Footer info section compact */
    .text-center.mt-12.p-8 {
        margin-top: 0.75rem !important;
        padding: 0.75rem !important;
        border-radius: 12px !important;
    }

    .text-center.mt-12.p-8 h3 {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
    }

    .text-center.mt-12.p-8 p {
        font-size: 0.7rem !important;
        line-height: 1.4 !important;
    }
}

@media (max-width: 480px) {
    /* Even more compact for very small screens */
    .container {
        padding-top: 0.2rem !important;
        padding-bottom: 0.2rem !important;
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    /* Ultra compact margins */
    .mb-6 { margin-bottom: 0.4rem !important; }
    .mb-4 { margin-bottom: 0.3rem !important; }
    .mb-2 { margin-bottom: 0.15rem !important; }
    .mt-12 { margin-top: 0.75rem !important; }
    .p-8 { padding: 0.5rem !important; }
    .p-6 { padding: 0.4rem !important; }
    .py-8 { padding-top: 0.2rem !important; padding-bottom: 0.2rem !important; }

    /* Footer ultra compact */
    .text-center.mt-12.p-8 {
        margin-top: 0.5rem !important;
        padding: 0.5rem !important;
    }

    .text-center.mt-12.p-8 h3 {
        font-size: 0.7rem !important;
        margin-bottom: 0.3rem !important;
    }

    .text-center.mt-12.p-8 p {
        font-size: 0.6rem !important;
        line-height: 1.3 !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .form-control,
    .btn-primary,
    .btn-secondary,
    .btn-download {
        min-height: 44px !important; /* iOS minimum touch target */
    }

    .scroll-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* Remove hover effects on touch devices */
    .data-table tbody tr:hover {
        transform: none !important;
    }

    .btn-download:hover,
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none !important;
    }
}

@media (max-width: 768px) {
.filter-form {
    padding: 0.3rem !important; /* Ultra compact padding */
}
.filter-form .text-center {
    margin-bottom: 0.25rem !important;
}
.filter-form h2 {
    font-size: 0.7rem !important;
    margin-bottom: 0.15rem !important;
}
.filter-form p {
    font-size: 0.55rem !important;
}
.filter-form .grid {
    gap: 0.25rem !important; /* Ultra tight gaps */
}
.filter-form .form-label {
    font-size: 0.5rem !important; /* Ultra small labels */
    margin-bottom: 0.1rem !important;
}
.filter-form .form-control {
    padding: 0.25rem 0.3rem !important; /* Ultra compact input padding */
    font-size: 0.55rem !important;
    border-radius: 4px !important;
}
.filter-form .btn-primary,
.filter-form .btn-secondary {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.55rem !important;
    border-radius: 6px !important;
}
.filter-form .btn-primary i,
.filter-form .btn-secondary i {
    font-size: 0.5rem !important;
    margin-right: 0.2rem !important;
}
}

@media (max-width: 480px) {
    .filter-form {
        padding: 0.2rem !important;
        margin: 0.2rem 0 !important;
    }

    .filter-form .grid.grid-cols-1.md\:grid-cols-8 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.15rem !important;
    }

    .filter-form .form-group {
        margin-bottom: 0 !important;
    }

    .filter-form .form-group.md\:col-span-3 {
        grid-column: span 2 !important;
    }

    .filter-form h2 {
        font-size: 0.55rem !important;
        margin-bottom: 0.1rem !important;
    }

    .filter-form p {
        font-size: 0.45rem !important;
    }
}

@media (max-width: 768px) {
    .filter-form {
        padding: 0.25rem !important;
        margin: 0.3rem 0 !important;
    }

    .filter-form .grid.grid-cols-1.md\:grid-cols-8 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.2rem !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .form-control,
    .btn-primary,
    .btn-secondary,
    .btn-download {
        min-height: 44px !important; /* iOS minimum touch target */
    }

    .scroll-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* Remove hover effects on touch devices */
    .data-table tbody tr:hover {
        transform: none !important;
    }

    .btn-download:hover,
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none !important;
    }
}

