/* cetome dataviz - graph pages: header, optional menu bar, graph canvas and sidebar.
   Shared by en18031/, einfo/, en303645/ and pren40000-1-3/. */

body.graph-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app {
  flex: 1;
  display: flex;
  min-height: 0;
}

main.graph {
  flex: 1;
  position: relative;
  min-width: 0;
  background: var(--surface);
}
#cy { position: absolute; inset: 0; }

/* --- sidebar -------------------------------------------------------------- */
aside.sidebar {
  width: 340px;
  flex: none;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  background: var(--surface-alt);
  border-left: 1px solid var(--line);
}
.sidebar .hint { margin: 0 0 0.75rem; font-size: 0.82rem; color: var(--muted); }
.sidebar .panel { padding: 0.75rem 0; border-top: 1px solid var(--line-soft); }
.sidebar .panel-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.5rem;
}
.sidebar .panel-subtitle { font-size: 0.85rem; font-weight: 600; color: var(--ink); margin: 0.6rem 0 0.25rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sidebar .site-footer { margin-top: 1rem; }
.sidebar .select-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.sidebar .select-row select { flex: 1; }
.sidebar .inline-switch { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sidebar .inline-switch .label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }

/* --- drop zone (EN 303 645 ICS import) ------------------------------------ */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  margin: 0.5rem 0; padding: 0.75rem;
  border: 2px dashed var(--blue); border-radius: var(--radius-lg);
  color: var(--muted); font-size: 0.8rem; text-align: center; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.drop-zone strong { color: var(--blue); font-size: 0.95rem; }
.drop-zone input { font-size: 0.75rem; max-width: 100%; }
.drop-zone:hover, .drop-zone.drag-active { background: var(--blue-tint); border-color: var(--blue-light); }
.drop-zone .file-name { font-weight: 600; color: var(--ink); }

/* --- menu bar (E.Info mechanisms, prEN 40000-1-3 domains) ----------------- */
.menu-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 var(--gutter);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.menu { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.menu li { position: relative; }
.menu a {
  display: block; padding: 0.6rem 0.75rem; font-size: 0.85rem; font-weight: 600;
  color: var(--text); white-space: nowrap;
}
.menu li:hover > a, .menu li:focus-within > a { background: var(--line-soft); color: var(--blue); }
.menu li.selected > a { background: var(--blue); color: #fff; }
.menu ul {
  display: none; position: absolute; top: 100%; left: 0; z-index: 50;
  min-width: 9rem; margin: 0; padding: 0.25rem 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu ul ul { top: -0.25rem; left: 100%; }
.menu ul a { padding: 0.4rem 0.9rem; font-weight: 500; }
.menu li:hover > ul, .menu li:focus-within > ul { display: block; }
.menu-bar .menu-tools { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.menu-bar .menu-tools select { padding: 0.3rem 0.5rem; font-size: 0.82rem; width: auto; }

/* --- floating details panel (prEN 40000-1-3) ------------------------------ */
.details {
  position: absolute; top: 1rem; left: 1rem; z-index: 10;
  width: min(360px, calc(100% - 2rem)); max-height: calc(100% - 2rem);
  overflow-y: auto; padding: 1.1rem 1.25rem;
  background: rgba(255, 255, 255, 0.97);
  border: 2px solid var(--blue); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.details h2 { font-size: 1.1rem; color: var(--ink); }
.details .detail-id { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); margin: 0.2rem 0 0.6rem; }
.details .detail-body { font-size: 0.88rem; line-height: 1.55; border-top: 1px solid var(--line-soft); padding-top: 0.6rem; }
.details .detail-body p { margin: 0.4rem 0; }
.details .detail-body ul { margin: 0.3rem 0 0.6rem 1.1rem; padding: 0; }
.details .detail-empty { color: var(--muted); font-style: italic; }
.details.collapsed #details-content { display: none; }
.details .details-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.details .details-toggle {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: var(--radius); font: inherit; font-size: 0.75rem; padding: 0.15rem 0.5rem; cursor: pointer;
}
.details .details-toggle:hover { color: var(--blue); border-color: var(--blue); }

.form-box { margin-top: 0.9rem; padding: 0.9rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.form-box.assessment { background: #fffdfa; border-style: dashed; }
.form-box label.field-label { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 0.6rem 0 0.3rem; }
.form-box label.field-label:first-child { margin-top: 0; }
.form-box textarea.input { min-height: 4.5rem; resize: vertical; font-family: inherit; }
.form-box select.input { font-weight: 600; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.55rem 0.8rem; border-radius: var(--radius); border: 1px solid var(--line-soft); margin-top: 0.5rem; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.status-row .pill { padding: 0.15rem 0.6rem; border-radius: 999px; background: #fff; border: 1px solid currentColor; font-size: 0.72rem; white-space: nowrap; }
.status-row.status-TODO, .status-row.verdict-N\/A { background: var(--surface-alt); color: #475569; }
.status-row.status-IN_PROGRESS { background: #e0f2fe; color: #0369a1; }
.status-row.status-COMPLIANT, .status-row.verdict-PASS { background: #dcfce7; color: #15803d; }
.status-row.status-NON_COMPLIANT, .status-row.verdict-FAIL { background: #fee2e2; color: var(--red-deep); }
.status-row.status-NOT_APPLICABLE { background: #e2e8f0; color: #475569; }
.status-row.verdict-INCONCLUSIVE { background: #fef9c3; color: var(--amber-deep); }
select.input.status-TODO { background: var(--surface-alt); color: #475569; }
select.input.status-IN_PROGRESS { background: #e0f2fe; color: #0369a1; }
select.input.status-COMPLIANT, select.input.verdict-PASS { background: #dcfce7; color: #15803d; }
select.input.status-NON_COMPLIANT, select.input.verdict-FAIL { background: #fee2e2; color: var(--red-deep); }
select.input.status-NOT_APPLICABLE, select.input.verdict-N\/A { background: #e2e8f0; color: #475569; }
select.input.verdict-INCONCLUSIVE { background: #fef9c3; color: var(--amber-deep); }
.scan-result { margin-top: 0.6rem; font-size: 0.85rem; }
.assessment-tools .btn { font-size: 0.78rem; padding: 0.35rem 0.6rem; }
#assessment-panel .inline-switch { margin-bottom: 0.4rem; }
#assessment-panel #scan-btn { margin-bottom: 0.4rem; }
.scan-result ul { margin: 0.3rem 0 0 1rem; padding: 0; font-size: 0.8rem; }

/* --- small screens: graph on top, sidebar below ---------------------------- */
@media (max-width: 900px) {
  body.graph-page { height: auto; overflow: auto; }
  .app { flex-direction: column; }
  main.graph { height: 70vh; min-height: 420px; flex: none; }
  aside.sidebar { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .details { width: calc(100% - 2rem); max-height: 60%; }
}
