/* ═══════════════════════════════════════════════════════════════════
   DTISoft — Entreprise → Gestion image : logo de l'entreprise  (namespace `gi-`)
   Réponses du 2026-10-28, équipe X4a-logo — js/modules/gestion-image.js.

   z-index 10500 : s'ouvre depuis la barre de menus, donc potentiellement
   par-dessus une fiche (≤ 9600), le détail de stock (10001) ou les Options
   (10000) ; reste SOUS la fenêtre Historique (au- 10600, ouverte depuis ce
   bouton « Historique »), les fenêtres des fiches techniques (ft- 10650+),
   DTIDialog (20000) et le verrou de session.
   ═══════════════════════════════════════════════════════════════════ */

/* Garde-fou § 7.41 : `[hidden]` perd contre toute classe qui déclare `display`. */
.gi-overlay [hidden] { display: none; }

.gi-overlay {
    position: fixed; inset: 0; z-index: 10500;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gi-box {
    background: #fff; border-radius: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
    width: 820px; max-width: 100%; max-height: 90vh; outline: none;
    display: flex; flex-direction: column; font-size: 13px; color: #1e293b;
}
.gi-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid #e5e7eb;
    background: #f8fafc; border-radius: 10px 10px 0 0;
}
.gi-title { font-weight: 600; font-size: 14px; flex: 1 1 auto; min-width: 0; }
.gi-title i { color: #2563eb; margin-right: 3px; }
.gi-close {
    border: 0; background: transparent; font-size: 24px; line-height: 1;
    color: #94a3b8; cursor: pointer; padding: 0 4px; flex: 0 0 auto;
}
.gi-close:hover { color: #ef4444; }

.gi-body { overflow: auto; padding: 14px 16px; flex: 1 1 auto; min-height: 0; }
.gi-foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 16px; border-top: 1px solid #e5e7eb; background: #f8fafc;
    border-radius: 0 0 10px 10px;
}
.gi-msg { flex: 1 1 200px; min-width: 0; font-size: 12px; color: #475569; }
.gi-msg--ok { color: #15803d; }
.gi-msg--err { color: #b91c1c; }
.gi-msg--avert { color: #b45309; }
.gi-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Bandeaux ───────────────────────────────────────────────────── */
.gi-note, .gi-info {
    margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: #475569;
    background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 7px; padding: 8px 11px;
}
.gi-ro, .gi-avert {
    margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: #92400e;
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 7px; padding: 8px 11px;
}
.gi-avert { margin-top: 12px; margin-bottom: 0; }
.gi-info { margin-top: 12px; margin-bottom: 0; }
.gi-vide { padding: 28px 10px; text-align: center; color: #64748b; }
.gi-vide--err { color: #b91c1c; }

/* ── Aperçus : actuel | nouveau ─────────────────────────────────── */
.gi-zone { display: flex; gap: 16px; flex-wrap: wrap; }
.gi-col { flex: 1 1 300px; min-width: 0; }
.gi-col-titre { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: #334155; }
.gi-col--nouveau .gi-col-titre { color: #1d4ed8; }
/* Damier : rend visible la transparence d'un PNG (fond des fiches = blanc). */
.gi-cadre {
    height: 170px; border: 1px solid #e2e8f0; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden;
    background-color: #fff;
    background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%), linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f1f5f9 75%), linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.gi-col--nouveau .gi-cadre { border-color: #93c5fd; box-shadow: 0 0 0 2px #dbeafe; }
.gi-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.gi-cadre-vide { color: #64748b; font-size: 12px; text-align: center; background: rgba(255, 255, 255, .85); padding: 6px 10px; border-radius: 6px; }
.gi-infos { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 8px 0 0; font-size: 12px; }
.gi-infos dt { color: #64748b; }
.gi-infos dd { margin: 0; overflow-wrap: anywhere; }

/* ── Boutons ────────────────────────────────────────────────────── */
.gi-btn {
    border: 1px solid #cbd5e1; background: #fff; color: #1e293b; border-radius: 6px;
    padding: 6px 12px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.gi-btn:hover:not(:disabled) { background: #f1f5f9; }
.gi-btn:disabled { opacity: .55; cursor: default; }
.gi-btn--prim { background: #2563eb; border-color: #2563eb; color: #fff; }
.gi-btn--prim:hover:not(:disabled) { background: #1d4ed8; }
.gi-btn--danger { color: #b91c1c; border-color: #fecaca; }
.gi-btn--danger:hover:not(:disabled) { background: #fef2f2; }
.gi-fichier { display: none; }

@media (max-width: 600px) {
    .gi-overlay { padding: 8px; }
    .gi-cadre { height: 130px; }
}
