/* ============================================================
   TABLEAU DYNAMIQUE V2 — CSS
   Generateur de tableau moderne pour CMS Sitecrea
   ============================================================ */

/* --- Conteneur global --- */
.tableau_v2_conteneur {
    width: 100%;
    margin: 10px 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #333;
}

/* --- Chargement --- */
.tableau_v2_chargement {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 50px;
    margin: 30px auto;
    max-width: 320px;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid #000;
    border-radius: 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

/* Loader spinner ultra moderne */
.tableau_v2_loader_spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    position: relative;
    animation: tableau_v2_spin 0.9s linear infinite;
}
.tableau_v2_loader_spinner::before,
.tableau_v2_loader_spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}
.tableau_v2_loader_spinner::before {
    inset: 0;
    border: 3px solid rgba(255, 255, 255, 0.15);
}
.tableau_v2_loader_spinner::after {
    inset: 0;
    border: 3px solid transparent;
    border-top-color: #fff;
    border-right-color: rgba(255, 255, 255, 0.6);
}

@keyframes tableau_v2_spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Barre d infos (nb resultats + selecteur par page) --- */
.tableau_v2_info_bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f5f7fa;
    border: 1px solid #dce1e8;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    color: #666;
}
.tableau_v2_info_bar_total {
    font-weight: bold;
    color: #333;
}
/* Bleu-sarcelle, et non vert : dans la convention du back-office le vert designe la CREATION
   (bouton "ajouter"). Un export ne cree rien, il sort de la donnee du systeme -- il partage donc
   sa teinte avec le bouton d action "exporter" ci-dessous. Etait #27ae60 (vert) jusqu au
   18/08/2026, ce que la relecture visuelle du 17/08 a releve comme contredisant l action. */
.tableau_v2_btn_csv {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #138d75;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s;
}
.tableau_v2_btn_csv:hover {
    background: #0e6b5a;
}
.tableau_v2_btn_csv svg {
    width: 14px;
    height: 14px;
}
.tableau_v2_select_par_page {
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
    width: auto;
    max-width: 70px;
}
.tableau_v2_select_par_page:focus {
    outline: none;
    border-color: #3498db;
}

/* --- Table principale --- */
.tableau_v2_table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #dce1e8;
    background: #fff;
}

/* --- En-tete --- */
.tableau_v2_entete {
    background: #2d323e;
}
.tableau_v2_th {
    padding: 10px 8px 8px 8px;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    text-align: left;
    vertical-align: top;
    border-right: 1px solid #3d4250;
}
.tableau_v2_th:last-child {
    border-right: none;
}
.tableau_v2_th_contenu {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin-bottom: 4px;
    min-height: 20px;
    white-space: nowrap;
}
.tableau_v2_th_actions {
    width: 1%;
    white-space: nowrap;
}

/* --- Boutons de tri --- */
.tableau_v2_btn_trie {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.4;
    font-size: 11px;
    transition: opacity 0.2s, background 0.2s;
    user-select: none;
}
.tableau_v2_btn_trie:hover {
    opacity: 0.8;
    background: rgba(255,255,255,0.15);
}
.tableau_v2_btn_trie_actif {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 1;
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    user-select: none;
}
.tableau_v2_btn_trie_actif:hover {
    background: rgba(255,255,255,0.3);
}

/* --- Champ de recherche dans le header --- */
.tableau_v2_entete input.tableau_v2_champ_recherche,
.tableau_v2_entete input.tableau_v2_champ_recherche[type="text"] {
    width: 100% !important;
    box-sizing: border-box;
    padding: 2px 6px !important;
    height: 24px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 4px;
    font-size: 12px !important;
    font-family: Arial, Helvetica, sans-serif;
    background: rgba(255,255,255,0.12) !important;
    color: #fff !important;
    outline: none;
    text-align: left !important;
    transition: background 0.2s, border-color 0.2s;
}
.tableau_v2_entete input.tableau_v2_champ_recherche::placeholder {
    color: rgba(255,255,255,0.35);
}
.tableau_v2_entete input.tableau_v2_champ_recherche:focus {
    background: rgba(255,255,255,0.12) !important;
    border-color: rgba(255,255,255,0.4) !important;
}

/* --- Lignes du tableau --- */
.tableau_v2_ligne_paire {
    background: #fff;
    transition: background 0.15s;
}
.tableau_v2_ligne_impaire {
    background: #f8f9fb;
    transition: background 0.15s;
}
.tableau_v2_ligne_paire:hover,
.tableau_v2_ligne_impaire:hover {
    background: #e3f2fd;
}

