/**
 * CSS unifié pour toutes les tables SmartDataTable
 * Styles centralisés pour cohérence et maintenance
 * Police normalisée pour toutes les tables
 */

/* =============================================================================
   NORMALISATION DES POLICES
   ============================================================================= */

/* Police de base pour toutes les tables */
.table,
.dataTables_wrapper,
.dataTables_wrapper table,
.comparison-table {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Police spécifique pour les en-têtes */
.dataTables_wrapper th,
.comparison-table th,
.table th {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.025em;
}

/* Police pour les cellules de données */
.dataTables_wrapper td,
.comparison-table td,
.table td {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 400;
}

/* Police monospace pour les colonnes numériques */
.dataTables_wrapper .dt-numeric-column,
.comparison-table .text-right,
.numeric-column {
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* Police pour les badges et éléments spéciaux */
.dataTables_wrapper .badge,
.comparison-table .badge {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Police pour les contrôles DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-family: inherit;
    font-size: 0.875rem;
}

/* =============================================================================
   CONTAINER RESPONSIVE
   ============================================================================= */

.table-responsive {
    overflow-x: visible !important;
    margin-bottom: 1rem;
}

/* =============================================================================
   WRAPPER DATATABLES
   ============================================================================= */

.dataTables_wrapper {
    margin-bottom: 1rem;
}

/* =============================================================================
   TABLE PRINCIPALE
   ============================================================================= */

.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* =============================================================================
   EN-TÊTES DE COLONNE
   ============================================================================= */

.dataTables_wrapper th {
    background-color: #f8f9fc;
    border-bottom: 2px solid #e3e6f0;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    white-space: normal !important;
    word-wrap: break-word;
    line-height: 1.2;
}

/* =============================================================================
   CELLULES DE DONNÉES
   ============================================================================= */

.dataTables_wrapper td {
    padding: 0.5rem 0.25rem;
    vertical-align: middle;
    border-top: 1px solid #e3e6f0;
    white-space: normal !important;
    word-wrap: break-word;
    line-height: 1.3;
}

/* =============================================================================
   ALTERNANCE DES LIGNES (STRIPE)
   ============================================================================= */

.dataTables_wrapper .odd {
    background-color: #ffffff;
}

.dataTables_wrapper .even {
    background-color: #f8f9fc;
}

.dataTables_wrapper tbody tr:hover {
    background-color: #e8f4fd !important;
}

/* =============================================================================
   COLONNE CHECKBOX
   ============================================================================= */

.dataTables_wrapper .dt-checkbox-column {
    width: 3% !important;
    text-align: center;
}

.dataTables_wrapper .dt-checkbox-column input[type="checkbox"] {
    margin: 0;
}

/* =============================================================================
   COLONNE ACTIONS
   ============================================================================= */

.dataTables_wrapper .dt-actions-column {
    width: 10% !important;
    text-align: center;
    white-space: nowrap;
}

/* =============================================================================
   CELLULES NUMÉRIQUES
   ============================================================================= */

.dataTables_wrapper .dt-numeric-column {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   BADGES ET ÉLÉMENTS SPÉCIAUX
   ============================================================================= */

.dataTables_wrapper .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

/* Pagination fixée en bas de l'écran */
.dataTables_wrapper .dataTables_paginate {
    text-align: center;
    padding: 1rem 0;
    background: white;
    border-top: 2px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Ajouter un padding en bas du wrapper pour éviter que le contenu soit caché par la pagination fixe */
.dataTables_wrapper {
    padding-bottom: 80px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.75rem;
    margin: 0 0.125rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    background: white;
    color: #495057;
    text-decoration: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* =============================================================================
   FILTRES ET RECHERCHE
   ============================================================================= */

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
    text-align: right;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_length {
    margin-bottom: 1rem;
    text-align: left;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* =============================================================================
   INFO ET STATISTIQUES
   ============================================================================= */

.dataTables_wrapper .dataTables_info {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* =============================================================================
   COMPARAISON DE TABLES
   ============================================================================= */

.comparison-table {
    font-size: 0.8rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.25rem 0.5rem;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
    .dataTables_wrapper th,
    .dataTables_wrapper td {
        padding: 0.25rem;
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dt-actions-column {
        width: 15% !important;
    }

    .dataTables_wrapper .dt-checkbox-column {
        width: 8% !important;
    }
}

/* =============================================================================
   PROCESSING INDICATOR
   ============================================================================= */

.dataTables_processing {
    opacity: 0.6 !important;
    visibility: visible !important;
    animation: none !important;
    transition: none !important;
    display: block !important;
}

/* =============================================================================
   SCROLL HORIZONTAL (DÉSACTIVÉ)
   ============================================================================= */

.dataTables_scrollBody {
    overflow-x: visible !important;
}

/* =============================================================================
   ÉTATS SPÉCIAUX
   ============================================================================= */

.dataTables_wrapper .dt-loading {
    opacity: 0.5;
}

.dataTables_wrapper .dt-empty {
    text-align: center;
    font-style: italic;
    color: #6c757d;
}

/* =============================================================================
   ANIMATIONS DÉSACTIVÉES
   ============================================================================= */

.dataTables_wrapper * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
}

/* =============================================================================
   FOCUS ACCESSIBILITY
   ============================================================================= */

.dataTables_wrapper input:focus,
.dataTables_wrapper select:focus,
.dataTables_wrapper button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* =============================================================================
   EXTENSIONS ANALYTICS (MODULES)
   ============================================================================= */

/* Score Analytics */
.analytics-score-container {
    min-width: 120px;
}

.analytics-score-container .d-flex {
    align-items: center !important;
}

.score-circle .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.score-bar {
    flex: 1;
    margin-left: 0.5rem;
}

.score-bar .progress {
    height: 6px !important;
    margin-bottom: 0;
}

/* Risque Paiement */
.payment-risk-indicator {
    min-width: 120px;
}

.payment-risk-indicator .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Segmentation Client */
.customer-segment-container {
    min-width: 100px;
}

.customer-segment-container .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Valeur Vie Client (LTV) */
.lifetime-value-container {
    min-width: 90px;
    font-weight: 600;
    color: #28a745;
}

/* État Stock */
.stock-status-container {
    min-width: 110px;
}

.stock-status-container .badge {
    font-size: 0.7rem;
    padding: 0.375rem 0.75rem;
}

/* Point de Commande */
.reorder-point-container {
    min-width: 120px;
}

.reorder-point-container .text-warning {
    font-weight: 600;
}

.reorder-point-container .text-danger {
    font-weight: 600;
}
