/* Variables principales */
:root {
    --primary-color: #8B4513;  /* Marron sellier - couleur principale */
    --secondary-color: #D2691E; /* Chocolat - couleur secondaire */
    --accent-color: #DAA520;   /* Doré - accent */
    --text-dark: #2c2c2c;
    --text-light: #6c757d;
    --bg-light: #fafafa;
    --bg-cream: #f8f6f0;
    --bg-cream-plus-black: #ceccc7;
    --shadow: 0 4px 20px rgba(139, 69, 19, 0.1);
    --shadow-hover: 0 8px 30px rgba(139, 69, 19, 0.2);
    --border-radius: 12px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 250px;
    --header-height: 76px;
}

/* Styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-body {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-cream) 100%);
}

/* Barre de défilement personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Styles de l'en-tête */
.main-header {
    background: rgba(44, 44, 44, 0.95);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0;
    transition: var(--transition);
    height: var(--header-height);
}

.main-header.scrolled {
    background: rgba(44, 44, 44, 0.98);
    padding: 0.8rem 0;
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--accent-color) !important;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.navbar-brand:hover {
    color: var(--secondary-color) !important;
    transform: scale(1.05);
}

.navbar-brand img {
    height: 50px;
    margin-right: 10px;
}

/* Bouton de bascule de la barre de navigation (Menu Hamburger) */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    margin-left: 0.5rem;
    color: white;
    font-size: 1.2rem;
    transition: var(--transition);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}

/* Navigation de la barre */
.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    margin: 0 0.75rem;
    position: relative;
    transition: var(--transition);
    border-radius: 5px;
    padding: 10px 20px !important;
}

.navbar-nav .nav-link:hover {
    color: var(--accent-color) !important;
    background: rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background: var(--accent-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after {
    width: 80%;
}

.navbar-nav .nav-link.active {
    background: var(--primary-color);
    color: white !important;
}

/* Styles de menu déroulant */
.dropdown-menu {
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 10px;
    min-width: 200px;
}

.dropdown-item {
    color: white !important;
    padding: 12px 20px;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--secondary-color);
    color: var(--accent-color) !important;
}

/* Badge de notification */
.notification-badge {
    background: var(--accent-color);
    color: var(--text-dark);
    border-radius: 50%;
    padding: 4px 8px;
    font-size: 0.50rem;
    position: absolute;
    top: -8px;
    right: -8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Conteneur principal */
.main-wrapper {
    flex: 1;
    margin-top: var(--header-height);
    display: flex;
    flex-direction: column;
}

/* Conteneur de l'application */
.app-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--header-height));
}