/* --- Cellules --- */
.tableau_v2_cellule {
    padding: 6px 10px;
    border-bottom: 1px solid #eaedf2;
    border-right: 1px solid #eaedf2;
    text-align: left;
    font-size: 13px;
    vertical-align: middle;
}
.tableau_v2_cellule:last-child {
    border-right: none;
}
.tableau_v2_cellule_actions {
    white-space: nowrap;
    padding: 4px 6px;
}
.tableau_v2_cellule_actions {
    text-align: center;
}
.tableau_v2_btn_action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    vertical-align: middle;
    margin: 0 2px;
}
.tableau_v2_btn_action:hover {
    transform: scale(1.12);
}
.tableau_v2_btn_action svg {
    width: 16px;
    height: 16px;
}
.tableau_v2_btn_action_modifier {
    background: #e8f4fd;
    color: #2980b9;
}
.tableau_v2_btn_action_modifier:hover {
    background: #d0e9f9;
}
.tableau_v2_btn_action_supprimer {
    background: #fde8e8;
    color: #c0392b;
}
.tableau_v2_btn_action_supprimer:hover {
    background: #f9d0d0;
}
.tableau_v2_btn_action_voir {
    background: #e8fde8;
    color: #27ae60;
}
.tableau_v2_btn_action_voir:hover {
    background: #d0f9d0;
}
.tableau_v2_btn_action_profil {
    background: #f0e8fd;
    color: #7d3c98;
}
.tableau_v2_btn_action_profil:hover {
    background: #e0d0f9;
}
/* Bleu-sarcelle, comme le bouton d export CSV en tete de tableau : meme geste, meme teinte.
   Etait un jaune/dore (#b7950b) qui n appartenait a aucune convention du back-office. */
.tableau_v2_btn_action_exporter {
    background: #e8f8f5;
    color: #117a65;
}
.tableau_v2_btn_action_exporter:hover {
    background: #d0f0ea;
}
/* Le telechargement d un document existant se distingue de l export d une donnee : indigo,
   assez loin du bleu ciel de "modifier" et du sarcelle de "exporter" pour ne pas s y confondre.
   Ce type n avait AUCUNE couleur avant le 18/08/2026 : son bouton sortait sans fond, seul de son
   espece dans la colonne, ce qui se lisait comme un bouton desactive. */
.tableau_v2_btn_action_telecharger {
    background: #eceef8;
    color: #3f51b5;
}
.tableau_v2_btn_action_telecharger:hover {
    background: #dde1f2;
}
/* Copier au presse-papier ne modifie rien : gris neutre, volontairement discret. Ce type non
   plus n avait pas de couleur avant le 18/08/2026. */
