/* ============================================
   TABLE MANAGER - Styles
   ============================================ */

/* Conteneur principal des contrôles */
.table-controls {
    margin-bottom: 1.5rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.table-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Barre de recherche */
.table-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.table-search {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.table-search:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.search-icon {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}

/* Sélecteur de nombre d'éléments par page */
.table-perpage-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-perpage-wrapper label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.table-perpage {
    padding: 0.6rem 2rem 0.6rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
}

.table-perpage:hover {
    border-color: #4a9eff;
}

.table-perpage:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

/* Indicateurs de tri dans les en-têtes */
.admin-table thead th.sortable {
    user-select: none;
    position: relative;
    padding-right: 2rem;
}

.admin-table thead th.sortable:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sort-indicator {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sort-indicator.active {
    opacity: 1;
    color: #4a9eff;
    font-weight: bold;
}

/* Informations de pagination */
.table-pagination-info {
    margin-top: 1rem;
    padding: 0.8rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

/* Contrôles de pagination */
.table-pagination-controls {
    margin-top: 1rem;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.9rem;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
}

.pagination-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #4a9eff;
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
    font-weight: bold;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0.5rem;
    color: #999;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .table-controls-top {
        flex-direction: column;
        align-items: stretch;
    }

    .table-search-wrapper {
        min-width: 100%;
    }

    .table-perpage-wrapper {
        justify-content: space-between;
    }

    .pagination-buttons {
        gap: 0.3rem;
    }

    .pagination-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .pagination-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        min-width: 30px;
    }

    .table-pagination-info {
        font-size: 0.85rem;
    }
}

/* Animation pour le chargement */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-table tbody tr {
    animation: fadeIn 0.3s ease;
}

/* Amélioration visuelle du tableau */
.table-responsive {
    position: relative;
}

.admin-table tbody tr:hover {
    background-color: rgba(74, 158, 255, 0.05);
}

/* États de focus améliorés pour l'accessibilité */
.pagination-btn:focus,
.table-search:focus,
.table-perpage:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

/* Style pour le message "Aucun résultat" */
.admin-table tbody tr td[colspan] {
    font-style: italic;
    background-color: #f8f9fa;
}
