/* ==========================================================================
   Table Swipe Pagination - Style similaire à Android Compose Pager
   ========================================================================== */

/* Conteneur de pagination pour mobile */
.table-swipe-container {
    display: none;
}

@media (max-width: 768px) {
    /* Cacher le tableau classique en mobile */
    .table-container > .table,
    .table-container .table-responsive,
    .table-container .table-responsive > .table {
        display: none !important;
    }
    
    /* Afficher le conteneur swipe */
    .table-swipe-container {
        display: block !important;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        overflow: hidden;
        margin-bottom: 1rem;
    }
    
    /* Conteneur de pagination horizontal */
    .swipe-pager {
        position: relative;
        width: 100%;
        overflow: hidden;
        touch-action: pan-x;
    }
    
    /* Wrapper pour les pages (items) */
    .swipe-pages {
        display: flex;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform;
    }
    
    /* Chaque page = un item complet */
    .swipe-page {
        min-width: 100%;
        flex-shrink: 0;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        background: white;
    }
    
    /* Page d'un item avec toutes les infos */
    .swipe-item-page {
        padding: 0;
        overflow-y: auto;
        max-height: calc(100vh - 200px);
    }
    
    /* Header de l'item */
    .swipe-item-header {
        background: linear-gradient(135deg, #28a745, #20c997);
        padding: 1.5rem 1.25rem;
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .swipe-item-title {
        font-size: 1.35rem;
        font-weight: 700;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
    }
    
    .swipe-item-title i {
        font-size: 1.5rem;
    }
    
    .swipe-item-badge {
        padding: 0.375rem 0.875rem;
        border-radius: 20px;
        font-size: 0.8125rem;
        font-weight: 600;
        white-space: nowrap;
    }
    
    .swipe-item-badge.badge-deleted {
        background: rgba(255, 255, 255, 0.25);
        border: 1px solid rgba(255, 255, 255, 0.5);
    }
    
    /* Contenu de l'item */
    .swipe-item-content {
        padding: 1.5rem 1.25rem;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        flex: 1;
        justify-content: space-between;
    }
    
    /* Section dans l'item */
    .swipe-item-section {
        border-radius: 12px;
        border: 1px solid #e9ecef;
    }
    
    /* Section ville simplifiée */
    .swipe-city-section {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        padding: 1.5rem;
        text-align: center;
    }
    
    .swipe-city-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
    }
    
    .swipe-city-content i {
        font-size: 1.75rem;
        color: #28a745;
    }
    
    .swipe-city-name {
        font-size: 1.25rem;
        font-weight: 700;
        color: #495057;
    }
    
    /* Section info générique */
    .swipe-info-section {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        padding: 1.25rem;
    }
    
    .swipe-info-content {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    .swipe-info-content i {
        font-size: 1.5rem;
        color: #28a745;
        flex-shrink: 0;
    }
    
    .swipe-info-text {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        flex: 1;
    }
    
    .swipe-info-label {
        font-size: 0.75rem;
        color: #6c757d;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .swipe-info-value {
        font-size: 1.1rem;
        color: #212529;
        font-weight: 700;
    }
    
    /* Section actions */
    .swipe-actions-section {
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
        border: 2px solid #e9ecef;
        padding: 1.25rem;
    }
    
    .swipe-actions-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
        margin-top: 0.5rem;
    }
    
    /* Compteur d'items (ex: 1/5) */
    .swipe-item-counter {
        position: absolute;
        bottom: 1rem;
        right: 1rem;
        background: rgba(0, 0, 0, 0.6);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 20px;
        font-size: 0.8125rem;
        font-weight: 600;
        z-index: 5;
        pointer-events: none;
    }
    
    .swipe-item-page {
        position: relative;
    }
    
    .swipe-action-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem;
        border-radius: 10px;
        text-decoration: none;
        transition: all 0.3s ease;
        border: 2px solid transparent;
        min-height: 100px;
        cursor: pointer;
        border: none;
        font-family: inherit;
        font-size: inherit;
    }
    
    .swipe-action-btn i {
        font-size: 1.5rem;
    }
    
    .swipe-action-btn span {
        font-size: 0.8125rem;
        font-weight: 600;
    }
    
    .swipe-action-btn.btn-primary {
        background: linear-gradient(135deg, #007bff, #0056b3);
        color: white;
        border-color: #007bff;
    }
    
    .swipe-action-btn.btn-primary:hover {
        background: linear-gradient(135deg, #0056b3, #004085);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    }
    
    .swipe-action-btn.btn-secondary {
        background: linear-gradient(135deg, #6c757d, #5a6268);
        color: white;
        border-color: #6c757d;
    }
    
    .swipe-action-btn.btn-secondary:hover {
        background: linear-gradient(135deg, #5a6268, #495057);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
    }
    
    .swipe-action-btn.btn-danger {
        background: linear-gradient(135deg, #dc3545, #c82333);
        color: white;
        border-color: #dc3545;
    }
    
    .swipe-action-btn.btn-danger:hover {
        background: linear-gradient(135deg, #c82333, #bd2130);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    }
    
    .swipe-action-btn.btn-success {
        background: linear-gradient(135deg, #28a745, #20c997);
        color: white;
        border-color: #28a745;
    }
    
    .swipe-action-btn.btn-success:hover {
        background: linear-gradient(135deg, #20c997, #17a2b8);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    }
    
    .swipe-action-btn:active {
        transform: scale(0.95);
    }
    
    /* S'assurer que les formulaires dans les actions swipe sont visibles */
    .swipe-actions-grid form {
        display: contents;
    }
    
    .swipe-actions-grid button {
        width: 100%;
        height: 100%;
    }
    
    /* Indicateurs de pagination */
    .swipe-indicators {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem;
        background: #f8f9fa;
        border-top: 1px solid #e9ecef;
    }
    
    .swipe-indicator {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #dee2e6;
        transition: all 0.3s ease;
        cursor: pointer;
    }
    
    .swipe-indicator.active {
        background: #28a745;
        width: 24px;
        border-radius: 4px;
    }
    
    /* Flèches de navigation (optionnelles) */
    .swipe-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.9);
        border: 2px solid #e9ecef;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .swipe-nav:hover {
        background: white;
        border-color: #28a745;
        transform: translateY(-50%) scale(1.1);
    }
    
    .swipe-nav.prev {
        left: 0.5rem;
    }
    
    .swipe-nav.next {
        right: 0.5rem;
    }
    
    .swipe-nav:active {
        transform: translateY(-50%) scale(0.9);
    }
    
    .swipe-nav.hidden {
        display: none;
    }
    
    /* Animation de transition */
    @keyframes swipeSlide {
        from {
            opacity: 0;
            transform: translateX(20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    .swipe-page {
        animation: swipeSlide 0.3s ease-out;
    }
}