.tableau_v2_btn_action_copier {
    background: #eef0f2;
    color: #5d6d7e;
}
.tableau_v2_btn_action_copier:hover {
    background: #e0e4e8;
}
.tableau_v2_btn_action_simuler {
    background: #e8f8fd;
    color: #1a5276;
}
.tableau_v2_btn_action_simuler:hover {
    background: #d0eef9;
}
.tableau_v2_btn_action_decaler {
    background: #e8e8fd;
    color: #4a4a8a;
}
.tableau_v2_btn_action_decaler:hover {
    background: #d0d0f9;
}
.tableau_v2_btn_action_activer {
    background: #d4edda;
    color: #155724;
}
.tableau_v2_btn_action_activer:hover {
    background: #c3e6cb;
}
.tableau_v2_btn_action_desactiver {
    background: #f8d7da;
    color: #721c24;
}
.tableau_v2_btn_action_desactiver:hover {
    background: #f1b0b7;
}
.tableau_v2_btn_action_envoyer {
    background: #e8f0fd;
    color: #2c3e80;
}
.tableau_v2_btn_action_envoyer:hover {
    background: #d0e0f9;
}
.tableau_v2_btn_action_pdf {
    background: #fde8e8;
    color: #b71c1c;
}
.tableau_v2_btn_action_pdf:hover {
    background: #f9d0d0;
}
.tableau_v2_btn_action_categorie {
    background: #fdf0e8;
    color: #b45309;
}
.tableau_v2_btn_action_categorie:hover {
    background: #f9e0d0;
}
.tableau_v2_btn_action_check {
    background: #d4edda;
    color: #155724;
}
.tableau_v2_btn_action_check:hover {
    background: #c3e6cb;
}
.tableau_v2_btn_action_uncheck {
    background: #f0f0f0;
    color: #6c757d;
}
.tableau_v2_btn_action_uncheck:hover {
    background: #e0e0e0;
}
.tableau_v2_btn_action_paye {
    background: #d4edda;
    color: #155724;
}
.tableau_v2_btn_action_paye:hover {
    background: #c3e6cb;
}
.tableau_v2_btn_action_impaye {
    background: #fff3cd;
    color: #856404;
}
.tableau_v2_btn_action_impaye:hover {
    background: #ffeaa0;
}
.tableau_v2_btn_action_mute {
    background: #f0f0f0;
    color: #6c757d;
}
.tableau_v2_btn_action_mute:hover {
    background: #e0e0e0;
}
.tableau_v2_btn_action_declare {
    background: #e0f2f1;
    color: #00695c;
}
.tableau_v2_btn_action_declare:hover {
    background: #b2dfdb;
}
.tableau_v2_btn_action_archiver {
    background: #e8e8fd;
    color: #4a4a8a;
}
.tableau_v2_btn_action_archiver:hover {
    background: #d0d0f9;
}
.tableau_v2_btn_action_desarchiver {
    background: #fdf5e8;
    color: #7d6608;
}
.tableau_v2_btn_action_desarchiver:hover {
    background: #f9ecd0;
}
.tableau_v2_btn_action_facture {
    background: #e8f0fd;
    color: #1a5276;
}
.tableau_v2_btn_action_facture:hover {
    background: #d0e0f9;
}
.tableau_v2_btn_action_cagnotte {
    background: #fdf0e8;
    color: #b7950b;
}
.tableau_v2_btn_action_cagnotte:hover {
    background: #f9e0d0;
}
.tableau_v2_btn_action_commande {
    background: #e8fdf0;
    color: #1e8449;
}
.tableau_v2_btn_action_commande:hover {
    background: #d0f9e0;
}
.tableau_v2_btn_action_csv {
    background: #e8fde8;
    color: #1e7e34;
}
.tableau_v2_btn_action_csv:hover {
    background: #d0f9d0;
}
.tableau_v2_btn_action_dupliquer {
    background: #f0e8fd;
    color: #6c3483;
}
.tableau_v2_btn_action_dupliquer:hover {
    background: #e0d0f9;
}
.tableau_v2_btn_action_partager {
    background: #e8f4fd;
    color: #2471a3;
}
.tableau_v2_btn_action_partager:hover {
    background: #d0e9f9;
}
.tableau_v2_btn_action_popup {
    background: #f0f0f5;
    color: #5b5b8a;
}
.tableau_v2_btn_action_popup:hover {
    background: #e0e0ef;
}
.tableau_v2_btn_action_tableau {
    background: #e8e8fd;
    color: #4a4a8a;
}
.tableau_v2_btn_action_tableau:hover {
    background: #d0d0f9;
}
.tableau_v2_btn_action_veille {
    background: #fdf5e8;
    color: #7d6608;
}
.tableau_v2_btn_action_veille:hover {
    background: #f9ecd0;
}
.tableau_v2_btn_action_power_on {
    background: #d4edda;
    color: #155724;
}
.tableau_v2_btn_action_power_on:hover {
    background: #c3e6cb;
}
.tableau_v2_btn_action_power_off {
    background: #f8d7da;
    color: #721c24;
}
.tableau_v2_btn_action_power_off:hover {
    background: #f1b0b7;
}
.tableau_v2_btn_action_passe_droit {
    background: #fdf0e8;
    color: #935116;
}
.tableau_v2_btn_action_passe_droit:hover {
    background: #f9e0d0;
}
.tableau_v2_btn_action_passe_droit_off {
    background: #f0f0f0;
    color: #6c757d;
}
.tableau_v2_btn_action_passe_droit_off:hover {
    background: #e0e0e0;
}

/* --- Lien cliquable dans les cellules --- */
.tableau_v2_lien {
    color: #2980b9;
    text-decoration: none;
    word-break: break-all;
}
.tableau_v2_lien:hover {
    text-decoration: underline;
    color: #1a5276;
}

/* --- Images dans le tableau --- */
.tableau_v2_image {
    max-height: 50px;
    max-width: 80px;
    border-radius: 3px;
}

/* --- Badges booleens --- */
.tableau_v2_badge_oui {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    background: #d4edda;
    color: #155724;
    font-size: 12px;
    font-weight: bold;
}
.tableau_v2_badge_non {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    background: #f8d7da;
    color: #721c24;
    font-size: 12px;
    font-weight: bold;
}

/* --- Etat vide --- */
.tableau_v2_vide {
    padding: 30px;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 14px;
}

