/* ==========================================================================
   Mobile Card Component Styles
   Composant responsive pour afficher des données en mode card sur mobile
   ========================================================================== */

/* Container de la liste de cards */
.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
}

/* Card individuelle */
.mobile-card {
    background: var(--bs-card-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mobile-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Contenu de la card */
.mobile-card-content {
    position: relative;
    z-index: 2;
}

/* Champs de données */
.mobile-card-field {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-card-field:last-of-type {
    border-bottom: none;
}

.mobile-card-label {
    font-weight: 600;
    color: var(--bs-secondary, #6c757d);
    font-size: 0.875rem;
    flex-shrink: 0;
    margin-right: 1rem;
}

.mobile-card-value {
    text-align: right;
    flex-grow: 1;
    font-size: 0.9375rem;
    color: var(--bs-body-color, #212529);
}

/* Badges dans les valeurs */
.mobile-card-value.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}

/* Actions de la card */
.mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.mobile-card-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    padding: 0.5rem;
}

.mobile-card-actions .btn i {
    font-size: 1rem;
}

/* État vide */
.mobile-card-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.mobile-card-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

/* ==========================================================================
   Swipe Gestures
   ========================================================================== */

/* Card avec swipe activé */
.mobile-card-swipeable {
    touch-action: pan-y;
    cursor: grab;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-card-swipeable.swiping {
    cursor: grabbing;
    transition: none;
}

/* Indicateurs de swipe (gauche et droite) */
.mobile-card-swipe-left,
.mobile-card-swipe-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.mobile-card-swipe-left {
    left: 0;
    background: linear-gradient(to left, transparent, var(--bs-danger, #dc3545));
}

.mobile-card-swipe-right {
    right: 0;
    background: linear-gradient(to right, transparent, var(--bs-primary, #0d6efd));
}

.mobile-card-swipe-left i,
.mobile-card-swipe-right i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Afficher les indicateurs lors du swipe */
.mobile-card-swipeable.show-delete-indicator .mobile-card-swipe-left {
    opacity: 1;
}

.mobile-card-swipeable.show-edit-indicator .mobile-card-swipe-right {
    opacity: 1;
}

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

@media (min-width: 577px) and (max-width: 768px) {
    .mobile-card-list {
        gap: 0.75rem;
    }
    
    .mobile-card {
        padding: 1.25rem;
    }
    
    .mobile-card-field {
        padding: 0.625rem 0;
    }
    
    .mobile-card-label {
        font-size: 0.9375rem;
    }
    
    .mobile-card-value {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Responsive - Desktop
   Cacher les cards sur desktop si un tableau est disponible
   ========================================================================== */

@media (min-width: 769px) {
    .mobile-card-list {
        display: none;
    }
    
    /* Réafficher si classe .mobile-card-force-visible */
    .mobile-card-list.mobile-card-force-visible {
        display: flex;
    }
}

/* ==========================================================================
   Mode sombre (prefers-color-scheme) - DÉSACTIVÉ
   ========================================================================== */

/* @media (prefers-color-scheme: dark) {
    .mobile-card {
        background: var(--bs-dark, #212529);
        border-color: var(--bs-border-color-dark, #495057);
        color: var(--bs-light, #f8f9fa);
    }
    
    .mobile-card-label {
        color: var(--bs-secondary-dark, #adb5bd);
    }
    
    .mobile-card-value {
        color: var(--bs-light, #f8f9fa);
    }
    
    .mobile-card-field {
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }
    
    .mobile-card-actions {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
} */

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

/* Animation d'apparition */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-card {
    animation: fadeInUp 0.3s ease-out;
}

.mobile-card:nth-child(n) {
    animation-delay: calc(0.05s * (var(--index, 0)));
}

/* Animation de suppression */
@keyframes fadeOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.mobile-card.removing {
    animation: fadeOutRight 0.3s ease-out forwards;
}

/* ==========================================================================
   Optimisations tactiles
   ========================================================================== */

/* Zones tactiles plus grandes sur mobile */
@media (max-width: 768px) {
    .mobile-card-actions .btn {
        min-height: 44px; /* Taille minimale recommandée pour les éléments tactiles */
        padding: 0.625rem 1rem;
    }
    
    /* Désactiver le hover sur tactile */
    @media (hover: none) {
        .mobile-card:hover {
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }
    }
}

/* ==========================================================================
   Variantes de cards
   ========================================================================== */

/* Card compacte */
.mobile-card.mobile-card-compact {
    padding: 0.75rem;
}

.mobile-card.mobile-card-compact .mobile-card-field {
    padding: 0.375rem 0;
}

.mobile-card.mobile-card-compact .mobile-card-label,
.mobile-card.mobile-card-compact .mobile-card-value {
    font-size: 0.8125rem;
}

/* Card avec bordure colorée (pour indiquer un statut) */
.mobile-card.mobile-card-success {
    border-left: 4px solid var(--bs-success, #198754);
}

.mobile-card.mobile-card-warning {
    border-left: 4px solid var(--bs-warning, #ffc107);
}

.mobile-card.mobile-card-danger {
    border-left: 4px solid var(--bs-danger, #dc3545);
}

.mobile-card.mobile-card-info {
    border-left: 4px solid var(--bs-info, #0dcaf0);
}

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

/* Focus visible pour navigation clavier */
.mobile-card:focus-within {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

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

/* Texte alternatif pour swipe (lecteurs d'écran) */
.mobile-card-swipe-left::after,
.mobile-card-swipe-right::after {
    content: attr(aria-label);
    position: absolute;
    left: -9999px;
}

/* Réduire les animations pour prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-card,
    .mobile-card-swipeable {
        animation: none;
        transition: none;
    }
    
    .mobile-card-swipe-left,
    .mobile-card-swipe-right {
        transition: none;
    }
}
