/*
 * Panneau de gestion de projet partagé (jalon 3) — templates/macros/project_manage.html.
 * Utilisé dans le profil (onglet « projet courant ») et sur project_detail.html.
 */
.pm-back-link {
    display: inline-flex; align-items: center; gap: var(--space-1);
    color: var(--muted); text-decoration: none; font-size: var(--text-sm); margin-bottom: var(--space-4);
}
.pm-back-link:hover { color: var(--ink); }

/* jalon 16 (retour d'Eric) : le bouton « Mettre à jour » (tout en bas du
   panneau) passe dans cette couleur dès qu'un champ du formulaire de
   propriétés a été modifié (static/js/project-manage.js#initDirtyUpdateButton),
   repère visuel qu'il reste à enregistrer. */
.pm-update-btn.is-dirty { background: var(--warn); border-color: var(--warn); }

.project-manage { margin-top: var(--space-3); }

.pm-resource-section {
    border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: var(--space-4); margin-bottom: var(--space-4);
    background: var(--surface);
}
.pm-resource-section h3 { margin-top: 0; }
.pm-resource-section:last-child { margin-bottom: 0; }
.pm-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); }
@media (max-width: 640px) { .pm-form-row { grid-template-columns: 1fr; } }

/* jalon 16 : minicarte de vue par défaut (coordonnées/zoom du projet) —
   static/js/project-minimap.js. Repère central fixe en CSS plutôt qu'un
   marqueur déplaçable : l'utilisateur déplace la carte sous la croix. */
.pm-minimap {
    position: relative; height: 220px; margin: 0 0 var(--space-4);
    border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden;
}
.pm-minimap-pin {
    position: absolute; top: 50%; left: 50%; width: 20px; height: 20px;
    margin: -10px 0 0 -10px; pointer-events: none; z-index: 1;
}
.pm-minimap-pin::before, .pm-minimap-pin::after {
    content: ''; position: absolute; background: var(--accent-strong);
}
.pm-minimap-pin::before { top: 9px; left: 0; width: 20px; height: 2px; }
.pm-minimap-pin::after { top: 0; left: 9px; width: 2px; height: 20px; }

