/* metadata_display v1.6 */

/* ── Bouton ──────────────────────────────────────────────── */
#metadisplay_btn.metadisplay-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Overlay ─────────────────────────────────────────────── */
.metadisplay-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99998;
}

/* ── Modale ──────────────────────────────────────────────── */
.metadisplay-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.4);
  z-index: 99999;
  width: 720px;
  max-width: 94vw;
  max-height: 88vh;
  min-width: 420px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
  font-size: 13px;
}

/* Désactive la sélection de texte pendant drag/resize */
.metadisplay-no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* ── En-tête (draggable) ─────────────────────────────────── */
.metadisplay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #ddd;
  background: #f7f7f7;
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
  /* cursor: move est positionné par JS */
}

.metadisplay-title {
  font-weight: bold;
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metadisplay-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer !important;  /* override le cursor:move du header */
  color: #666;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.metadisplay-close:hover { color: #000; }

/* ── Barre d'onglets (fixe, ne scrolle pas) ─────────────── */
.metadisplay-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 14px 0;
  border-bottom: 2px solid #ddd;
  background: #f4f4f4;
  flex-shrink: 0;
}

.metadisplay-tab-btn {
  padding: 6px 13px;
  border: 1px solid #ccc;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: #e8e8e8;
  color: #666;
  cursor: pointer;
  font-size: 0.87em;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  position: relative;
  bottom: -2px;
}
.metadisplay-tab-btn:hover  { background: #fff; color: #333; }
.metadisplay-tab-btn.active { background: #fff; color: #222; font-weight: 600; border-color: #ddd; border-bottom-color: #fff; }

/* ── Corps scrollable ────────────────────────────────────── */
.metadisplay-body {
  overflow-y: auto;
  flex: 1;
}

/* ── Contenus d'onglets ──────────────────────────────────── */
.metadisplay-tab-content {
  display: none;
  padding: 12px 14px;
  animation: metadisplay-fadein 0.15s ease;
}
.metadisplay-tab-content.active { display: block; }

@keyframes metadisplay-fadein {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Barre de recherche ──────────────────────────────────── */
.metadisplay-search-bar {
  margin-bottom: 10px;
}

.metadisplay-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 98% center;
  transition: border-color 0.15s;
}
.metadisplay-search:focus { border-color: #2a6099; box-shadow: 0 0 0 2px rgba(42, 96, 153, 0.15); }

/* ── Accordéons ──────────────────────────────────────────── */
.metadisplay-accordion {
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  margin-bottom: 8px;
  overflow: hidden;
}

.metadisplay-accordion-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #eef0f3;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  transition: background 0.15s;
}
.metadisplay-accordion-title:hover     { background: #e2e5ea; }
.metadisplay-accordion-title.collapsed { background: #f4f4f4; color: #888; font-weight: normal; }

.metadisplay-accordion-content {
  padding: 4px 0;
  border-top: 1px solid #e8e8e8;
}

/* ── Chevron rotatif ─────────────────────────────────────── */
.metadisplay-chevron {
  display: inline-block;
  font-size: 10px;
  transition: transform 0.18s ease;
  transform: rotate(0deg);
  color: #999;
  flex-shrink: 0;
}
.metadisplay-chevron.open { transform: rotate(90deg); }

/* ── Tableau clé / valeur ────────────────────────────────── */
.metadisplay-table {
  width: 100%;
  border-collapse: collapse;
}
.metadisplay-table tr:nth-child(even) { background: #f9f9f9; }

.metadisplay-key {
  padding: 4px 10px;
  width: 38%;
  font-weight: 600;
  color: #555;
  vertical-align: top;
  white-space: nowrap;
  border-right: 1px solid #eee;
}
.metadisplay-val {
  padding: 4px 10px;
  color: #222;
  word-break: break-all;
}

/* ── Tableau XMP structuré ───────────────────────────────── */
.metadisplay-xmp-struct tr:nth-child(odd)  { background: #fff; }
.metadisplay-xmp-struct tr:nth-child(even) { background: #f9f9f9; }

.metadisplay-xmp-header th {
  padding: 5px 10px;
  background: #e8edf3;
  font-weight: 600;
  font-size: 11px;
  color: #444;
  text-align: left;
  border-bottom: 1px solid #d0d6de;
  text-transform: none;
  letter-spacing: 0;
}
.metadisplay-xmp-key {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11.5px !important;
  font-weight: normal !important;
  color: #2a5080 !important;
  white-space: nowrap;
}

/* ── Géolocalisation ─────────────────────────────────────── */
.metadisplay-decimal { color: #999; font-size: 11px; }

.metadisplay-gps-links { padding: 6px 10px 8px; display: flex; gap: 12px; }

.metadisplay-map-link {
  display: inline-block;
  padding: 4px 10px;
  background: #2a6099;
  color: #fff !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.metadisplay-map-link:hover { background: #1d4a73; }

/* ── Visages tagués ──────────────────────────────────────── */
.metadisplay-faces-header th {
  padding: 4px 10px;
  background: #e8edf3;
  font-weight: 600;
  font-size: 11px;
  color: #444;
  text-align: left;
  border-bottom: 1px solid #d0d6de;
}
.metadisplay-face-name { padding: 5px 10px; font-weight: 600; color: #2a6099; white-space: nowrap; }
.metadisplay-faces tr:nth-child(even) { background: #f9f9f9; }
.metadisplay-faces tr:hover           { background: #eef3fa; }

/* ── XMP brut ────────────────────────────────────────────── */
.metadisplay-xmp {
  background: #f4f4f4;
  padding: 10px 12px;
  font-size: 10px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
}

/* ── Message "aucune donnée" ─────────────────────────────── */
.metadisplay-empty { color: #999; font-style: italic; padding: 6px 12px; margin: 0; }

/* ── Pied de modale (export) ─────────────────────────────── */
.metadisplay-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #ddd;
  background: #f7f7f7;
  border-radius: 0 0 8px 8px;
  flex-shrink: 0;
}

.metadisplay-export-label {
  font-size: 11px;
  color: #888;
  margin-right: 2px;
}

.metadisplay-export-btn {
  padding: 4px 11px;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  color: #444;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.metadisplay-export-btn:hover { background: #e8edf3; border-color: #2a6099; color: #2a6099; }

/* ── Poignée de redimensionnement ────────────────────────── */
.metadisplay-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: se-resize;
  border-radius: 0 0 8px 0;
}
.metadisplay-resize-handle::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #bbb;
  border-bottom: 2px solid #bbb;
}