:root {
    --cp-primary: #2C5F8D;
    --cp-secondary: #E8B84D;
    --cp-accent: #C44536;
    --cp-bg-light: #F8F9FA;
    --cp-border: #DDE1E6;
    --cp-text: #2D3748;
    --cp-text-light: #718096;
}

/* Wrapper global tableau + filtres + header */
.cp-table-wrapper {
    max-width: 1200px;
    margin: 0 auto 1.5rem;
}

.cp-header-ligne {
    display: flex;
    align-items: stretch;   /* les 3 blocs ont la même hauteur visuelle */
    gap: 1rem;
    margin: 1.5rem 0;
}

/* Bouton gauche – on ne change pas le style, juste on s'assure qu'il ne s'étire pas trop */
.cp-open-add-modal {
    flex: 0 0 auto;
    min-width: 220px;
    padding: 0.9rem 1.5rem;
    background: #ffffff;
    color: #234a6d;
    border: 2px solid #234a6d;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.cp-open-add-modal:hover {
    background: #234a6d;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

/* Filtres = bloc central qui prend toute la place disponible */
.cp-filtres {
    flex: 1 1 auto;               /* prend tout l'espace entre le bouton et le compteur */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 1rem 1.5rem;
    background: var(--cp-bg-light);
    border-radius: 8px;
    border: 1px solid var(--cp-border);
}
.cp-filtres select {
    flex: 1 1 200px;
    min-width: 180px;
    padding: 0.5rem 0.75rem;
}

/* Compteur à droite – largeur fixe */
.cp-resultats-info {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, var(--cp-primary) 0%, #3d7ab8 100%);
    color: white;
    border-radius: 8px;
    font-size: 1rem;          /* même taille que le bouton */
    font-weight: 600;         /* même poids que le bouton */
    box-shadow: 0 2px 8px rgba(44, 95, 141, 0.15);
}
.cp-resultats-info strong {
    font-size: 1rem;          /* même taille que le reste */
    font-weight: 700;         /* un tout petit peu plus gras si tu veux garder l’accent */
    margin-right: 0.35rem;
}



/* Tableau */
.cp-table-profs {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.cp-table-profs thead {
    background: linear-gradient(135deg, var(--cp-primary) 0%, #3d7ab8 100%);
    color: white;
}
.cp-table-profs th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 3px solid var(--cp-secondary);
}
.cp-table-profs td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--cp-border);
    color: var(--cp-text);
    font-size: 0.95rem;
}
.cp-table-profs tbody tr {
    transition: background-color 0.15s ease;
}
.cp-table-profs tbody tr:hover {
    background: #f7fafc;
}
.cp-table-profs tbody tr:last-child td {
    border-bottom: none;
}
.cp-table-profs td:first-child {
    font-weight: 600;
    color: var(--cp-primary);
}

/* Pagination */
.cp-pagination {
    margin: 3rem 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cp-pagination a,
.cp-pagination .cp-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.75rem;
    text-decoration: none;
    color: var(--cp-text);
    background: white;
    border: 2px solid var(--cp-border);
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.cp-pagination a:hover:not(.active) {
    background: var(--cp-bg-light);
    border-color: var(--cp-primary);
    color: var(--cp-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.cp-pagination a.active {
    background: var(--cp-primary);
    color: white;
    border-color: var(--cp-primary);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(44, 95, 141, 0.3);
}
.cp-pagination .cp-prev,
.cp-pagination .cp-next {
    padding: 0 1.25rem;
    font-weight: 600;
    background: var(--cp-secondary);
    color: var(--cp-text);
    border-color: var(--cp-secondary);
}
.cp-pagination .cp-prev:hover,
.cp-pagination .cp-next:hover {
    background: #d4a43d;
    border-color: #d4a43d;
    color: white;
}
.cp-pagination .cp-ellipsis {
    border: none;
    background: transparent;
    color: var(--cp-text-light);
    cursor: default;
    font-weight: 700;
}

/* Formulaire (ajout / modification) */
.cp-form-ajout {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.cp-form-ajout h3 {
    margin-bottom: 1rem;
    color: var(--cp-primary);
}
.cp-form-ajout label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--cp-text);
}
.cp-form-ajout input[type="text"],
.cp-form-ajout select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--cp-border);
    border-radius: 6px;
    transition: border-color 0.2s ease;
}
.cp-form-ajout input[type="text"]:focus,
.cp-form-ajout select:focus {
    outline: none;
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(44, 95, 141, 0.1);
}
.cp-form-ajout button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background: var(--cp-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cp-form-ajout button[type="submit"]:hover {
    background: #234a6d;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(44, 95, 141, 0.3);
}

/* Modals */
.cp-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}
.cp-modal-visible {
    display: block;
}
.cp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}
.cp-modal-content {
    position: relative;
    max-width: 420px;
    margin: 10vh auto;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    text-align: center;
}
.cp-modal-content h2 {
    margin-bottom: 1rem;
    color: var(--cp-primary);
}
.cp-modal-close,
.cp-modal-close-secondary {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: var(--cp-primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}
.cp-modal-close:hover,
.cp-modal-close-secondary:hover {
    background: #234a6d;
}

/* Accessibilité & responsive */
@media (max-width: 768px) {
    .cp-header-ligne {
        flex-direction: column;
        align-items: stretch;
    }

    .cp-open-add-modal,
    .cp-filtres,
    .cp-resultats-info {
        width: 100%;
    }

    .cp-filtres {
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0.75rem;   /* encore un peu moins haut */
        gap: 0.4rem;
    }

    .cp-filtres select {
        width: 100%;
        min-width: 0;
        padding: 0.35rem 0.6rem;   /* selects plus fins sur mobile */
        font-size: 0.9rem;
    }

    .cp-table-profs {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cp-pagination {
        gap: 0.25rem;
    }

    .cp-pagination a,
    .cp-pagination .cp-ellipsis {
        min-width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .cp-table-profs th,
    .cp-table-profs td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.cp-filtres select:focus-visible,
.cp-filtres button:focus-visible,
.cp-pagination a:focus-visible {
    outline: 3px solid var(--cp-secondary);
    outline-offset: 2px;
}
