/* ===================================================================
   ASSETS/SUIVI_DAI.CSS (v1.0.0)
   Refonte UI/UX 2026 - Thème Disqualification (Prudence).
   Basé sur le Design System établi.
=================================================================== */

/* 1. Design System & Variables (Adaptation Thématique) */
:root {
    /* Palette : Bleu nuit conservé, Accentuation Ambre/Orange pour la vigilance */
    --sd-primary: #0a3d62;      /* Bleu nuit profond (Institutionnel) */
    --sd-accent: #f59e0b;       /* Ambre dynamique (Attention/Prudence) */
    --sd-success: #28a745;
    --sd-danger: #dc3545;       /* Rouge pour les lignes DAI */
    --sd-bg: #f0f4f8;           /* Arrière-plan très clair "nuage" */
    --sd-surface: #ffffff;
    --sd-text: #1e293b;
    --sd-text-secondary: #64748b;
    --sd-border: #e2e8f0;
    --sd-font-family: 'Inter', 'Roboto', 'Helvetica Neue', sans-serif;

    /* Espacements et Rayons (Identiques) */
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px;
}

/* 2. Reset & Styles Globaux */
body {
    background-color: var(--sd-bg);
    font-family: var(--sd-font-family);
    color: var(--sd-text);
    line-height: 1.6;
}

main.container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
}

/* Composant Carte */
.sd-app-card {
    background: var(--sd-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 35px rgba(10, 61, 98, 0.08);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--sd-border);
}

@media (min-width: 992px) {
    .sd-app-card {
        padding: var(--space-lg);
    }
}

/* 3. Typographie & En-tête */
h1, h2, h3 {
    color: var(--sd-primary);
    font-weight: 800;
    line-height: 1.2;
}

.intro h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    text-align: center;
    margin-bottom: 0.5rem;
}

.intro .update-info {
    text-align: center;
    color: var(--sd-text-secondary);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

.intro p {
    font-size: 1.05rem;
    max-width: 900px;
    margin: 0 auto var(--space-md) auto;
    text-align: center;
    color: var(--sd-text-secondary);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
}

h3 {
    font-size: 1.4rem;
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

.section-description {
    color: var(--sd-text-secondary);
    margin-bottom: var(--space-lg);
}

/* Barre de statistiques globales (Nouveau composant) */
.global-stats-bar {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
    background-color: var(--sd-bg);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--sd-border);
}
.global-stats-bar div {
    text-align: center;
}
.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--sd-text-secondary);
    font-weight: 500;
}
.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--sd-primary);
}
.stat-value.highlight {
    color: var(--sd-accent);
}

/* 4. Navigation Interne (Pills Modernes) */
.page-menu {
    margin-bottom: var(--space-lg);
}
.page-menu ul {
    list-style: none; margin: 0; padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.page-menu a {
    text-decoration: none;
    color: var(--sd-primary);
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    background-color: rgba(10, 61, 98, 0.07);
    display: flex;
    align-items: center;
}
.page-menu a:hover {
    background-color: var(--sd-primary);
    color: #fff;
    transform: translateY(-2px);
}

/* 5. Onglets (Tabs) pour les classements */
.nav-pills .nav-link {
    color: var(--sd-primary);
    background-color: var(--sd-bg);
    margin-right: var(--space-sm);
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff;
    background-color: var(--sd-primary);
}

/* 6. Formulaire de Filtres (Ergonomie et Esthétique) */
@media (min-width: 992px) {
    .sticky-lg-top {
        top: 100px; /* Ajuster si hauteur header change */
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding-right: var(--space-sm);
    }
}

.filter-group {
    margin-bottom: var(--space-md);
}

.filter-group label, legend {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--sd-primary);
    display: block;
}

.filter-group .form-select,
.filter-group .form-control {
    border-radius: var(--radius-sm);
    border-color: var(--sd-border);
    padding: 0.75rem 1rem;
    min-height: 50px;
}