/* --- Erreur --- */
.tableau_v2_erreur {
    padding: 20px;
    text-align: center;
    color: #c0392b;
    background: #fdf0ef;
    border: 1px solid #e6b0aa;
    border-radius: 6px;
    margin: 10px 0;
}

/* --- Pagination --- */
.tableau_v2_pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: #f5f7fa;
    border: 1px solid #dce1e8;
    border-top: none;
    border-radius: 0 0 6px 6px;
}
.tableau_v2_page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #dce1e8;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.tableau_v2_page:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}
.tableau_v2_page_active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #2d323e;
    border-radius: 4px;
    background: #2d323e;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: default;
    user-select: none;
}
.tableau_v2_page_desactive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #f5f5f5;
    color: #ccc;
    font-size: 13px;
    cursor: default;
    user-select: none;
}

/* --- Drag-Drop --- */
.tableau_v2_ligne_draggable {
    cursor: grab;
}
.tableau_v2_ligne_draggable:active {
    cursor: grabbing;
}
.tableau_v2_ligne_drag_active {
    opacity: 0.4;
    background: #e3f2fd !important;
}
.tableau_v2_ligne_drag_over {
    border-top: 3px solid #1976d2 !important;
}

/* --- Image dans tableau (grandes) --- */
.image_dans_tab_big {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
}

/* ============================================================
   COLONNE ACTIONS — bouton libelle et menu « ... » nomme
   ------------------------------------------------------------
   Repond a la relecture visuelle qui signalait, en majeur, que plusieurs pictogrammes
   (chaine, avion papier, fleche vers le haut) ne se comprennent pas sans connaitre l outil.
   Les pictogrammes universels (crayon, corbeille, oeil) restent nus ; le reste est nomme.
   Le partage est fait en JS, voir ACTIONS_PICTOGRAMME_EVIDENT dans tableau_dynamique_v2.js.
   ============================================================ */

/* --- Bouton libelle en ligne (une seule action a nommer) --- */
.tableau_v2_btn_action_libelle {
    width: auto;
    padding: 0 10px 0 8px;
    gap: 6px;
}
.tableau_v2_btn_action_texte {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* --- Bouton « ... » --- */
.tableau_v2_menu_actions {
    display: inline-block;
    vertical-align: middle;
}
.tableau_v2_btn_action_menu {
    background: #eef1f4;
    color: #4a5560;
}
.tableau_v2_btn_action_menu:hover {
    background: #dfe4e9;
}
.tableau_v2_btn_action_menu[aria-expanded="true"] {
    background: #d4dae0;
    color: #23303c;
}

/* --- Liste deroulante ---
   Elle est POSITIONNEE EN JS, en position fixe : une position absolue serait rognee par le
   premier ancetre a defilement, et ce sont justement les dernieres lignes du tableau qui
   ouvrent leur menu vers le bas. Le z-index passe au-dessus du cadre du back-office. */
.tableau_v2_menu_actions_liste {
    display: none;
    position: fixed;
    z-index: 10000;
    min-width: 200px;
    max-width: 320px;
    padding: 6px;
    background: #fff;
    border: 1px solid #dfe4e9;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 32, 45, 0.16);
    text-align: left;
}
.tableau_v2_menu_actions_liste.tableau_v2_menu_ouvert {
    display: block;
}
.tableau_v2_menu_actions_item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.3;
    color: #23303c;
    white-space: normal;   /* la cellule est en nowrap : un libelle long doit pouvoir revenir a la ligne */
}
.tableau_v2_menu_actions_item:hover,
.tableau_v2_menu_actions_item:focus {
    background: #f2f5f8;
}
.tableau_v2_menu_actions_icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: #eef1f4;
    color: #4a5560;
}
.tableau_v2_menu_actions_icone svg {
    width: 14px;
    height: 14px;
}
.tableau_v2_menu_actions_texte {
    flex: 1 1 auto;
}

/* Les actions destructrices gardent leur teinte, dans le menu comme dehors : c est le seul
   repere qui doit rester visible sans lire. */
.tableau_v2_menu_actions_item_supprimer .tableau_v2_menu_actions_icone {
    background: #fde8e8;
    color: #c0392b;
}
.tableau_v2_menu_actions_item_supprimer:hover {
    background: #fdf3f3;
}

/* --- Telephone --- */
@media (max-width: 700px) {
    .tableau_v2_menu_actions_liste {
        min-width: 180px;
        max-width: calc(100vw - 24px);
    }
    .tableau_v2_menu_actions_item {
        padding: 11px 10px;   /* cible tactile : 44 px de haut avec la ligne de texte */
    }
}
