/**
 * Enseignant Tables - Styles communs pour les tables de données
 *
 * Ce fichier centralise les styles des tables utilisées dans les pages enseignant
 * pour éviter la duplication de CSS inline dans chaque fichier blade.
 *
 * @author ProGRES Team
 * @version 1.0.0
 */

/* ============================================
   TABLE BASE STYLES
   ============================================ */

.enseignant-table {
    font-family: 'Roboto', Arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
    background-color: #fff;
}

.enseignant-table th,
.enseignant-table td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 10px 12px;
    vertical-align: middle;
}

.enseignant-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-bottom-width: 2px;
}

.enseignant-table tr:nth-child(even) {
    background-color: #f5f5f5;
}

.enseignant-table tr:hover {
    background-color: #e9ecef;
}

/* ============================================
   TABLE RESPONSIVE WRAPPER
   ============================================ */

.table-responsive-enseignant {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Auto-responsive pour toutes les tables dans bloc-resume */
.bloc-resume > div:not(.titre),
.bloc-resume .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   ACTION COLUMNS (Modifier/Supprimer)
   ============================================ */

.enseignant-table .col-actions,
.bloc-resume table .col-actions {
    width: 50px;
    text-align: center;
    white-space: nowrap;
}

.enseignant-table .col-actions .btn,
.bloc-resume table .col-actions .btn {
    padding: 4px 8px;
    font-size: 14px;
}

/* En-têtes d'action avec icônes */
.bloc-resume table th.col-action-edit,
.bloc-resume table th.col-action-delete {
    width: 45px;
    text-align: center;
    padding: 8px 4px;
}

/* Icônes dans les en-têtes */
.bloc-resume table th .fa {
    font-size: 14px;
}

/* Tooltip pour les en-têtes d'action */
.bloc-resume table th[title] {
    cursor: help;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.table-empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.table-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.table-empty-state p {
    margin: 0;
    font-style: italic;
}

/* ============================================
   LEGACY SUPPORT - Styles pour les anciennes tables
   Ces styles permettent la rétrocompatibilité avec
   les tables existantes qui n'utilisent pas encore
   les nouvelles classes.
   ============================================ */

.bloc-resume table {
    font-family: 'Roboto', Arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
    background-color: #fff;
}

.bloc-resume table th,
.bloc-resume table td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 10px 12px;
    vertical-align: middle;
}

.bloc-resume table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-bottom-width: 2px;
}

.bloc-resume table tr:nth-child(even) {
    background-color: #f5f5f5;
}

.bloc-resume table tr:hover {
    background-color: #e9ecef;
}

/* ============================================
   TAB LOADING STATES
   ============================================ */

.tab-loader {
    padding: 3rem 1rem;
}

.tab-loader .spinner-border {
    color: #28a745 !important; /* Vert - Design System */
}

/* ============================================
   SECTION TITLES
   ============================================ */

.bloc-resume .titre {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    /* J'ai commenté */
    /* border-bottom: 2px solid #28a745; */ /* Vert - Design System */
}

.bloc-resume .titre span {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */

.bloc-resume .btn-save {
    background-color: #28a745; /* Vert - Design System */
    border-color: #28a745;
    color: #fff;
}

.bloc-resume .btn-save:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: #fff;
}

.bloc-resume .btn-danger {
    background-color: #dc3545; /* Rouge - Design System */
    border-color: #dc3545;
    color: #fff;
}

.bloc-resume .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: #fff;
}

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

.bloc-resume .pagination {
    justify-content: center;
    margin-top: 1rem;
}

.bloc-resume .page-link {
    color: #333;
    border-color: #ddd;
}

.bloc-resume .page-item.active .page-link {
    background-color: #28a745; /* Vert - Design System */
    border-color: #28a745;
    color: #fff;
}

