/* ============================================================
   MODULE: graph-modal.css — aaradhyadt.github.io (v53.23)
   ExplainGit-Style IDE Knowledge Graph HUD
   Dual-pane layout: macOS Explorer sidebar + Cosmic Starburst Canvas
   ============================================================ */

/* ── Modal Overlay ─────────────────────────────────────────── */
.graph-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10050 !important;
  background: rgba(4, 5, 8, 0.88) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.25rem 1.25rem 2.85rem 1.25rem !important;
  box-sizing: border-box;
}

.graph-modal-overlay.open {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ── Modal Window Container ────────────────────────────────── */
.graph-modal-card {
  width: 96vw !important;
  max-width: 1420px !important;
  height: 90vh !important;
  max-height: 900px !important;
  display: flex !important;
  flex-direction: row !important;
  padding: 0 !important;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.9),
              0 0 0 1px rgba(255, 255, 255, 0.08),
              0 0 35px rgba(0, 240, 255, 0.07);
  background: #090d13;
  color: #e6edf3;
  position: relative;
  transition: all 0.25s ease;
}

/* Fullscreen Mode (100vw x 100vh Edge-to-Edge) */
.graph-modal-card.is-fullscreen {
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  max-height: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

/* ── Left Pane: File Explorer Sidebar ──────────────────────── */
.graph-explorer-sidebar {
  width: 260px;
  min-width: 230px;
  max-width: 320px;
  background: #090d13;
  border-right: 1px solid #1f242c;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
  z-index: 10;
  transition: transform 0.25s ease;
}

.graph-explorer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #1f242c;
  background: #080b10;
}

/* macOS Window Buttons (Red, Yellow, Green) */
.graph-mac-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.graph-mac-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.graph-mac-dot:hover {
  transform: scale(1.15);
}

.graph-dot-red {
  background: #ff5f56;
  box-shadow: 0 0 6px rgba(255, 95, 86, 0.45);
}

.graph-dot-yellow {
  background: #ffbd2e;
  box-shadow: 0 0 6px rgba(255, 189, 46, 0.45);
}

.graph-dot-green {
  background: #27c93f;
  box-shadow: 0 0 6px rgba(39, 201, 63, 0.45);
}

.graph-explorer-title {
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 0.72rem;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  color: #7d8590;
  font-weight: 600;
}

/* Tree Navigation Area */
.graph-explorer-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.4rem;
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 0.73rem;
  line-height: 1.5;
}

.graph-explorer-tree::-webkit-scrollbar {
  width: 5px;
}

.graph-explorer-tree::-webkit-scrollbar-track {
  background: transparent;
}

.graph-explorer-tree::-webkit-scrollbar-thumb {
  background: #21262d;
  border-radius: 3px;
}

.graph-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0.28rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  color: #8b949e;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.graph-tree-item:hover {
  background: #161b22;
  color: #e6edf3;
}

.graph-tree-item.is-active {
  background: rgba(0, 240, 255, 0.10) !important;
  color: #58a6ff !important;
  border: 1px solid rgba(0, 240, 255, 0.55) !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15) !important;
  font-weight: 600;
}

.graph-tree-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.graph-tree-arrow {
  display: inline-block;
  font-size: 0.65rem;
  color: #6e7681;
  transition: transform 0.18s ease;
  width: 10px;
  text-align: center;
}

.graph-tree-folder.is-open > .graph-tree-item .graph-tree-arrow {
  transform: rotate(90deg);
}

.graph-tree-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.graph-tree-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.graph-tree-folder-children {
  display: none;
  padding-left: 0.85rem;
}

.graph-tree-folder.is-open > .graph-tree-folder-children {
  display: block;
}

.graph-tree-external-icon {
  font-size: 0.65rem;
  opacity: 0;
  color: #7d8590;
  transition: opacity 0.15s ease;
}

.graph-tree-item:hover .graph-tree-external-icon,
.graph-tree-item.is-active .graph-tree-external-icon {
  opacity: 0.7;
}

/* ── Right Pane: Main Area & Canvas ────────────────────────── */
.graph-main-area {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #06070a;
  overflow: hidden;
}

/* Canvas Element with Cosmic Background */
.graph-canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(140, 42, 24, 0.16) 0%, rgba(20, 16, 24, 0.45) 45%, rgba(6, 7, 10, 0.98) 100%);
  overflow: hidden;
  cursor: grab;
}

.graph-canvas-container:active {
  cursor: grabbing;
}