/* Styles de la barre latérale */
.sidebar {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    transition: var(--transition);
    width: var(--sidebar-width);
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    z-index: 999;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-content {
    padding: 20px 0;
}

.sidebar-header {
    padding: 0 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-title {
    color: var(--accent-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 10px;
}

.sidebar .nav-link {
    color: white;
    padding: 12px 20px;
    margin: 2px 15px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    font-weight: 500;
    text-decoration: none;
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 12px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.sidebar .nav-link.active i {
    color: var(--bg-cream);
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    transform: translateX(3px);
}

.sidebar .nav-link.active {
    background: var(--accent-color);
    color: var(--text-dark) !important;
    border-left-color: var(--accent-color);
}

.sidebar .nav-link .badge {
    margin-left: auto;
    flex-shrink: 0;
}

/* Conteneur de contenu */
.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.content-wrapper.expanded {
    margin-left: 0;
}

/* Contenu principal */
.main-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content-header {
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-light) 100%);
    border-bottom: 3px solid var(--accent-color);
    padding: 25px 35px;
    flex-shrink: 0;
}

.content-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.content-header .breadcrumb {
    background: none;
    padding: 10px 0;
    margin: 0;
}

.content-header .breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.content-header .breadcrumb-item a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.content-header .breadcrumb-item + .breadcrumb-item::before {
    color: var(--secondary-color);
    content: '/';
}

.content-body {
    padding: 35px;
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* Styles de la carte Leaflet */
#map {
    height: 400px !important;
    width: 100% !important;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    z-index: 1;
    background-color: #f8f9fa;
    margin-bottom: 20px;
}

/* Styles pour les selecteurs de produits sur mobile */
.product-select {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Améliore le défilement sur iOS */
}

/* Media Queries pour mobile */
@media (max-width: 768px) {
    #map {
        height: 300px !important;
        margin-bottom: 15px;
    }

    .product-select {
        max-height: 150px; /* Hauteur réduite pour mobile */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 576px) {
    #map {
        height: 250px !important;
        margin-bottom: 10px;
    }

    .product-select {
        max-height: 120px; /* Encore plus compact pour petits écrans */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Carte de bienvenue */
.welcome-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%);
    color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.welcome-title {
    font-size: 2rem;
    font-family: 'Playfair Display', serif;
}

.welcome-subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.welcome-stats .quick-stat {
    text-align: center;
}

/* Carte de statistiques */
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.stat-content .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-content .stat-label {
    font-size: 1rem;
    color: var(--text-light);
}

.stat-trend {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Cartes de graphiques et d'activités */
.chart-card, .activity-card, .orders-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
}

.chart-header, .activity-header, .orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title, .activity-title, .orders-title {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.chart-controls .btn {
    margin-left: 5px;
}

/* Chronologie des activités */
.activity-timeline {
    position: relative;
    padding-left: 20px;
}

.activity-item {
    position: relative;
    margin-bottom: 15px;
    padding-left: 10px;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    left: -25px;
    top: 5px;
}

.activity-dot-success { background: #28a745; }
.activity-dot-warning { background: #ffc107; }
.activity-dot-info { background: #17a2b8; }
.activity-dot-primary { background: var(--primary-color); }

.activity-content {
    background: var(--bg-cream);
    padding: 10px 12px;
    border-radius: var(--border-radius);
    margin-left: 10px;
    border-left: 3px solid var(--accent-color);
    transition: var(--transition);
}

.activity-content:hover {
    background: white;
    box-shadow: var(--shadow);
}

.activity-time {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* Tableaux modernes */
.table-modern {
    width: 100%;
    border-collapse: collapse;
}

.table-modern th, .table-modern td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table-modern th {
    background: var(--bg-cream);
    color: var(--primary-color);
    font-weight: 600;
}

.table-row-hover:hover {
    background: var(--bg-light);
}

/* Boutons */
.btn-modern {
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
    background: var(--accent-color);
    color: var(--text-dark);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-modern i {
    margin-right: 8px;
}

.btn-primary.btn-modern {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
}

.btn-primary.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary.btn-modern {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.btn-accent.btn-modern {
    background: var(--accent-color);
}

.btn-action {
    margin-right: 5px;
}

/* Alertes */
.alert {
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    position: fixed;
    top: calc(var(--header-height) + 10px);
    right: 20px;
    z-index: 1050;
    padding: 1.25rem 1.75rem;
    font-size: 0.95rem;
    box-shadow: var(--shadow);
}

.alert-success {
    background: var(--accent-color);
    color: var(--text-dark);
}

.alert-danger {
    background: #dc3545;
    color: white;
}

.alert-warning {
    background: #ffc107;
    color: var(--text-dark);
}

.alert .btn-close {
    color: inherit;
    opacity: 0.8;
    transition: var(--transition);
}

.alert .btn-close:hover {
    opacity: 1;
}

/* Pied de page */
.main-footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    flex-shrink: 0;
}

.main-footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.main-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Superposition de chargement */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner-border-custom {
    border-color: var(--primary-color);
    border-right-color: transparent;
}

.loading-text {
    color: white;
    margin-top: 1rem;
}

/* Bouton de retour en haut */
.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: none;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1000;
}

.scroll-top-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Badges de statut */
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: white;
}

.status-pending { background-color: #ffc107; }
.status-confirmed { background-color: #17a2b8; }
.status-in-kitchen { background-color: #fd7e14; }
.status-ready { background-color: #28a745; }
.status-in-delivery { background-color: #6f42c1; }
.status-delivered { background-color: #20c997; }
.status-picked_up { background-color: #0da97a; }
.status-cancelled { background-color: #dc3545; }
.status-in_kitchen { background-color: #e8590c; }
.status-assigned_delivery { background-color: #2c3e50; }
.status-in_delivery { background-color: #5a189a; }

.status-admin { background-color: var(--admin-color, #007bff); }
.status-commande_manager { background-color: var(--commande-manager-color, #17a2b8); }
.status-cuisine_manager { background-color: var(--cuisine-manager-color, #28a745); }
.status-livreur { background-color: var(--livreur-color, #ffc107); }
.status-client { background-color: var(--client-color, #6c757d); }
.status-active { background-color: var(--success-color, #28a745); }
.status-inactive { background-color: var(--danger-color, #dc3545); }

/* Superposition de la barre latérale pour mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

/* En-tête de menu déroulant */
.dropdown-header {
    color: var(--accent-color);
    background-color: var(--bg-cream-plus-black);
}

.dropdown-header .user-details {
    text-align: center;
}

/* Styles de l'avatar */
.avatar-container {
    position: relative;
    display: inline-block;
}

.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-color);
}

.avatar-edit {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.avatar-edit:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Styles des modales */
.modal-content {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.modal-header {
    background: var(--bg-cream);
    border-bottom: 2px solid var(--accent-color);
}

.modal-title {
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
}

.modal-body .form-label {
    color: var(--text-dark);
    font-weight: 500;
}

.modal-body .img-thumbnail {
    border: 2px solid var(--accent-color);
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    justify-content: space-between;
}

.modal-footer .btn {
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
}

.modal-footer .btn-secondary {
    background: #6c757d;
    color: white;
}

.modal-footer .btn-secondary:hover {
    background: #5c636a;
}

.modal-footer .btn-primary {
    background: var(--accent-color);
    color: var(--text-dark);
}

.modal-footer .btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Modale personnalisée pour vider le panier */
.modal-cart-clear {
    max-width: 450px;
}

.modal-cart-clear .modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-bottom: none;
}

.modal-cart-clear .modal-title {
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.modal-cart-clear .modal-body {
    text-align: center;
    padding: 2rem;
}

.modal-cart-clear .modal-body i {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.modal-cart-clear .modal-body p {
    font-size: 1.1rem;
    margin-bottom: 0;
}

.modal-cart-clear .modal-footer {
    justify-content: center;
    border-top: none;
    padding: 1rem 2rem 2rem;
}

.modal-cart-clear .btn-confirm {
    background: var(--accent-color);
    color: var(--text-dark);
    font-weight: 600;
    min-width: 120px;
}

.modal-cart-clear .btn-cancel {
    background: var(--bg-cream-plus-black);
    color: var(--text-dark);
    font-weight: 600;
    min-width: 120px;
}

.modal-cart-clear .btn-confirm:hover {
    background: var(--secondary-color);
}

.modal-cart-clear .btn-cancel:hover {
    background: #b3b1ac;
}

/* Styles des cartes */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: var(--bg-cream);
    border-bottom: 2px solid var(--accent-color);
    font-weight: 600;
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    padding: 15px;
}

.card-body {
    padding: 20px;
}

/* Styles des formulaires */
.form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(218, 165, 32, 0.5);
}

.col-form-label {
    font-weight: 500;
    color: var(--text-dark);
}

.btn-primary {
    background: var(--accent-color);
    color: var(--text-dark);
    border: none;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Styles de liste */
.list-group-item {
    border: none;
    background: transparent;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item i {
    color: var(--primary-color);
}

/* Styles des badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.badge.bg-primary {
    background: var(--primary-color);
    color: white;
}

/* Curseur */
.cursor-pointer {
    cursor: pointer;
}

/* Informations sur les produits */
.product-info {
    padding: 1.8rem;
}

.product-info h5 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

.product-description {
    color: var(--text-light);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Styles pour le champ de recherche des clients */
#client_search {
    border-radius: 8px 0 0 8px;
}

#clear_search {
    border-radius: 0 8px 8px 0;
    transition: var(--transition);
}

#clear_search:hover {
    background-color: var(--accent-color);
    color: var(--text-dark);
}

/* Indicateur de recherche en cours */
.searching-indicator {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.searching .searching-indicator {
    display: block;
}

/* Media Queries regroupées */
@media (max-width: 1199px) {
    :root {
        --sidebar-width: 220px;
        --header-height: 70px;
    }

    .content-wrapper {
        margin-left: 220px;
    }

    .sidebar-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 65px;
    }

    .main-header {
        padding: 0 15px;
    }

    .navbar-nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
    }

    .navbar-nav .nav-link {
        margin: 0.25rem 0;
        padding: 8px 15px !important;
        font-size: 0.95rem;
        width: 100%;
        text-align: left;
    }

    .navbar-nav .nav-link::after {
        display: none;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
    }

    .content-header {
        padding: 20px 25px;
    }

    .content-header h1 {
        font-size: 2.4rem;
    }

    .welcome-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .welcome-stats {
        margin-top: 1rem;
        justify-content: center;
        display: flex;
        flex-wrap: wrap;
    }

    .quick-stat {
        margin: 0 0.5rem;
        min-width: 80px;
    }

    .stat-card {
        margin-bottom: 1rem;
        padding: 15px;
    }

    .stat-icon {
        font-size: 1.8rem;
    }

    .stat-content .stat-number {
        font-size: 2.2rem;
    }

    .chart-card, .activity-card, .orders-card {
        margin-bottom: 1.5rem;
        padding: 20px;
    }

    .table-modern th, .table-modern td {
        padding: 12px;
        font-size: 0.95rem;
    }

    .sidebar-toggle {
        display: block;
    }

    /* Updated dropdown styles */
    .dropdown-menu {
        width: auto; /* Use natural width instead of full width */
        min-width: 200px; /* Ensure readability */
        max-width: 90vw; /* Prevent overflow beyond viewport */
        margin: 0.5rem 0 0; /* Add spacing */
        background: rgba(44, 44, 44, 0.98); /* Match navbar background */
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* Add shadow for visibility */
        z-index: 1001; /* Ensure dropdown appears above header */
        position: absolute; /* Ensure proper positioning */
        right: 0; /* Align to right edge */
        left: auto;
    }

    .dropdown-item {
        padding: 10px 15px;
        font-size: 0.9rem;
        color: white !important;
        white-space: nowrap; /* Prevent text wrapping */
    }

    .dropdown-menu-end {
        right: 0;
        left: auto;
    }

    .notifications-dropdown,
    .user-menu {
        width: auto; /* Use natural width */
        max-width: 90vw; /* Prevent overflow */
    }

    .navbar-collapse {
        background: rgba(44, 44, 44, 0.95); /* Consistent background */
        z-index: 1001; /* Ensure navbar collapse is above header */
        max-height: calc(100vh - var(--header-height)); /* Prevent overflow */
        overflow-y: auto; /* Allow scrolling */
    }

    .dropdown-menu.show {
        display: block; /* Force display when active */
        opacity: 1;
        transform: translateY(0); /* Ensure no transform issues */
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --border-radius: 10px;
    }

    #map {
        height: 300px !important;
        margin-bottom: 15px;
    }

    .main-header {
        padding: 0 15px;
    }

    .navbar-brand {
        font-size: 1.4rem;
    }

    .navbar-brand img {
        height: 40px;
        margin-right: 8px;
    }

    .navbar-toggler {
        font-size: 1.1rem;
        padding: 0.4rem;
    }

    .navbar-nav .nav-link {
        padding: 6px 12px !important;
        font-size: 0.9rem;
    }

    .dropdown-menu {
        width: 100%;
        margin-top: 5px;
        min-width: unset;
        background: rgba(44, 44, 44, 0.95);
        border-radius: 8px;
    }

    .dropdown-item {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .sidebar-content {
        padding: 15px 0;
    }

    .sidebar-header {
        padding: 0 15px 10px;
        margin-bottom: 15px;
    }

    .sidebar-title {
        font-size: 1rem;
    }

    .nav-section {
        margin-bottom: 20px;
    }

    .nav-section-title {
        font-size: 0.8rem;
        padding: 0 15px;
        margin-bottom: 8px;
    }

    .sidebar .nav-link {
        padding: 10px 15px;
        margin: 2px 10px;
        font-size: 0.9rem;
    }

    .sidebar .nav-link i {
        width: 18px;
        margin-right: 10px;
    }

    .main-content {
        margin: 15px;
        border-radius: 10px;
    }

    .content-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
    }

    .content-header h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .content-body {
        padding: 20px;
    }

    .welcome-card {
        padding: 20px;
    }

    .welcome-title {
        font-size: 1.6rem;
    }

    .welcome-subtitle {
        font-size: 0.9rem;
    }

    .welcome-stats {
        margin-top: 15px;
    }

    .stat-card {
        padding: 15px;
        margin-bottom: 1rem;
        text-align: center;
    }

    .stat-icon {
        font-size: 1.6rem;
    }

    .stat-content .stat-number {
        font-size: 2rem;
    }

    .stat-content .stat-label {
        font-size: 0.9rem;
    }

    .stat-trend {
        font-size: 0.8rem;
    }

    .chart-card, .activity-card, .orders-card {
        padding: 15px;
    }

    .chart-header, .activity-header, .orders-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 15px;
    }

    .chart-title, .activity-title, .orders-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .chart-controls .btn {
        margin: 0 2px 5px 0;
        font-size: 0.9rem;
    }

    .orders-header .btn {
        margin-top: 0.5rem;
        width: 100%;
    }

    .activity-timeline {
        padding-left: 15px;
    }

    .activity-item {
        margin-bottom: 12px;
        padding-left: 8px;
    }

    .activity-dot {
        left: -20px;
        width: 8px;
        height: 8px;
    }

    .activity-content {
        padding: 8px 10px;
        margin-left: 8px;
    }

    .activity-time {
        font-size: 0.75rem;
    }

    .table-modern th, .table-modern td {
        padding: 10px;
        font-size: 0.9rem;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .btn-modern {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        border-radius: 25px;
    }

    .btn-modern i {
        margin-right: 6px;
    }

    .page-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .alert {
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
        right: 15px;
        max-width: 90%;
    }

    .main-footer {
        padding: 1.5rem 0;
        font-size: 0.9rem;
    }

    .scroll-top-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }

    .avatar {
        width: 120px;
        height: 120px;
    }

    .avatar-edit {
        width: 35px;
        height: 35px;
        bottom: 8px;
        right: 8px;
    }

    .modal-content {
        margin: 15px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer .btn {
        padding: 0.4rem 1.2rem;
        font-size: 0.9rem;
    }

    .card {
        margin-bottom: 15px;
    }

    .card-header {
        padding: 12px;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 15px;
    }

    .form-control {
        font-size: 0.9rem;
    }

    .col-form-label {
        font-size: 0.9rem;
    }

    .product-info {
        padding: 1.2rem;
    }

    .product-info h5 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }

    .product-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .product-price {
        font-size: 1.2rem;
    }

    .col-md-4, .col-md-6, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .row.mb-3 {
        margin-bottom: 15px !important;
    }

    .dropdown-menu {
        width: auto;
        min-width: 200px; /* Ensure a minimum width for readability */
        max-width: 90vw; /* Prevent overflow beyond viewport */
        margin: 0.5rem 0 0; /* Add slight margin for spacing */
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* Restore shadow for visibility */
        background: rgba(44, 44, 44, 0.98); /* Match navbar background */
        z-index: 1001; /* Ensure dropdown appears above other elements */
        position: absolute; /* Ensure proper positioning */
        right: 0; /* Align to right edge */
        left: auto;
    }

    .dropdown-item {
        padding: 10px 15px; /* Slightly more padding for touch devices */
        font-size: 0.9rem; /* Slightly larger for readability */
        color: white !important;
        white-space: nowrap; /* Prevent text wrapping */
    }

    .notifications-dropdown,
    .user-menu {
        width: auto; /* Allow natural width */
        max-width: 90vw; /* Prevent overflow */
    }

    .navbar-nav {
        max-height: calc(100vh - var(--header-height) - 20px); /* Limit height to avoid overflow */
        overflow-y: auto; /* Allow scrolling if content overflows */
        padding: 10px; /* Add padding for better spacing */
    }

    .navbar-collapse {
        background: rgba(44, 44, 44, 0.95); /* Ensure consistent background */
        z-index: 1001; /* Ensure navbar collapse is above other elements */
    }
}

@media (max-width: 576px) {
    :root {
        --header-height: 55px;
        --border-radius: 8px;
    }

    #map {
        height: 250px !important;
        margin-bottom: 10px;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-brand img {
        height: 30px;
        margin-right: 4px;
    }

    .navbar-toggler {
        font-size: 1rem;
        padding: 0.3rem;
    }

    .navbar-nav {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        background: rgba(44, 44, 44, 0.95);
        padding: 10px 15px;
    }

    .navbar-nav .nav-link {
        padding: 6px 10px !important;
        font-size: 0.85rem;
        color: white !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-nav .nav-item.dropdown {
        width: 100%;
    }

    .navbar-nav .dropdown-toggle {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 6px 10px !important;
        font-size: 0.85rem;
    }

    .navbar-nav .dropdown-toggle .user-info {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .navbar-nav .dropdown-toggle .user-name {
        font-size: 0.85rem;
    }

    .navbar-nav .dropdown-toggle i {
        margin-right: 8px;
    }

    .dropdown-menu {
        width: 100%;
        margin: 0;
        border-radius: 6px;
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .dropdown-item {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .dropdown-menu-end {
        right: 0;
        left: auto;
    }

    .notifications-dropdown,
    .user-menu {
        width: 100%;
        max-width: none;
    }

    .notification-badge {
        padding: 3px 6px;
        font-size: 0.45rem;
        top: -6px;
        right: 0;
    }

    .main-content {
        margin: 10px;
        border-radius: 8px;
    }

    .content-header {
        padding: 15px;
    }

    .content-header h1 {
        font-size: 1.8rem;
    }

    .content-header .breadcrumb {
        font-size: 0.85rem;
        padding: 5px 0;
    }

    .content-body {
        padding: 15px;
    }

    .welcome-card {
        padding: 15px;
    }

    .welcome-title {
        font-size: 1.4rem;
    }

    .welcome-subtitle {
        font-size: 0.85rem;
    }

    .welcome-stats .quick-stat {
        margin: 5px;
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        font-size: 1.4rem;
    }

    .stat-content .stat-number {
        font-size: 1.8rem;
    }

    .stat-content .stat-label {
        font-size: 0.85rem;
    }

    .chart-card, .activity-card, .orders-card {
        padding: 12px;
    }

    .chart-title, .activity-title, .orders-title {
        font-size: 1.2rem;
    }

    .card-body canvas {
        height: 250px !important;
    }

    .activity-timeline {
        padding-left: 12px;
    }

    .activity-item {
        margin-bottom: 10px;
    }

    .activity-dot {
        left: -16px;
        width: 6px;
        height: 6px;
    }

    .activity-content {
        padding: 6px 8px;
        margin-left: 6px;
        font-size: 0.9rem;
    }

    .table-modern th, .table-modern td {
        padding: 8px;
        font-size: 0.85rem;
    }

    .table-modern th {
        white-space: nowrap;
    }

    .btn-modern {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .btn {
        width: 100%;
        margin-top: 10px;
    }

    .btn-action {
        margin-right: 0;
        margin-bottom: 5px;
    }

    .alert {
        padding: 0.8rem 1.2rem;
        font-size: 0.85rem;
        top: calc(var(--header-height) + 5px);
        right: 10px;
    }

    .main-footer {
        padding: 1rem 0;
        font-size: 0.85rem;
    }

    .scroll-top-btn {
        width: 40px;
        height: 40px;
        bottom: 10px;
        right: 10px;
    }

    .loading-spinner {
        transform: translate(-50%, -50%) scale(0.8);
    }

    .loading-text {
        font-size: 0.9rem;
        margin-top: 0.8rem;
    }

    .status-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .dropdown-header {
        font-size: 0.9rem;
    }

    .dropdown-header .user-details {
        font-size: 0.85rem;
    }

    .avatar {
        width: 100px;
        height: 100px;
    }

    .avatar-edit {
        width: 30px;
        height: 30px;
        bottom: 6px;
        right: 6px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-title {
        font-size: 1.2rem;
    }

    .modal-body .img-thumbnail {
        max-width: 150px;
    }

    .modal-footer .btn {
        padding: 0.3rem 1rem;
        font-size: 0.85rem;
    }

    .modal-cart-clear {
        max-width: 90%;
    }

    .modal-cart-clear .modal-body {
        padding: 1.5rem;
    }

    .modal-cart-clear .modal-body i {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }

    .modal-cart-clear .modal-body p {
        font-size: 1rem;
    }

    .modal-cart-clear .modal-footer {
        padding: 0.8rem 1.5rem 1.5rem;
    }

    .modal-cart-clear .btn-confirm,
    .modal-cart-clear .btn-cancel {
        min-width: 100px;
        font-size: 0.9rem;
    }

    .card {
        margin-bottom: 10px;
    }

    .card-header {
        padding: 10px;
        font-size: 0.9rem;
    }

    .card-body {
        padding: 12px;
    }

    .form-control {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }

    .col-form-label {
        font-size: 0.85rem;
    }

    .list-group-item {
        padding: 8px 0;
        font-size: 0.9rem;
    }

    .list-group-item i {
        font-size: 0.9rem;
    }

    .badge {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .product-info {
        padding: 1rem;
    }

    .product-info h5 {
        font-size: 1.1rem;
    }

    .product-description {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .product-price {
        font-size: 1.1rem;
    }
}

@media (min-width: 993px) {
    .sidebar-toggle {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

.toast {
    max-width: 350px;
    overflow: hidden;
    font-size: 0.875rem;
    background-color: rgba(255, 255, 255, 0.85);
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    opacity: 0;
    border-radius: 0.25rem;
}

.toast.show {
    opacity: 1;
}