.bloc-resume .page-link:hover {
    background-color: #e9ecef;
    border-color: #ddd;
    color: #333;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .enseignant-table th,
    .enseignant-table td,
    .bloc-resume table th,
    .bloc-resume table td {
        padding: 8px;
        font-size: 0.9rem;
    }

    .bloc-resume .titre span {
        font-size: 1rem;
    }

    /* Masquer certaines colonnes sur mobile si nécessaire */
    .hide-on-mobile {
        display: none;
    }
}

/* ============================================
   LINKS IN TABLES
   ============================================ */

.enseignant-table a,
.bloc-resume table a {
    color: #28a745; /* Vert - Design System */
    text-decoration: none;
}

.enseignant-table a:hover,
.bloc-resume table a:hover {
    color: #1e7e34;
    text-decoration: underline;
}

/* ============================================
   SUBVENTIONS / CONTRATS — frise chronologique
   Onglet projets du profil enseignant.
   Palette limitée au design system : noir (+ ses
   teintes), vert pour le seul état « en cours »,
   rouge pour la seule suppression, blanc.
   ============================================ */

.grant-toolbar {
    margin-bottom: 26px;
    overflow: hidden;
}

.grant-timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 56px;
}

.grant {
    position: relative;
    padding: 0 0 26px 22px;
    border-left: 1px solid rgba(17, 17, 17, 0.16);
}

.grant:last-child {
    padding-bottom: 0;
}

/* Marqueur sur la ligne de temps : plein = subvention en cours. */
.grant::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.45);
}

.grant.is-running::before {
    background-color: #28a745; /* Vert - Design System */
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.16);
}

.grant-year {
    position: absolute;
    left: -56px;
    top: -3px;
    width: 44px;
    text-align: right;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: rgba(17, 17, 17, 0.22);
}

.grant-acronym {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(17, 17, 17, 0.45);
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grant-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 4px;
    color: #111111;
}

.grant-title a {
    color: #111111;
    text-decoration: none;
}

.grant-title a:hover,
.grant-title a:focus-visible {
    color: #111111;
    text-decoration: underline;
}

.grant-title a:focus-visible {
    outline: 2px solid #28a745;
    outline-offset: 3px;
}

.grant-desc {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(17, 17, 17, 0.62);
    margin-bottom: 6px;
}

.grant-meta {
    font-size: 12px;
    color: rgba(17, 17, 17, 0.55);
    font-variant-numeric: tabular-nums;
}

.grant-meta .sep {
    padding: 0 7px;
    color: rgba(17, 17, 17, 0.25);
}

.grant-status {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #28a745; /* Vert - Design System */
}

.grant-actions {
    position: absolute;
    right: 0;
    top: 0;
    white-space: nowrap;
}

.grant-actions .btn {
    padding: 3px 8px;
    font-size: 13px;
    opacity: 0.4;
    transition: opacity 120ms linear;
}

.grant:hover .grant-actions .btn,
.grant-actions .btn:focus-visible {
    opacity: 1;
}

.grant-has-actions {
    padding-right: 84px;
}

.grant-empty {
    padding: 34px 0;
    font-size: 13px;
    font-style: italic;
    color: rgba(17, 17, 17, 0.45);
}

@media (max-width: 640px) {
    .grant-timeline {
        padding-left: 0;
    }

    .grant {
        padding-left: 18px;
    }

    .grant-year {
        position: static;
        display: block;
        width: auto;
        text-align: left;
        font-size: 13px;
        margin-bottom: 2px;
    }

    .grant-actions {
        position: static;
        margin-top: 10px;
    }

    .grant-actions .btn {
        opacity: 1;
    }

    .grant-has-actions {
        padding-right: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .grant-actions .btn {
        transition: none;
    }
}

/* ============================================
   BADGES & STATUS
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

.status-badge.status-active {
    background-color: #28a745;
    color: #fff;
}

.status-badge.status-inactive {
    background-color: #6c757d;
    color: #fff;
}

.status-badge.status-pending {
    background-color: #ffc107;
    color: #333;
}
