/* Mobile Responsiveness Fixes for Dashboard */

/* Base mobile styles */
@media (max-width: 768px) {
    /* General layout adjustments */
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Card adjustments */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Table responsiveness */
    .table-responsive {
        border: none;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 12px;
        min-width: 600px; /* Ensure minimum width for readability */
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        white-space: nowrap;
        vertical-align: middle;
    }
    
    .table th {
        font-size: 11px;
        font-weight: 600;
        background-color: #f8f9fa;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Button adjustments */
    .btn {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 6px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }
    
    /* Form controls */
    .form-control,
    .form-select {
        height: 40px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    /* Navigation adjustments */
    .navbar-custom {
        padding: 0 10px;
    }
    
    .navbar-custom .navbar-nav .nav-link {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Sidebar adjustments */
    .left-side-menu {
        width: 100%;
        max-width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .left-side-menu.show {
        transform: translateX(0);
    }
    
    /* Chart containers */
    .chart-container {
        height: 300px !important;
        min-height: 250px;
    }
    
    /* Map adjustments */
    #world-map-markers {
        height: 300px !important;
        min-height: 250px;
    }
    
    .leaflet-container {
        height: 100% !important;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
    }
    
    /* Toast notifications */
    .toast {
        max-width: calc(100% - 20px);
        margin: 10px;
    }
    
    /* Expanded table view */
    .expanded-view,
    .red-expanded {
        padding: 15px;
        overflow-x: auto;
    }
    
    .expanded-view .table-responsive,
    .red-expanded .table-responsive {
        max-height: calc(100vh - 120px);
    }
    
    .expanded-view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .btn-close-expanded {
        align-self: flex-end;
        font-size: 1.2rem;
        padding: 8px;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .card-header {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .table {
        font-size: 11px;
        min-width: 500px;
    }
    
    .table th,
    .table td {
        padding: 6px 4px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }
    
    .form-control,
    .form-select {
        height: 36px;
        font-size: 13px;
    }
    
    .chart-container {
        height: 250px !important;
    }
    
    #world-map-markers {
        height: 250px !important;
    }
    
    .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }
    
    .modal-body {
        padding: 15px;
    }
}

/* Landscape orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
    .chart-container {
        height: 200px !important;
    }
    
    #world-map-markers {
        height: 200px !important;
    }
    
    .expanded-view .table-responsive,
    .red-expanded .table-responsive {
        max-height: calc(100vh - 80px);
    }
}

/* Touch-friendly improvements */
@media (max-width: 768px) {
    /* Increase touch targets */
    .btn,
    .form-control,
    .form-select,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Improve scrolling */
    .table-responsive,
    .modal-body,
    .expanded-view {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Better focus states for accessibility */
    .btn:focus,
    .form-control:focus,
    .form-select:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .table th,
    .table td {
        border-width: 0.5px;
    }
    
    .card {
        border-width: 0.5px;
    }
}

/* Print styles */
@media print {
    .navbar-custom,
    .left-side-menu,
    .btn,
    .modal,
    .toast {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .table {
        font-size: 10px;
    }
    
    .table th,
    .table td {
        padding: 4px;
    }
}



/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .left-side-menu,
    .modal,
    .toast {
        transition: none;
    }
    
    .table-responsive {
        scroll-behavior: auto;
    }
}
