/* Enhanced Responsive Design for Escort Global */

/* Mobile First Approach */
* {
    box-sizing: border-box;
}

/* Base responsive utilities */
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Responsive breakpoints */
:root {
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;
    --breakpoint-xxxl: 1920px;
}

/* Mobile styles (default) */
@media (max-width: 767px) {
    .container-fluid {
        padding-right: 10px;
        padding-left: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Fix for stats grid overflow */
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .stat-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0.75rem;
        box-sizing: border-box;
        overflow: hidden;
        word-wrap: break-word;
        background: var(--card-bg, #ffffff);
        border: 1px solid var(--border-color, #dee2e6);
        border-radius: 12px;
        text-align: center;
    }
    
    .stat-value {
        font-size: 1.5rem;
        font-weight: 700;
        line-height: 1.2;
        word-break: break-word;
        margin-bottom: 0.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        line-height: 1.3;
        word-break: break-word;
        hyphens: auto;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-weight: 600;
        color: var(--text-secondary, #6c757d);
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 0.5rem;
        font-size: 1rem;
    }
    
    /* Ensure no horizontal overflow */
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }
    
    .main-content {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }
    
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .col-12 {
        padding-left: 0;
        padding-right: 0;
    }
    
    /* Fix for any content that might overflow */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 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; }
    h6 { font-size: 0.9rem; }
    
    /* Spacing */
    .mb-mobile-3 { margin-bottom: 1rem !important; }
    .mt-mobile-3 { margin-top: 1rem !important; }
    .p-mobile-2 { padding: 0.5rem !important; }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 6px;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Forms */
    .form-control {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }
    
    .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    /* Navigation */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid #dee2e6;
    }
    
    .nav-tabs .nav-item {
        flex-shrink: 0;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.375rem 0.5rem;
    }
    
    /* Progress bars */
    .progress {
        height: 0.5rem;
    }
    
    .progress-bar {
        font-size: 0.7rem;
    }
    
    /* List groups */
    .list-group-item {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Utilities */
    .text-mobile-center { text-align: center !important; }
    .d-mobile-none { display: none !important; }
    .d-mobile-block { display: block !important; }
    .d-mobile-flex { display: flex !important; }
    .w-mobile-100 { width: 100% !important; }
}

/* Tablet styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container-fluid {
        padding-right: 20px;
        padding-left: 20px;
    }
    
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.1rem; }
    h6 { font-size: 1rem; }
    
    /* Cards */
    .card-body {
        padding: 1.25rem;
    }
    
    .card-header {
        padding: 1rem 1.25rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Forms */
    .form-control {
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.625rem 0.5rem;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 1.75rem auto;
    }
    
    .modal-lg {
        max-width: 800px;
    }
    
    .modal-xl {
        max-width: 900px;
    }
    
    /* Navigation */
    .nav-tabs .nav-link {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Utilities */
    .d-tablet-none { display: none !important; }
    .d-tablet-block { display: block !important; }
    .d-tablet-flex { display: flex !important; }
}

/* Desktop styles (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439px) {
    .container-fluid {
        padding-right: 30px;
        padding-left: 30px;
    }
    
    /* Typography */
    h1 { font-size: 2.25rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.75rem; }
    h4 { font-size: 1.5rem; }
    h5 { font-size: 1.25rem; }
    h6 { font-size: 1.1rem; }
    
    /* Cards */
    .card-body {
        padding: 1.5rem;
    }
    
    .card-header {
        padding: 1.25rem 1.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    /* Forms */
    .form-control {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
    }
    
    .form-label {
        font-size: 0.95rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.75rem;
    }
    
    /* Modals */
    .modal-lg {
        max-width: 900px;
    }
    
    .modal-xl {
        max-width: 1000px;
    }
    
    /* Navigation */
    .nav-tabs .nav-link {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    /* Utilities */
    .d-desktop-none { display: none !important; }
    .d-desktop-block { display: block !important; }
    .d-desktop-flex { display: flex !important; }
}

/* Large Desktop styles (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
    .container-fluid {
        padding-right: 40px;
        padding-left: 40px;
    }
    
    /* Typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 2rem; }
    h4 { font-size: 1.75rem; }
    h5 { font-size: 1.5rem; }
    h6 { font-size: 1.25rem; }
    
    /* Cards */
    .card-body {
        padding: 2rem;
    }
    
    .card-header {
        padding: 1.5rem 2rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }
    
    /* Forms */
    .form-control {
        font-size: 1rem;
        padding: 0.875rem 1.125rem;
    }
    
    .form-label {
        font-size: 1rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.95rem;
    }
    
    .table th,
    .table td {
        padding: 0.875rem 1rem;
    }
    
    /* Modals */
    .modal-lg {
        max-width: 1000px;
    }
    
    .modal-xl {
        max-width: 1200px;
    }
    
    /* Navigation */
    .nav-tabs .nav-link {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
    
    /* Utilities */
    .d-lg-desktop-none { display: none !important; }
    .d-lg-desktop-block { display: block !important; }
    .d-lg-desktop-flex { display: flex !important; }
}

/* Extra Large Desktop styles (1920px+) */
@media (min-width: 1920px) {
    .container-fluid {
        max-width: 1800px;
        margin: 0 auto;
        padding-right: 50px;
        padding-left: 50px;
    }
    
    /* Typography */
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 2.25rem; }
    h4 { font-size: 2rem; }
    h5 { font-size: 1.75rem; }
    h6 { font-size: 1.5rem; }
    
    /* Cards */
    .card-body {
        padding: 2.5rem;
    }
    
    .card-header {
        padding: 2rem 2.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
    
    /* Forms */
    .form-control {
        font-size: 1.1rem;
        padding: 1rem 1.25rem;
    }
    
    .form-label {
        font-size: 1.1rem;
    }
    
    /* Tables */
    .table {
        font-size: 1rem;
    }
    
    .table th,
    .table td {
        padding: 1rem 1.25rem;
    }
    
    /* Modals */
    .modal-lg {
        max-width: 1200px;
    }
    
    .modal-xl {
        max-width: 1400px;
    }
    
    /* Navigation */
    .nav-tabs .nav-link {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    /* Utilities */
    .d-xl-desktop-none { display: none !important; }
    .d-xl-desktop-block { display: block !important; }
    .d-xl-desktop-flex { display: flex !important; }
}

/* Landscape mobile specific */
@media (max-width: 767px) and (orientation: landscape) {
    .modal-body {
        max-height: 60vh;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
    }
    
    .form-control {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break {
        page-break-before: always;
    }
    
    .print-break-inside {
        page-break-inside: avoid;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .btn {
        border: 1px solid #000 !important;
        background: transparent !important;
        color: #000 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid currentColor;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #ffffff;
    }
}

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}