.pm-hint { color: var(--muted); font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.pm-logo-preview { max-height: 80px; border-radius: var(--radius-md); border: 1px solid var(--line); margin: var(--space-2) 0 var(--space-4); }
.pm-public-url { margin-left: var(--space-3); font-size: var(--text-sm); color: var(--muted); }
.pm-public-url a { color: var(--accent-strong); }

.pm-members-list { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.pm-members-list li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }

.pm-search-container { position: relative; margin-bottom: var(--space-3); }
.pm-search-container input {
    width: 100%; box-sizing: border-box; font-family: var(--font-ui); font-size: var(--text-base); color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: .55rem .7rem;
}

/* jalon 20 (retour d'Eric) : le panneau « Ajouter une ressource partagée »
   ne mettait pas assez en valeur les ressources — liste plus grande, quitte
   à devenir la section la plus haute du panneau (elle vit dans son propre
   scroll interne, pas besoin de sobriété ici). */
.pm-shared-resource-section { padding-bottom: var(--space-3); }
.pm-shared-resource-list { max-height: 480px; overflow-y: auto; }
.pm-shared-resource-list li { padding: var(--space-3); }

/* jalon 20 : badges de filtre par type au-dessus de la liste partagée —
   même patron visuel que .ui-badge, mais cliquables (bouton, pas span). */
.pm-shared-type-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.pm-type-chip {
    font-family: var(--font-ui); font-size: var(--text-xs); line-height: 1;
    color: var(--muted); background: var(--surface); border: 1px solid var(--line);
    border-radius: 999px; padding: .35rem .7rem; cursor: pointer;
}
.pm-type-chip:hover { color: var(--ink); border-color: var(--accent-strong); }
.pm-type-chip.is-active { color: #fff; background: var(--accent-strong); border-color: var(--accent-strong); }

/* jalon 20 : d'où vient la ressource partagée (projet / utilisateur) */
.pm-resource-origin { font-size: var(--text-xs); color: var(--muted); }
.pm-resource-origin::before { content: '— '; }

.pm-resource-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.pm-resource-list li {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.pm-resource-info { display: flex; align-items: center; gap: var(--space-2); min-width: 0; flex-wrap: wrap; }
.pm-resource-url { font-size: var(--text-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.pm-empty { color: var(--muted); font-size: var(--text-sm); }

/* jalon Exports : boutons d'export global (GPKG / paquet QGIS), côte à côte
   quand la place le permet, empilés sinon (même logique responsive que le
   reste du panneau, pas de largeur minimale figée trop grande). */
.pm-export-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.pm-export-group-hint { margin-top: var(--space-4); }

/* jalon Exports (retour d'Eric : "on ne sait pas ce qu'il se passe") — état
   d'attente pendant la génération d'un export côté serveur
   (static/js/project-manage.js#initExportButtons). Keyframe dédié plutôt que
   de dépendre de static/css/map-shell.css (pas chargé sur profile.html /
   project_detail.html, qui utilisent tous deux ce même panneau). */
.pm-export-btn.is-loading { position: relative; pointer-events: none; opacity: .75; }
.pm-export-btn.is-loading::after {
    content: ''; width: 12px; height: 12px; margin-left: var(--space-2);
    border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent;
    display: inline-block; vertical-align: -2px; animation: pm-export-spin .7s linear infinite;
}
@keyframes pm-export-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pm-export-btn.is-loading::after { animation: none; } }

.pm-basemaps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-4); }
.pm-basemap-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; }
.pm-basemap-item:hover { background: var(--accent-soft); }

/* jalon 17 : liste des couches cliquables (popup), repliée sous la case
   maître enable_popup — même grille que pm-basemaps-grid ci-dessus. */
.pm-popup-layers { margin: var(--space-3) 0 0; padding-left: var(--space-4); border-left: 2px solid var(--line); }
.pm-popup-layers .pm-hint { margin-bottom: var(--space-2); }
.pm-popup-layers .pm-basemaps-grid { margin-bottom: 0; }

/* jalon 9n : champ d'exagération grisé (lecture seule) quand la 3D est
   désactivée pour le projet — cf. project-manage.js#initTerrain3DToggle. */
.field.is-disabled { opacity: .5; }
.field.is-disabled input { background: var(--surface-2); cursor: not-allowed; }

/* Liens vers les sources parcourues dans le profil (macro external_sources) */
.pm-external-sources .hint { display: block; margin-bottom: var(--space-2); font-size: var(--text-xs); color: var(--muted); }
.pm-external-links { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* « Mes données PTM » (static/js/ptmdata.js) : dépôts PTM Data groupés par jeu,
   une ligne par couche — même patron que la liste des ressources partagées. */
.pm-ptmdata-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.pm-ptmdata-deposit { font-size: var(--text-sm); font-weight: 600; color: var(--accent-strong); text-decoration: none; }
.pm-ptmdata-deposit:hover { text-decoration: underline; }
.pm-ptmdata-toolbar { display: flex; flex-direction: column; gap: var(--space-2); }
.pm-ptmdata-scope { display: flex; gap: var(--space-2); }
.pm-ptmdata-list { max-height: 480px; overflow-y: auto; }
.pm-ptmdata-list li.pm-ptmdata-ds { display: block; padding: var(--space-3); }
.pm-ptmdata-ds-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.pm-ptmdata-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.pm-ptmdata-title:hover { color: var(--accent-strong); text-decoration: underline; }
.pm-ptmdata-note { margin: 0 0 var(--space-2); font-size: var(--text-xs); color: var(--muted); }
.pm-ptmdata-layer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.pm-ptmdata-actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.pm-ptmdata-project { font: inherit; font-size: var(--text-sm); padding: .35rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); max-width: 200px; }