/* Focus state adapté à la nouvelle couleur d'accent (Ambre) */
.filter-group .form-select:focus,
.filter-group .form-control:focus {
    border-color: var(--sd-accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.filter-group.actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* 7. Intégration Choices.js (Adapté à l'accent Ambre) */
.choices { margin-bottom: 0; }
.choices__inner {
    background-color: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    min-height: 50px;
    font-size: 1rem;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: var(--sd-accent) !important;
}

.choices.is-focused .choices__inner {
     box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.choices__list--multiple .choices__item {
    background-color: var(--sd-accent);
    border-color: var(--sd-accent);
    color: white;
    border-radius: var(--radius-sm);
}

.choices__list--dropdown, .choices__list[aria-expanded] {
    background-color: var(--sd-surface);
    border-color: var(--sd-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 20px rgba(10, 61, 98, 0.1);
    z-index: 10;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: var(--sd-bg);
}

/* 8. DataTables Styling */
table.dataTable {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0;
}

/* En-têtes de tableau */
table.dataTable thead th {
    background-color: var(--sd-primary);
    color: #fff;
    border-bottom: 3px solid var(--sd-accent) !important;
    font-weight: 700;
    text-align: center;
    padding: 1rem !important;
}

/* Corps du tableau */
table.dataTable tbody td {
    padding: 0.75rem 1rem !important;
    vertical-align: middle;
    text-align: center;
    border-bottom: 1px solid var(--sd-border) !important;
}

/* Alignement à gauche pour les noms */
#JockeyTable tbody td:first-child,
#TrainerTable tbody td:first-child,
#HippodromeTable tbody td:first-child {
    text-align: left;
}

/* Effet de survol (utilisant l'accent Ambre) */
table.dataTable tbody tr:hover {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

/* Style spécifique pour le tableau de résultats personnalisés */
#statsCustomTable tbody tr {
    font-weight: 700;
    font-size: 1.05rem;
}

/* Style pour les lignes DAI dans la modale (Nouveau) */
#modalRecordsTable tbody tr.is-dai {
    background-color: rgba(220, 53, 69, 0.15) !important;
    color: var(--sd-danger);
    font-weight: 500;
}
#modalRecordsTable tbody tr.is-dai:hover {
     background-color: rgba(220, 53, 69, 0.25) !important;
}

/* 9. Correction DataTables Responsive Icon (SOLUTION ULTIME SVG) */
body table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
body table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    content: '' !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    /* SVG : Cercle bleu nuit (#0a3d62) avec un '+' blanc */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle fill='%230a3d62' cx='12' cy='12' r='11'/%3E%3Cpath stroke='%23ffffff' stroke-width='3' stroke-linecap='round' d='M12 8v8M8 12h8'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: contain !important;
    width: 22px !important; height: 22px !important;
    top: 50% !important; left: 10px !important;
    transform: translateY(-50%) !important;
    transition: transform 0.3s ease;
}

body table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
body table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
    /* SVG : Cercle gris (#64748b) avec un '-' blanc */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle fill='%2364748b' cx='12' cy='12' r='11'/%3E%3Cpath stroke='%23ffffff' stroke-width='3' stroke-linecap='round' d='M8 12h8'/%3E%3C/svg%3E") !important;
}

/* 10. Modal */
.modal-content { border-radius: var(--radius-lg); border: none; }
.modal-header { background-color: var(--sd-primary); color: #fff; }
.modal-header .btn-close { filter: invert(1); }

/* 11. Utilitaires Bootstrap Overrides (Boutons) */
.btn-primary {
    background-color: var(--sd-primary);
    border-color: var(--sd-primary);
}
.btn-primary:hover {
    background-color: #08314f;
    border-color: #08314f;
}
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: transform 0.1s ease-in-out;
}
.btn:hover {
    transform: translateY(-1px);
}
