/* Graph Page Styling */

/* Hide site header and prevent scroll on graph page */
body:has(#graph-page) .post-header {
  display: none;
}

body:has(#graph-page) {
  overflow: hidden;
}

#graph-page {
  padding: 0;
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Graph Container */
#graph-container {
  flex: 1;
  width: 100%;
  background: #1a1a1a;
  position: relative;
  overflow: hidden;
}

/* Search bar as bottom overlay */
.graph-header {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(26, 26, 26, 0.85);
  backdrop-filter: blur(6px);
  padding: 0.5rem 1.5rem;
}

/* Vis.js Network Overrides */
.vis-network {
  outline: none;
}

.vis-network:focus {
  outline: none;
}

/* Tooltip styling */
.vis-tooltip {
  background: rgba(37, 26, 21, 0.95);
  border: 1px solid #d96a37;
  border-radius: 4px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  max-width: 300px;
  white-space: pre-wrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Graph Controls */
.graph-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 0.25rem 0;
}

/* Graph Search */
.graph-search {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Graph Slider */
.graph-slider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.graph-slider label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

#graph-threshold {
  width: 120px;
  accent-color: var(--accent);
  cursor: pointer;
}

#graph-threshold-value {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 2.5em;
}

#graph-search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-soft);
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

#graph-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

#graph-search-input:focus {
  border-color: var(--accent);
}

#graph-search-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 80px;
}

/* Preview Pane */
.preview-pane {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 48px;
  width: 420px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
}

.preview-pane--hidden,
.preview-pane--collapsed {
  display: none;
}

.preview-pane__resize-handle {
  position: absolute;
  left: -4px;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 1;
}

.preview-pane__resize-handle:hover {
  background: rgba(217, 106, 55, 0.3);
}

.preview-pane__collapse-btn {
  position: absolute;
  top: 6px;
  left: -28px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  box-shadow: -2px 0 6px rgba(0, 0, 0, 0.3);
}

.preview-pane__collapse-btn:hover {
  background: rgba(217, 106, 55, 0.2);
  color: var(--text);
}

.preview-pane__iframe {
  flex: 1;
  border: none;
  width: 100%;
  background: var(--bg);
}

/* Expand tab (visible when pane is user-collapsed and node selected) */
.preview-pane-expand {
  position: absolute;
  right: 0;
  top: 6px;
  z-index: 20;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  box-shadow: -2px 0 6px rgba(0, 0, 0, 0.3);
}

.preview-pane-expand:hover {
  background: rgba(217, 106, 55, 0.2);
  color: var(--text);
}

.preview-pane-expand--hidden {
  display: none;
}

/* Breadcrumb Trail */
.breadcrumbs {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: rgba(26, 26, 26, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.breadcrumbs--hidden {
  display: none;
}

.breadcrumbs__trail {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  scrollbar-width: none;
}

.breadcrumbs__trail::-webkit-scrollbar {
  display: none;
}

.breadcrumbs__item {
  font-size: 0.8rem;
  font-family: inherit;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

.breadcrumbs__item:hover {
  color: #fcebd5;
  background: rgba(255, 255, 255, 0.1);
}

.breadcrumbs__item--active {
  color: #d96a37;
}

.breadcrumbs__separator {
  color: #888;
  opacity: 0.4;
  font-size: 0.7rem;
}

.breadcrumbs__clear {
  font-size: 0.75rem;
  font-family: inherit;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
}

.breadcrumbs__clear:hover {
  color: #fcebd5;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .graph-header {
    padding: 0.5rem 1rem;
  }

  .graph-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 768px) {
  .preview-pane {
    width: 100% !important;
  }

  .preview-pane__resize-handle {
    display: none;
  }

  .preview-pane-expand {
    top: 6px;
    right: 0;
  }
}
