#menu {
  background: white;
  border-bottom: 1px solid #ccc;
  font-family: system-ui, sans-serif;
  font-size: 14px;
}

#menuHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
}

#menuTitle {
  font-size: 18px;
  font-weight: 700;
}

#collapseArrow {
  cursor: pointer;
  padding: 6px;
  font-size: 18px;
  user-select: none;
  transition: transform 0.3s ease;
}

#menuContent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  gap: 20px;
}

#controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

#menu.collapsed #collapseArrow {
  transform: rotate(180deg);
}
#menu.collapsed #menuContent {
  display: none;
}

#graph {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid #ddd;
}

.graph-panel {
  position: sticky;
  flex: 1 1 auto;        
  min-height: 0;  
  top: 0;                /* or top: 12px to keep a gap under navbar */
  height: 100vh !important;  
  position: relative;     
  /* overflow: hidden;        */
  margin-bottom: 0 !important;  
}

.full-width {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

section.full-width svg#graph {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

table {
    border-collapse: collapse;
    width: 100%;
  }
  table, th, td {
    border: 1px solid black;
  }
  th, td {
    padding: 8px;
    text-align: left;
  }
  th {
    background-color: #f2f2f2;
  }


#menu {
    font-size: 0.9rem;
}

#menu .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* #graph-container {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;       
    display: flex;
    flex-direction: column;
    height: auto !important;
    overflow: visible !important;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 0.4rem;
    position: relative;
    overflow: hidden; 
} */

#plots {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
#plots > div {
  flex: 1 1 45%;
}

.col-md-4, .col-lg-3, .col-lg-2 .col-lg-1{
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.form-select,
.form-control,
.btn.dropdown-toggle {
    background-color: #fff;
    border: 1px solid #d7d7d7 !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    height: 40px;
    font-size: 0.95rem;
    font-weight: 450;
    color: #333 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}


.btn.dropdown-toggle {
    width: 100% !important;
}

/* Ensure dropdown menu matches button width exactly */
.dropdown .dropdown-menu {
    width: 100% !important;
    min-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    box-sizing: border-box;
    border-radius: 12px;
}

.form-select-like {
    background-color: #fff;
    border: 1px solid #d7d7d7 !important;
    border-radius: 12px !important;
    padding: 10px 14px !important;
    height: 48px !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}


/* Closed dropdown button */
.dropdown-btn {
    background-color: #fff;
    border: 1px solid #d7d7d7 !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    height: 40px;
    font-size: 0.95rem;
    font-weight: 450;
    color: #333 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: relative;
    padding-right: 2rem !important; /* space for arrow */
}

/* Insert a ▼ arrow and place it on the far right */
.dropdown-btn::after {
    content: "▾";
    position: absolute;
    right: 12px;
    font-weight: 700;
    margin-left: 8px;
    opacity: 0.8;
    top: 50%;
    transform: translateY(-50%);
    /* font-size: 0.9rem; */
    color: #333;
    pointer-events: none;
}

/* Open menu styling */
.dropdown-menu.dropdown-select {
  width: 100%;
  border-radius: 14px;
  padding: 6px 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

/* Items inside */
.dropdown-select .dropdown-item {
  padding: 10px 16px;
  font-size: 0.95rem;
  padding-top: 4px;
  padding-bottom: 4px;
  line-height: 1.1;
}

.dropdown-select .dropdown-item.active,
.dropdown-select .dropdown-item:hover {
  background-color: #f1f5ff;
  color: #003da5;
}

.zoom-fab-fixed {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  right: 5%;
  bottom: 3%;
  left: auto;
}

.graph-stats{
  position:absolute;
  right:16px;
  top:16px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #dee2e6;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  display: grid;
  gap: 6px;
  min-width: 180px;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.graph-stats .stat{
  display:flex;
  justify-content: space-between;
  align-items:center;
  font-size: 13px;
}

.graph-stats .k { color: #495057; font-weight: 600; }
.graph-stats .v { color: #212529; font-weight: 700; }

.graph-stats .divider{
  height:1px;
  background:#e9ecef;
  margin: 4px 0;
}


/* =========================
   Legend Modal 
   ========================= */

.legend-modal{
  border-radius: 14px;
  font-family: "Inter", system-ui;
}

#legendModal .modal-dialog{
  max-width: 560px;
}

#legendModal .modal-header{
  padding: 0.8rem 1rem;
}

#legendModal .modal-title{
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

#legendModal .modal-body{
  padding: 0.9rem 1rem 1rem;
}

/* Blocks + dividers */
.legend-block{
  padding: 0.25rem 0;
}

.legend-divider{
  height: 1px;
  background: rgba(0,0,0,0.12);
  margin: 0.85rem 0;
}

.legend-title{
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 0.55rem 0;
}

.legend-description{
  font-size: 0.90rem;
  color: #555;
  margin: 0 0 0.85rem 0;
  font-family: "Inter", system-ui;

}

/* Row layout: fixed swatch column + text */
.legend-row{
  display: grid;
  grid-template-columns: 28px 1fr; /* icon column */
  align-items: center;
  column-gap: 14px;
  padding: 2px 0;
  margin-left: 5%;
}

.legend-text{
  font-size: 0.92rem;
  line-height: 1.25;
}

.legend-muted{
  color: #6c757d;
  font-weight: 400;
}

/* Shape icons */
.legend-icon{
  width: 26px;
  height: 26px;
  color: #555;
  display: inline-block;
}

.legend-icon svg{
  width: 100%;
  height: 100%;
  display: block;
}

/* Edge swatches (dotted + arrow) */
.legend-swatch{
  width: 40px;
  height: 25px;
  display: inline-block;
  color: #333;        /* default */
}

.legend-swatch-svg{
  width: 90%;
  height: 100%;
  display: block;
}

/* Make swatches use the same column as icons */
.legend-row > .legend-swatch{
  width: 40px;
  justify-self: start;
}

/* Color mapping via currentColor */
.legend-swatch.colo { color: #8a8a8a; }
.legend-swatch.temporal { color: #333; }

.legend-swatch.temporal-donor-pre  { color: #1b7f2a; }
.legend-swatch.temporal-donor-post { color: #5a2ca0; }
.legend-swatch.temporal-pre-post   { color: #f08a00; }
.legend-swatch.temporal-post-post  { color: #111; }

/* Mini-legend */

/* Legend symbols (nodes) */
.legend-symbol {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid #666;
}

/* Node type colors — match your actual graph colors */
.legend-symbol.arg { background: grey; }     /* orange */
.legend-symbol.mge { background: #1f77b4; }     /* blue */
.legend-symbol.donor { background: yellow; }   /* brown */
.legend-symbol.pre { background: red; }     /* purple */
.legend-symbol.post1 { background: #99D2FF; }   /* green */
.legend-symbol.post2 { background: #4D9DFF; }   /* teal */
.legend-symbol.post3 { background: #3A6EFF; }   /* red */
.mini-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-top: 6px;
}

.mini-legend-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  white-space: nowrap;
}