/* ==========================================================================
   Mobile Drawer Component Styles
   Drawer/Modal responsive pour mobile (filtres, menus, etc.)
   ========================================================================== */

/* Overlay */
.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.mobile-drawer-overlay-visible {
    opacity: 1;
    visibility: visible;
}

/* Drawer principal */
.mobile-drawer {
    position: fixed;
    background: var(--bs-body-bg, #fff);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
}

/* Positions du drawer */
.mobile-drawer-bottom {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(100%);
}

.mobile-drawer-bottom.mobile-drawer-visible {
    transform: translateY(0);
}

.mobile-drawer-left {
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    border-radius: 0 1rem 1rem 0;
    transform: translateX(-100%);
}

.mobile-drawer-left.mobile-drawer-visible {
    transform: translateX(0);
}

.mobile-drawer-right {
    top: 0;
    right: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    border-radius: 1rem 0 0 1rem;
    transform: translateX(100%);
}

.mobile-drawer-right.mobile-drawer-visible {
    transform: translateX(0);
}

/* Header du drawer */
.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    flex-shrink: 0;
}

.mobile-drawer-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--bs-body-color, #212529);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-drawer-title i {
    font-size: 1rem;
    color: var(--bs-primary, #0d6efd);
}

.mobile-drawer-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--bs-secondary, #6c757d);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

.mobile-drawer-close:hover {
    color: var(--bs-body-color, #212529);
    background: var(--bs-light, #f8f9fa);
}

.mobile-drawer-close i {
    font-size: 1.25rem;
}

/* Body du drawer */
.mobile-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Footer du drawer (pour les boutons d'action) */
.mobile-drawer-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    flex-shrink: 0;
}

.mobile-drawer-footer .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.mobile-drawer-footer .btn i {
    font-size: 1rem;
}

/* ==========================================================================
   Contenu spécifique - Filtres
   ========================================================================== */

.mobile-drawer-body .form-group,
.mobile-drawer-body .mb-3 {
    margin-bottom: 1.25rem;
}

.mobile-drawer-body label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.9375rem;
}

.mobile-drawer-body .form-control,
.mobile-drawer-body .form-select {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

/* Améliorer les zones tactiles */
.mobile-drawer-body input[type="text"],
.mobile-drawer-body input[type="date"],
.mobile-drawer-body select {
    min-height: 48px; /* Taille minimale recommandée pour tactile */
}

/* ==========================================================================
   Indicateur de swipe (pour fermer en glissant vers le bas)
   ========================================================================== */

.mobile-drawer-bottom::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--bs-border-color, #dee2e6);
    border-radius: 2px;
}

/* ==========================================================================
   Responsive - Tablette
   ========================================================================== */

@media (min-width: 577px) and (max-width: 768px) {
    .mobile-drawer-left,
    .mobile-drawer-right {
        width: 70%;
        max-width: 400px;
    }
    
    .mobile-drawer-bottom {
        max-height: 75vh;
    }
    
    .mobile-drawer-header {
        padding: 1.5rem 2rem;
    }
    
    .mobile-drawer-body {
        padding: 2rem;
    }
    
    .mobile-drawer-footer {
        padding: 1.25rem 2rem;
    }
}

/* ==========================================================================
   Responsive - Desktop
   Comportement modal classique sur grand écran
   ========================================================================== */

@media (min-width: 769px) {
    /* Le drawer devient un modal centré sur desktop */
    .mobile-drawer {
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
        max-width: 500px;
        width: 90%;
        max-height: 80vh;
        border-radius: 0.75rem;
    }
    
    .mobile-drawer.mobile-drawer-visible {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    
    .mobile-drawer-bottom::before {
        display: none;
    }
}

/* ==========================================================================
   Mode sombre - DÉSACTIVÉ
   ========================================================================== */

/* @media (prefers-color-scheme: dark) {
    .mobile-drawer {
        background: var(--bs-dark, #212529);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5);
    }
    
    .mobile-drawer-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .mobile-drawer-header,
    .mobile-drawer-footer {
        border-color: var(--bs-border-color-dark, #495057);
    }
    
    .mobile-drawer-title {
        color: var(--bs-light, #f8f9fa);
    }
    
    .mobile-drawer-close {
        color: var(--bs-secondary-dark, #adb5bd);
    }
    
    .mobile-drawer-close:hover {
        color: var(--bs-light, #f8f9fa);
        background: var(--bs-dark-dark, #1a1d20);
    }
    
    .mobile-drawer-bottom::before {
        background: var(--bs-border-color-dark, #495057);
    }
} */

/* ==========================================================================
   Animations
   ========================================================================== */

/* Animation du backdrop */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mobile-drawer-overlay-visible {
    animation: fadeIn 0.3s ease;
}

/* Animation du drawer bottom */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.mobile-drawer-bottom.mobile-drawer-visible {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Accessibilité
   ========================================================================== */

/* Focus visible */
.mobile-drawer-close:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.mobile-drawer-footer .btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Réduire les animations pour prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-drawer,
    .mobile-drawer-overlay {
        transition: none;
        animation: none;
    }
    
    .mobile-drawer-visible {
        animation: none;
    }
}

/* ==========================================================================
   Support swipe to dismiss (optionnel)
   ========================================================================== */

.mobile-drawer[data-swipeable="true"] {
    touch-action: pan-y;
}

.mobile-drawer.swiping {
    transition: none;
}

/* ==========================================================================
   Variantes
   ========================================================================== */

/* Drawer compact (hauteur réduite) */
.mobile-drawer-compact.mobile-drawer-bottom {
    max-height: 50vh;
}

/* Drawer full screen */
.mobile-drawer-fullscreen {
    max-height: 100vh !important;
    border-radius: 0 !important;
}

.mobile-drawer-fullscreen.mobile-drawer-bottom {
    border-radius: 0 !important;
}
