/* Dashboard Custom Styles */
body {
    font-family: 'Outfit', sans-serif !important;
    background-color: #f8f9fa;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 48px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
    transition: all 0.15s ease-in-out;
}

.sidebar .nav-link:hover {
    color: #ED1B26;
    background-color: rgba(237, 27, 38, 0.1);
}

.sidebar .nav-link.active {
    color: #ED1B26;
    background-color: rgba(237, 27, 38, 0.1);
    font-weight: 600;
}

.sidebar .nav-link i {
    width: 16px;
    height: 16px;
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
}

/* Mobile Offcanvas Styles */
.offcanvas {
    width: 280px !important;
}

.offcanvas .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0;
    margin: 0;
    border-bottom: 1px solid #eee;
    transition: all 0.15s ease-in-out;
}

.offcanvas .nav-link:hover {
    color: #ED1B26;
    background-color: rgba(237, 27, 38, 0.1);
}

.offcanvas .nav-link.active {
    color: #ED1B26;
    background-color: rgba(237, 27, 38, 0.1);
    font-weight: 600;
}

.offcanvas .nav-link:last-child {
    border-bottom: none;
}

.offcanvas .sidebar-heading {
    background-color: #f8f9fa;
    margin: 0;
    padding: 0.75rem 1rem 0.5rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* Additional Mobile Sidebar Fixes */

/* Ensure mobile sidebar has proper z-index */
.offcanvas {
    z-index: 1055 !important;
}

/* Make sure the offcanvas backdrop is visible */
.offcanvas-backdrop {
    z-index: 1050 !important;
}

/* Mobile navbar adjustments */
@media (max-width: 767.98px) {
    /* Ensure mobile toggle button is visible */
    .navbar-toggler {
        border: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0.25rem 0.5rem;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    }
    
    /* Navbar brand adjustments on mobile */
    .navbar-brand {
        font-size: 1.1rem;
        margin-right: auto;
        margin-left: 0.5rem;
    }
    
    /* Hide desktop sidebar completely on mobile */
    #sidebarMenu.sidebar {
        display: none !important;
    }
    
    /* Ensure main content takes full width on mobile */
    main.col-md-9,
    main.col-lg-10 {
        margin-left: 0 !important;
        padding: 1rem 0.5rem;
    }
}

/* Offcanvas specific styles */
.offcanvas.offcanvas-start {
    width: 280px !important;
    border-right: 1px solid #dee2e6;
}

.offcanvas-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.offcanvas-body {
    padding: 0;
    overflow-y: auto;
}

/* Mobile offcanvas nav links */
.offcanvas .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0;
    margin: 0;
    border-bottom: 1px solid #eee;
    transition: all 0.15s ease-in-out;
    display: flex;
    align-items: center;
}

.offcanvas .nav-link:hover {
    color: #ED1B26;
    background-color: rgba(237, 27, 38, 0.1);
    text-decoration: none;
}

.offcanvas .nav-link.active {
    color: #ED1B26;
    background-color: rgba(237, 27, 38, 0.1);
    font-weight: 600;
}

.offcanvas .nav-link:last-child {
    border-bottom: none;
}

.offcanvas .sidebar-heading {
    background-color: #f8f9fa;
    margin: 0;
    padding: 0.75rem 1rem 0.5rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge in mobile sidebar */
.offcanvas .nav-link .badge {
    margin-left: auto;
}

/* Quick stats card in mobile sidebar */
.offcanvas .card {
    margin: 1rem;
    border-radius: 0.5rem;
}

/* Fix for iOS Safari */
@media (max-width: 767.98px) {
    .offcanvas {
        height: 100vh !important;
        height: -webkit-fill-available !important;
    }
}

/* Accessibility improvements */
.navbar-toggler:focus {
    outline: 2px solid #ED1B26;
    outline-offset: 2px;
}

/* Ensure Bootstrap CSS doesn't conflict */
.offcanvas.show {
    transform: none !important;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Border left cards */
.border-left-primary {
    border-left: 0.25rem solid #ED1B26 !important;
}

.border-left-success {
    border-left: 0.25rem solid #28a745 !important;
}

.border-left-info {
    border-left: 0.25rem solid #17a2b8 !important;
}

.border-left-warning {
    border-left: 0.25rem solid #ffc107 !important;
}

/* Tables */
.table {
    color: #333;
}

.table th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table-responsive {
    border-radius: 0.375rem;
}

/* Buttons */
.btn-primary {
    background-color: #ED1B26;
    border-color: #ED1B26;
}

.btn-primary:hover {
    background-color: #d41420;
    border-color: #d41420;
}

.btn-outline-primary {
    color: #ED1B26;
    border-color: #ED1B26;
}

.btn-outline-primary:hover {
    background-color: #ED1B26;
    border-color: #ED1B26;
}

/* Badges */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Forms */
.form-control {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #ED1B26;
    box-shadow: 0 0 0 0.2rem rgba(237, 27, 38, 0.25);
}

.form-select {
    border-radius: 0.5rem;
}

.form-select:focus {
    border-color: #ED1B26;
    box-shadow: 0 0 0 0.2rem rgba(237, 27, 38, 0.25);
}

/* Modal */
.modal-content {
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.75rem 0.75rem 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Status indicators */
.status-pending {
    color: #ffc107;
}

.status-confirmed {
    color: #17a2b8;
}

.status-preparing {
    color: #007bff;
}

.status-ready {
    color: #28a745;
}

.status-delivered {
    color: #28a745;
}

.status-cancelled {
    color: #dc3545;
}

/* Custom utilities */
.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ED1B26;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Order status timeline */
.order-timeline {
    position: relative;
    padding-left: 30px;
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

#map {
    height: 500px;
    width: 100%;
    border-radius: 10px;
}

.tracking-card {
    border-left: 5px solid #0d6efd;
}

.status-dot {
    height: 10px;
    width: 10px;
    background-color: #28a745;
    border-radius: 50%;
    display: inline-block;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
}

.timeline-item.active::before {
    background: #28a745;
}

.timeline-item.current::before {
    background: #ED1B26;
}

/* Mobile Responsive Adjustments */
@media (max-width: 767.98px) {
    .sidebar {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important;
        padding-top: 1rem;
    }
    
    .container-fluid .row {
        margin: 0;
    }
    
    .col-md-9,
    .col-lg-10 {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Adjust card margins on mobile */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Make tables more mobile friendly */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* Adjust button sizes on mobile */
    .btn-toolbar .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Stack stats cards on mobile */
    .row.mb-4 .col-xl-3 {
        margin-bottom: 1rem;
    }
    
    /* Adjust navbar brand on mobile */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Better spacing for mobile offcanvas */
    .offcanvas-body {
        padding: 0;
    }
}

/* Desktop adjustments */
@media (min-width: 768px) {
    /* Ensure main content has proper margin on desktop */
    main.col-md-9,
    main.col-lg-10 {
        margin-left: auto;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .offcanvas,
    .navbar,
    .btn,
    .card-header .btn-group {
        display: none !important;
    }
    
    .main {
        margin-left: 0 !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
}

/* Additional mobile improvements */
@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .d-flex.justify-content-between > * {
        margin-bottom: 0.5rem;
    }
}

/* WhatsApp widget z-index management */
.whatsapp-float,
.whatsapp-widget {
    z-index: 1050 !important;
}

/* Ensure modals are above WhatsApp */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1054 !important;
}