/**
 * style.css
 *
 * Description:
 *   Defines the overall look and feel for the Wheaton Network Visualization:
 *   - Sidebar layout and legend styling
 *   - Node/edge filter "inactive" classes
 *   - The loading overlay style
 *   - Tooltip appearance
 *   - Zoom controls for the network container
 *   - Minor design improvements for a more professional look
 *
 * Responsibilities:
 *   - Ensures consistent layout for the left sidebar, main content area,
 *     and any details row or info panels.
 *   - Provides visual cues (e.g., hover, inactive states) for toggled filters.
 *   - Supports the "network-container" for D3 rendering.
 *
 * Dependencies:
 *   - No direct JS dependencies, used by index.html
 *   - Works in conjunction with the HTML structure defined in index.html
 */

/* Basic page layout & fonts */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
               Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background-color: #fafafa; /* Subtle background color for a professional look */
}

/* Main layout: left sidebar + main content */
.main-layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
}

/* Left Sidebar */
.left-sidebar {
  width: 260px;
  background-color: #f9f9f9;
  border-right: 1px solid #ddd;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-header {
  margin-bottom: 1rem;
}

.sidebar-stats small {
  display: block;
}

/* Reusable margin helper */
.mb-3 {
  margin-bottom: 1rem !important;
}

/* Each "section" within the sidebar */
.sidebar-section {
  margin-bottom: 1.25rem;
}

/* Legend grids for node/edge types */
.legend-grid,
.edge-types-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Node type items */
.legend-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s;
}
.legend-item.inactive {
  opacity: 0.4;
}

.legend-circle {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

/* Edge type items */
.legend-item-filter {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s;
}
.legend-item-filter.inactive {
  opacity: 0.4;
}
.legend-line {
  display: inline-block;
  width: 20px;
  height: 3px;
  margin-right: 6px;
  border-radius: 2px;
}

/* Gender items */
.legend-item-gender {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s;
}
.legend-item-gender.inactive {
  opacity: 0.4;
}

/* Roles & Categories */
.legend-item-role,
.legend-item-category {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s;
}
.legend-item-role.inactive,
.legend-item-category.inactive {
  opacity: 0.4;
}

/* For category squares */
.legend-square {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
}

/* Main content (right side) */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #fff; /* White background for clarity */
}

/* Network container area */
.network-container {
  position: relative;
  flex: 1;
  border: 1px solid #ddd;
  margin: 0 1rem 1rem 0;
  overflow: hidden;
}

/* Zoom buttons in the top right corner of .network-container */
.network-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Node/Edge details row across the top of main-content */
.details-row {
  min-height: 50px;
  border-bottom: 1px solid #ddd;
  padding: 0 1rem;
  background-color: #f8f9fa; /* Slightly contrast background for the detail row */
}

/* Loading overlay covers entire page until sim is stable */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffffb0; /* Transparent white overlay */
  z-index: 9999;
}

/* Tooltip for node/edge hover info */
.tooltip {
  position: absolute;
  pointer-events: none;
  padding: 6px 8px;
  background: rgba(50, 50, 50, 0.85);
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  visibility: hidden;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* "Show All" button styling when active */
button[data-filter="showAll"].active {
  box-shadow: inset 0 0 0 1px #fff;
  background-color: #333;
  color: #fff;
}

/* Group Stats Panel (if used) */
.group-stats-panel {
  display: none; /* toggled by JS if needed */
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  margin: 0 1rem 1rem 1rem;
}

/* Optional mini-legend overlay, hidden by default */
.mini-legend-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: #fff;
  border: 1px solid #ccc;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  display: none; /* Only show via JS if needed */
}

/* Inactive or dimmed filter states: maintains transitions from old code */
.inactive {
  opacity: 0.4;
  pointer-events: auto; /* still clickable, just visually dimmed */
}
