/* app.css — Réseau 1.0 (patch layout focus/topbar/explorer) */

:root{
  --bg:#ffffff;
  --text:#222;
  --muted:#666;
  --primary:#0d6efd;
  --primary-contrast:#fff;
  --secondary:#6c757d;
  --danger:#dc3545;
  --panel:#f7f7f9;
  --border:#e2e2e6;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

/* Topbar: no-wrap + align */
#topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:10px 12px; border-bottom:1px solid var(--border);
  position:sticky; top:0; background:#fff; z-index:5;
  white-space:nowrap; /* évite le retour à la ligne */
}
#topbar .left, #topbar .right{ display:flex; align-items:center; gap:8px; }
#topbar .muted{ color:var(--muted); margin-left:8px; }
.dir-group{ display:flex; gap:6px; }
.btn-toggle.active{ background:var(--primary); color:#fff; }

/* Explorer sous le topbar, sans décalage */
.explorer{
  display:flex; align-items:center; justify-content:space-between;
  gap:8px; padding:8px 12px; border-bottom:1px solid var(--border);
  background:#fafafa; position:sticky; top:48px; z-index:4;
  white-space:nowrap;
}
.focus-name{ font-weight:600; }
.sep{ margin:0 8px; color:var(--muted); }
.hidden{ display:none; }

/* Légende niveaux */
.legend-levels{
  display:flex; gap:12px; align-items:center; padding:8px 12px;
  border-bottom:1px solid var(--border); background:#fff;
  white-space:nowrap; overflow:auto;
}
.legend-item{ display:inline-flex; align-items:center; gap:6px; font-size:13px; color:#333; }
.legend-item .dot{ width:12px; height:12px; border-radius:50%; display:inline-block; }

/* Layout principal */
.with-sidebar{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:0;
  height: calc(100vh - 140px);
  min-height: 520px;
}
#sidebar{
  border-right:1px solid var(--border);
  overflow:auto; padding:12px; background:#fff;
}
.panel{
  background:var(--panel); border:1px solid var(--border);
  border-radius:8px; padding:12px; margin-bottom:12px;
}
.panel-title{ font-weight:600; margin-bottom:8px; }
.btn-row{ display:flex; gap:8px; flex-wrap:wrap; }

#graphWrap{
  position:relative; /* pour la hover-card */
  overflow:hidden;
}
#mynetwork{
  width:100%; height:100%;
  min-height: 520px;
}

#footer{
  border-top:1px solid var(--border);
  padding:8px 12px; font-size:12px; color:var(--muted);
}

/* Boutons */
button{
  cursor:pointer; border:1px solid var(--border); background:#fff; color:#222;
  border-radius:6px; padding:6px 10px; font-size:14px;
}
button:disabled{ opacity:.6; cursor:not-allowed; }
.btn-primary{ background:var(--primary); color:var(--primary-contrast); border-color:var(--primary); }
.btn-secondary{ background:#f0f2f5; }
.btn-danger{ background:var(--danger); color:#fff; border-color:var(--danger); }

/* Inputs */
input[type="text"], textarea, select, input[type="datetime-local"]{
  width:100%; padding:8px; border:1px solid var(--border); border-radius:6px;
  background:#fff; color:#222; font-size:14px;
}
.filter{ margin-bottom:6px; }
.chk{ display:flex; align-items:center; gap:8px; margin-top:6px; color:#333; }

#searchResults{ list-style:none; padding-left:0; margin:8px 0 0 0; max-height:220px; overflow:auto; }
#searchResults li{ padding:6px 8px; border:1px solid transparent; border-radius:6px; }
#searchResults li:hover{ background:#f0f2f5; cursor:pointer; }

.chips{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{
  display:inline-block; padding:6px 10px; border-radius:999px; border:1px solid var(--border);
  background:#fff; font-size:13px; cursor:pointer;
}
.chip.active{ background:#e8f1ff; border-color:#bcd6ff; color:#004ea8; }

/* Modales */
.modal{ position:fixed; inset:0; background:rgba(0,0,0,.25); display:none; z-index:20; }
.modal-content{
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width: min(720px, 92vw); max-height: 88vh; overflow:auto;
  background:#fff; border-radius:10px; border:1px solid var(--border);
  box-shadow:0 10px 30px rgba(0,0,0,.15);
}
.modal-header{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 12px; border-bottom:1px solid var(--border); background:#fff; }
.modal-header .title{ font-weight:700; }
.modal-header .close{ font-size:18px; line-height:1; padding:4px 8px; }
.modal-body{ padding:12px; }
.form-row{ margin-bottom:10px; }
.form-row.two{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }

.links-list{ display:flex; flex-direction:column; gap:8px; }
.link-item{ display:flex; align-items:center; justify-content:space-between; gap:8px; border:1px solid var(--border); border-radius:8px; padding:8px; background:#fff; }
.link-item .meta{ font-size:14px; }
.link-item .actions{ display:flex; gap:8px; }

.modal-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:8px; }

/* Toasts */
#toastContainer{
  position:fixed; right:12px; bottom:12px; display:flex; flex-direction:column; gap:8px; z-index:50;
}
.toast{
  background:#1e8e3e; color:#fff; padding:8px 10px; border-radius:6px; box-shadow:0 6px 20px rgba(0,0,0,.15);
}
.toast.error{ background:#d93025; }

/* Hover-card (au-dessus du graphe, près du nœud) */
.hover-card{
  position:absolute; z-index:10;
  max-width: 380px;
  background:#fff; color:#222; border:1px solid var(--border); border-radius:10px;
  box-shadow: 0 10px 32px rgba(0,0,0,.18);
  padding:10px 12px; pointer-events:none;
}
.hover-title{ font-weight:700; margin-bottom:6px; }
.hover-public{ font-size: 13px; color: #333; white-space: pre-wrap; }
.hover-public a{ color: var(--primary); text-decoration: underline; }



/* app.css — retouches modales & textareas */

/* Les textareas ne s'élargissent pas horizontalement */
.modal textarea {
  resize: vertical;
  max-height: 40vh;
}

/* Le contenu de la modale ne dépasse pas l'écran et scrolle si besoin */
.modal .modal-content {
  max-height: 90vh;
  overflow: auto;
}

/* Empêche la mise en page de sauter si on tire trop les coins dans certains navigateurs */
.modal .modal-body {
  overflow: auto;
}
