/* === GRILLE SÉMIQUE === */

/* Wrapper général (même logique que .fleurs-wrapper / .hyperonymie-wrapper) */
.grille-wrapper {
    padding-bottom: 1rem;
}

/* Disposition : grille + sidebar */
.grille-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Bloc contenant la grille */
.grille-canvas-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem; /* pour éviter la barre de scroll collée au tableau */
}

/* Canvas de la grille */
.grille-canvas {
    position: relative;
    width: 100%;
    min-height: 300px;
    max-height: 580px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    overflow: auto;
    padding: 0.4rem;
    box-sizing: border-box;
}

.grille-corpus-label {
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
    margin-bottom: 0.35rem;
    color: #4b5563;
}

/* Le tableau s’adapte au nombre de colonnes */
.grille-table {
    border-collapse: collapse;
    width: max-content;  /* s’agrandit avec les colonnes */
    min-width: 100%;     /* mais au moins la largeur du conteneur */
    /* 🔥 Bordure extérieure globale */
    border: 1px solid #d1d5db;
}


/* Un peu d’air dans les cellules */
.grille-table th,
.grille-table td {
    border: 1px solid #d1d5db;
    padding: 0.25rem 0.5rem;
    text-align: center;
}

/* En-têtes ligne/colonne cliquables, SANS fond bleu */
.grille-table th {
    background: #f9fafb;      /* léger gris, pas bleu */
    font-weight: 600;
}

.grille-word-header,
.grille-crit-header {
    cursor: pointer;
    user-select: none;
}

.grille-word-header:hover,
.grille-crit-header:hover {
    background: #eef2ff;      /* léger survol, pas de bleu foncé */
}

/* Cellules éditables */
.grille-table-edit .grille-cell {
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Survol discret */
.grille-table-edit .grille-cell:hover {
    background: #f3f4f6;
}

/* Cellule cochée : plus de fond bleu, juste la croix en gras */
.grille-cell-checked {
    background: #ffffff;      /* 🔹 fond blanc */
    color: #111827;           /* texte sombre */
    font-weight: 700;
}


/* Sidebar : panneaux à droite */

.grille-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.grille-panel {
    border-radius: 14px;
    border: 1px solid #e5e7f0;
    background: #f9fafb;
    padding: 0.75rem 0.85rem;
}

.grille-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

/* Textareas / champs dans le panneau */

.grille-panel .field-input[type="text"],
.grille-panel textarea.field-input {
    width: 100%;
    box-sizing: border-box;
}

.grille-panel textarea.field-input {
    min-height: 70px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.grille-panel textarea.field-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
}

/* Panneau des interconnexions */

.grille-links-panel {
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7f0;
    padding: 0.5rem 0.6rem;
}

.grille-links-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.grille-links-panel ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.grille-links-panel li {
    font-size: 0.85rem;
    padding: 0.25rem 0.35rem;
    border-radius: 8px;
    cursor: pointer;
}

.grille-links-panel li:hover {
    background: #eef2ff;
}

/* Message vide dans le canvas */
.grille-canvas .muted.small {
    font-size: 0.8rem;
}

/* Responsive */

@media (max-width: 900px) {
    .grille-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .grille-canvas {
        max-height: none;
    }
}

/* Impression A4 paysage pour la grille sémique */

@media print {
    @page {
        size: A4 landscape;
        margin: 1cm;
    }

    body {
        background: #ffffff !important;
    }

    header,
    footer,
    .app-header,
    .app-footer,
    .grille-sidebar,
    .breadcrumb {
        display: none !important;
    }

    .app-main {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    #view-corpus-grille-semique {
        display: block !important;
    }

    .card,
    .grille-wrapper,
    .grille-canvas-container {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .grille-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* 🔹 Laisse la hauteur naturelle, sans scroll,
       pour que prepareGrilleTableForPrint puisse découper proprement */
    .grille-canvas {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        padding: 0.4cm !important;
    }

    /* On laisse le JS gérer la largeur via les blocs.
       Donc pas de min-width énorme ici */
    .grille-table {
        width: auto !important;
        min-width: 0 !important;
        border: 1px solid #000000;
    }

    /* Bordures bien nettes à l’impression */
    .grille-table th,
    .grille-table td {
        border: 1px solid #000000;   /* bien net */
        padding: 0.3rem 0.5rem;
    }

    /* En-têtes sans fond gris pour un rendu propre B/N */
    .grille-table th {
        background: #ffffff !important;
    }

    .grille-cell-checked {
        background: #ffffff !important;
        color: #000000 !important;
        font-weight: 700;
    }
}

.grille-corpus-label {
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

/* Cellules texte (grille) */
.grille-cell{
  padding: 6px;
  vertical-align: middle; /* ✅ centre vertical dans la cellule */
}

/* Champ texte : intégré, centré, sans bordure */
.grille-cell-input{
  width: 100%;
  min-height: 34px;
  resize: vertical;

  border: none !important;          /* ✅ pas de bordure */
  outline: none !important;         /* ✅ pas de contour focus */
  box-shadow: none !important;      /* ✅ pas d’effet */
  border-radius: 0;                 /* ✅ pas d’arrondi */
  background: transparent;          /* ✅ fond transparent */

  padding: 0;                       /* ✅ pas de padding (vrai centrage) */
  margin: 0;

  font: inherit;
  text-align: center;               /* ✅ centre horizontal */
  line-height: 1.2;
}

/* Optionnel : un tout petit “focus” discret sans bordure
   (tu peux supprimer si tu veux rien du tout) */
.grille-cell-input:focus{
  background: rgba(0,0,0,0.03);
}

/* Désactivé (mode lecture) */
.grille-cell-input:disabled{
  background: transparent;
  color: inherit;
  opacity: 1;
}

.grille-cell-preview-text{
  text-align:center;
  white-space:pre-wrap;
}