#graphCanvas2D {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Top Bar HUD Over Canvas ───────────────────────────────── */
.graph-top-hud {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 15;
  pointer-events: none;
}

.graph-top-hud > * {
  pointer-events: auto;
}

/* Legend Pills */
.graph-legend-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 17, 23, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-family: var(--mono, monospace);
  font-size: 0.66rem;
}

.graph-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c9d1d9;
}

.graph-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.graph-legend-dot-file {
  background: #58a6ff;
  box-shadow: 0 0 6px rgba(88, 166, 255, 0.6);
}

.graph-legend-dot-symbol {
  background: #f472b6;
  box-shadow: 0 0 6px rgba(244, 114, 182, 0.6);
}

/* Search Bar (Find a file...) */
.graph-search-wrap {
  position: relative;
  flex: 0 1 320px;
}

.graph-search-input {
  width: 100%;
  background: rgba(13, 17, 23, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  color: #f0f6fc;
  font-family: var(--mono, monospace);
  font-size: 0.74rem;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.graph-search-input:focus {
  border-color: #58a6ff;
  background: rgba(13, 17, 23, 0.95);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18), 0 4px 18px rgba(0, 0, 0, 0.6);
}

.graph-search-input::placeholder {
  color: #7d8590;
}

/* Search Autocomplete Dropdown */
.graph-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(14px);
  display: none;
  z-index: 40;
}

.graph-search-dropdown.active {
  display: block;
}

.graph-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font-family: var(--mono, monospace);
  font-size: 0.72rem;
  color: #c9d1d9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.12s ease;
}

.graph-search-item:last-child {
  border-bottom: none;
}

.graph-search-item:hover,
.graph-search-item.highlighted {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
}

/* Top Right Actions & Badges */
.graph-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.graph-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 17, 23, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-family: var(--mono, monospace);
  font-size: 0.68rem;
  color: #8b949e;
  backdrop-filter: blur(12px);
}

.graph-user-badge strong {
  color: #c9d1d9;
  font-weight: 500;
}

.graph-user-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bc8cff;
}

.graph-icon-btn {
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #8b949e;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(12px);
}

.graph-icon-btn:hover {
  color: #f0f6fc;
  background: #21262d;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ── Telemetry / Detail Banner (Screenshot 3 Style) ────────── */
.graph-telemetry-banner {
  position: absolute;
  top: 50px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 0.35rem 0.9rem;
  font-family: var(--mono, monospace);
  font-size: 0.68rem;
  color: #7d8590;
  z-index: 12;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.graph-telemetry-banner > * {
  pointer-events: auto;
}

.graph-banner-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.graph-banner-dot {
  color: #56d364;
}

.graph-detail-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.graph-detail-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  color: #7d8590;
}

.graph-detail-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: #21262d;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.graph-detail-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #58a6ff;
  box-shadow: 0 0 6px rgba(88, 166, 255, 0.6);
  cursor: pointer;
}

/* ── Right-Side Vertical Zoom Slider (Screenshot 2) ─────────── */
.graph-vertical-slider-wrap {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 160px;
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  padding: 8px 0;
}

.graph-vertical-slider {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 130px;
  background: #21262d;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.graph-vertical-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
  cursor: pointer;
}

/* Bottom dock completely removed — unobstructed cosmic canvas */

/* ── Node Inspector Tooltip ────────────────────────────────── */
.graph-node-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  max-width: 280px;
  width: max-content;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 16px rgba(88, 166, 255, 0.2);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 35;
}

.graph-node-tooltip.active {
  opacity: 1;
  transform: scale(1);
}

.graph-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.graph-tooltip-type {
  font-family: var(--mono, monospace);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.15);
  border: 1px solid rgba(88, 166, 255, 0.3);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.graph-tooltip-comm {
  font-family: var(--mono, monospace);
  font-size: 0.6rem;
  color: #8b949e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-tooltip-title {
  font-family: var(--mono, monospace);
  font-size: 0.8rem;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 0.2rem;
  word-break: break-all;
}

.graph-tooltip-file {
  font-family: var(--mono, monospace);
  font-size: 0.64rem;
  color: #8b949e;
  word-break: break-all;
}

/* ── Mobile & Responsive Breakpoints ───────────────────────── */
@media (max-width: 768px) {
  .graph-explorer-sidebar {
    display: none;
  }
  .graph-explorer-sidebar.mobile-open {
    display: flex;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    z-index: 30;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  }
  .graph-vertical-slider-wrap {
    display: none;
  }
  .graph-telemetry-banner {
    display: none;
  }
  .graph-user-badge {
    display: none;
  }
}
