body {
    background-color: #f8f9fa;
}

main {
    margin-top: 2em;
}

.dashboard-card {
    margin-top: 1em !important;
}

/* Style pour les formulaires */
input::placeholder {
    color: #ccc !important;
}
textarea::placeholder {
    color: #ccc !important;
}

/* Styles pour les avatars */
.avatar {
    transition: transform 0.2s ease-in-out;
}

.avatar:hover {
    transform: scale(1.05);
}

.avatar-initials {
    /* font-weight: 600; */
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Amélioration des cartes */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease-in-out;
}

/* Amélioration des boutons */
.btn {
    transition: all 0.15s ease-in-out;
}

/* Amélioration de la navigation */
.navbar-brand {
    font-weight: 600;
}

/* Navigation utilisateur */
.navbar-nav .dropdown-toggle {
    white-space: nowrap;
}

.navbar-nav .dropdown-toggle .avatar-inline {
    display: inline-flex;
    align-items: center;
}

.navbar-nav .dropdown-toggle .avatar-inline .me-2 {
    margin-right: 0.5rem !important;
}

/* Responsive pour les avatars */
@media (max-width: 768px) {
    .avatar-large {
        width: 60px !important;
        height: 60px !important;
    }
    
    .avatar-medium {
        width: 40px !important;
        height: 40px !important;
    }
    
    .avatar-small {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Styles pour l'autocomplétion des références */
.reference-autocomplete .dropdown-menu {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
}

.reference-autocomplete .dropdown-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.reference-autocomplete .dropdown-item:last-child {
    border-bottom: none;
}

.reference-autocomplete .dropdown-item:hover,
.reference-autocomplete .dropdown-item.active {
    background-color: #e9ecef;
}

.reference-autocomplete .dropdown-item .fw-bold {
    color: #0d6efd;
    font-size: 0.9rem;
}

.reference-autocomplete .dropdown-item .text-muted {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.reference-autocomplete .dropdown-item .badge {
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

/* Tom Select */
.ts-control {
    border: none;
    font-size: 15px !important;
    padding: 0 !important;
}
.ts-wrapper.multi .ts-control > div {
    background-color: green !important;
    color: white !important;
    border-radius: 0.375rem !important;
}

/* Responsive pour les en-têtes de pages de détail */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin-bottom: 0;
    flex: 1;
    min-width: 0; /* Permet au titre de se rétrécir */
}

.page-header .btn-group {
    flex-shrink: 0;
}

/* Breakpoint pour passer en mode vertical plus tôt */
@media (max-width: 992px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .page-header .btn-group {
        width: 100%;
        justify-content: flex-start;
    }
    
    .page-header .btn-group .btn {
        flex: 1;
        min-width: 0;
    }
}

/* Pour les très petits écrans */
@media (max-width: 576px) {
    .page-header .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .page-header .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .page-header .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* Amélioration des modales sur mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        border-top: 1px solid #dee2e6;
    }
    
    .btn-close {
        padding: 0.5rem;
        margin: -0.5rem -0.5rem -0.5rem auto;
    }
}

/* Correction pour iOS */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal {
    -webkit-overflow-scrolling: touch;
}

/* Empêcher le scroll du body quand la modal est ouverte */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* Corrections spécifiques pour iOS */
@supports (-webkit-touch-callout: none) {
    .modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 1055 !important;
    }
    
    .modal-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 1050 !important;
    }
    
    .modal-dialog {
        position: relative !important;
        width: auto !important;
        margin: 0.5rem !important;
        pointer-events: none !important;
    }
    
    .modal-content {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        pointer-events: auto !important;
        background-color: #fff !important;
        background-clip: padding-box !important;
        border: 1px solid rgba(0,0,0,.2) !important;
        border-radius: 0.3rem !important;
        outline: 0 !important;
    }
    
    body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* Modal personnalisée pour iOS */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    -webkit-overflow-scrolling: touch;
}

.custom-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.custom-modal-content {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-modal-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-modal-body {
    padding: 1rem;
}

.custom-modal-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .custom-modal.show {
        padding: 0.5rem;
    }
    
    .custom-modal-content {
        max-width: 100%;
        margin: 0;
    }
}

/* Optimisation des listes de définitions sur mobile */
@media (max-width: 575.98px) {
    .dl-compact dt {
        float: left;
        width: 40%;
        clear: left;
        text-align: right;
        padding-right: 0.5rem;
        margin-bottom: 0.25rem;
    }
    
    .dl-compact dd {
        float: left;
        width: 60%;
        margin-left: 0;
        margin-bottom: 0.25rem;
        padding-left: 0.5rem;
    }
    
    .dl-compact::after {
        content: "";
        display: table;
        clear: both;
    }
    
    /* Gestion spécifique pour les prestations (col-sm-4/col-sm-8) */
    .dl-compact dt.col-sm-4 {
        width: 35%;
    }
    
    .dl-compact dd.col-sm-8 {
        width: 65%;
    }
}

/* Style pour le menu principal */
.navbar.bg-primary {
    background-color: #2a3f53 !important;
}
/* .navbar-brand {
    color: #000 !important;
}
.nav-link {
    color: #666 !important;
} */

/* Footer collé en bas de page */

.footer .container {
    max-width: 1200px;
}

/* Ajustement pour les pages avec contenu court */
.min-vh-100 {
    min-height: 100vh;
}

/* Espacement pour le contenu principal */
main {
    margin-top: 2em;
    padding-bottom: 2em;
}

/* Footer collé en bas de page */
.footer {
    background-color: #2a3f53 !important;
    border-top: 1px solid #dee2e6;
    color: #f8f9fa !important;
}

.footer .container {
    max-width: 1200px;
}

/* Ajustement pour les pages avec contenu court */
.min-vh-100 {
    min-height: 100vh;
}

/* Espacement pour le contenu principal */
main {
    margin-top: 2em;
    padding-bottom: 2em;
}

/* Cartes cliquables du dashboard */
.clickable-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #dee2e6;
}

.clickable-card:hover .card-title {
    color: #0d6efd !important;
}

.clickable-card:hover .text-primary {
    color: #0a58ca !important;
}

.clickable-card:hover .text-success {
    color: #198754 !important;
}

/* Supprimer le soulignement des liens */
.clickable-card a {
    text-decoration: none !important;
}

/* Style pour les cartes du dashboard */
.dashboard-card {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-card .card-body {
    padding: 2rem;
}

/* Style des alertes */
.commande-alert {
    display: none !important;
}