/* Fichier : css/registre.css */

/* --- 1. LES ONGLETS INTERNES (Global / Jour) --- */
.sub-tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.sub-tab-btn {
    padding: 8px 14px;
    border: none;
    border-bottom: 3px solid transparent;
    background-color: #e9ecef;
    color: #495057;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.sub-tab-btn:hover {
    background-color: #dee2e6;
    color: #212529;
}

/* L'onglet actif - FEEDBACK LUMINEUX */
.sub-tab-btn.active {
    background-color: #0056b3;
    color: white;
    border-bottom: 3px solid #0056b3;
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.3);
    font-weight: 700;
}

.sub-tab-btn.active:nth-of-type(2) {
    /* Pour le bouton "Réel" actif, on change la couleur */
    background-color: #0056b3;
    border-bottom: 3px solid #0056b3;
}

/* Bouton Comparer - mêmes dimensions et styles que les onglets */
.btn-comparer {
    padding: 8px 14px !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
    white-space: nowrap !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-comparer:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5) !important;
}

/* --- 2. LA ZONE DE FILTRES --- */
.filters-container {
    display: flex;
    flex-wrap: wrap; /* Revient à la ligne si pas de place */
    gap: 15px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    align-items: flex-end; /* Aligne les champs en bas */
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 3px;
    color: #495057;
}

.filter-group input, 
.filter-group select {
    padding: 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* --- 3. LE TOTAL --- */
#registre-total-container {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: right;
    margin: 10px 0;
    color: #343a40;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 4px;
}

/* --- 4. LE TABLEAU DE DONNÉES --- */
#registre-table,
#saisie-jour-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.95rem;
}

.registre-table-wrap {
    width: 100%;
    overflow-x: auto;
}

#registre-table thead,
#saisie-jour-table thead {
    background-color: #343a40;
    color: white;
}

#registre-table th, 
#registre-table td,
#saisie-jour-table th,
#saisie-jour-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

/* Effet zébré (une ligne sur deux grise) */
#registre-table tbody tr:nth-child(even),
#saisie-jour-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Effet au survol d'une ligne */
#registre-table tbody tr:hover,
#saisie-jour-table tbody tr:hover {
    background-color: #e2e6ea;
}

/* Colonnes spécifiques */
.montant-col {
    text-align: right !important; /* Montants alignés à droite */
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.text-success { color: #28a745; } /* Vert */
.text-danger { color: #dc3545; }  /* Rouge */

/* Ajout dans css/registre.css */

/* On force la police simple partout dans les tableaux */
#registre-table, 
#saisie-jour-table {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.85rem;
}

#registre-table {
    font-size: 0.8rem;
}

/* Eviter les retours a la ligne sur le registre previsionnel */
#registre-table th,
#registre-table td {
    white-space: nowrap;
    padding: 6px 8px;
}

/* Colonne Contrepartie : wrap seulement au-delà d'un seuil de largeur */
#registre-table th:nth-child(5),
#registre-table th:nth-child(6),
#registre-table th:nth-child(7) {
    white-space: nowrap;
}

#registre-table td:nth-child(5),
#registre-table td:nth-child(6),
#registre-table td:nth-child(7) {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.75rem;
    line-height: 1.2;
    max-width: 180px;
}

/* On s'assure que les entêtes et les cellules ont la même police */
#registre-table th, #registre-table td,
#saisie-jour-table th, #saisie-jour-table td {
    font-family: inherit; /* Hérite de la police du tableau */
    vertical-align: middle;
}

/* Style des boutons d'action (Crayon et Poubelle) */
.btn-action {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    margin: 0 5px;
    transition: transform 0.2s;
}

.btn-action:hover {
    transform: scale(1.2); /* Grossit un peu au survol */
}

/* --- 5. FEU VERT BO : même style que registre prévisionnel --- */
#feu-vert-bo-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.8rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    table-layout: fixed;
}

#feu-vert-bo-table thead {
    background-color: #343a40;
    color: white;
}

#feu-vert-bo-table th,
#feu-vert-bo-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
    vertical-align: middle;
    line-height: 1.2;
}

#feu-vert-bo-table th {
    font-size: 0.78rem;
    line-height: 1.1;
}

#tab-content-feu-vert .registre-table-wrap {
    overflow-x: auto;
}

#feu-vert-bo-table th:nth-child(1),
#feu-vert-bo-table td:nth-child(1) {
    width: 4%;
    text-align: center;
}

#feu-vert-bo-table th:nth-child(2),
#feu-vert-bo-table td:nth-child(2) {
    width: 4%;
}

#feu-vert-bo-table th:nth-child(3),
#feu-vert-bo-table td:nth-child(3) {
    width: 7%;
}

#feu-vert-bo-table th:nth-child(4),
#feu-vert-bo-table td:nth-child(4) {
    width: 6%;
}

#feu-vert-bo-table th:nth-child(5),
#feu-vert-bo-table td:nth-child(5) {
    width: 16%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#feu-vert-bo-table th:nth-child(6),
#feu-vert-bo-table td:nth-child(6) {
    width: 14%;
}

#feu-vert-bo-table th:nth-child(7),
#feu-vert-bo-table td:nth-child(7) {
    width: 18%;
}

#feu-vert-bo-table th:nth-child(8),
#feu-vert-bo-table td:nth-child(8) {
    width: 11%;
}

#feu-vert-bo-table th:nth-child(9),
#feu-vert-bo-table td:nth-child(9) {
    width: 10%;
}

#feu-vert-bo-table th:nth-child(10),
#feu-vert-bo-table td:nth-child(10) {
    width: 8%;
}

#feu-vert-bo-table th:nth-child(10),
#feu-vert-bo-table td:nth-child(10) {
    text-align: center;
}

#feu-vert-bo-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#feu-vert-bo-table tbody tr:hover {
    background-color: #e2e6ea;
}

#feu-vert-bo-table td:nth-child(6),
#feu-vert-bo-table td:nth-child(7) {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 0.75rem;
    line-height: 1.2;
}

#feu-vert-bo-table .btn-action {
    font-size: 0.95rem;
    margin: 0 3px;
}

@media (max-width: 1600px) {
    #feu-vert-bo-table {
        font-size: 0.76rem;
    }

    #feu-vert-bo-table th,
    #feu-vert-bo-table td {
        padding: 5px 6px;
    }

    #feu-vert-bo-table th {
        font-size: 0.74rem;
    }
}

@media (max-width: 1366px) {
    #feu-vert-bo-table {
        font-size: 0.72rem;
    }

    #feu-vert-bo-table th,
    #feu-vert-bo-table td {
        padding: 4px 5px;
    }

    #feu-vert-bo-table th {
        font-size: 0.7rem;
    }

    #feu-vert-bo-table td:nth-child(6),
    #feu-vert-bo-table td:nth-child(7) {
        font-size: 0.7rem;
    }

    #feu-vert-bo-table .btn-action {
        font-size: 0.86rem;
        margin: 0 1px;
    }
}

@media (max-width: 1280px) {
    #feu-vert-bo-table {
        min-width: 1080px;
    }
}

.feu-vert-id-link {
    background: none;
    border: none;
    color: #0d6efd;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    padding: 0;
}

.feu-vert-id-link:hover {
    color: #0a58ca;
}

#registre-table tbody tr.tx-focus-row {
    background-color: #fff3cd !important;
    transition: background-color 0.3s ease;
}