/* ============================================================
   Universe View — Dark Space Theme
   ============================================================ */

/* Fullscreen container */
.universe-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #050505;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Main area overrides when universe is active */
.main.universe-active {
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

/* ── Header (Glassmorphism dark variant) ── */
.universe-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 242, 255, 0.08);
}

/* Title — Orbitron neon */
.universe-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: #00f2ff;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(0, 242, 255, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
}

.universe-title .title-icon {
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

/* Back button */
.universe-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.universe-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(0, 242, 255, 0.3);
}

.universe-back-btn svg {
  width: 14px;
  height: 14px;
}

/* 3D graph container */
.universe-graph {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* ── Sidebar Universe menu item ── */
.sidebar-item.universe-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-300, #b0b0b0);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.sidebar-item.universe-menu:hover {
  background: rgba(0, 242, 255, 0.06);
  color: #00f2ff;
  border-color: rgba(0, 242, 255, 0.15);
}

.sidebar-item.universe-menu svg {
  width: 16px;
  height: 16px;
}

/* ── Header right section ── */
.universe-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Legend ── */
.universe-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Loading indicator ── */
.universe-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(0, 242, 255, 0.5);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 2px;
  pointer-events: none;
}

/* ── Empty state hint ── */
.universe-empty-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.2);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  pointer-events: none;
}

/* ── Custom Tooltip (Glassmorphism) ── */
.universe-tooltip {
  background: rgba(10, 10, 30, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 242, 255, 0.15);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 255, 0.08);
}

.universe-tooltip .tooltip-type {
  font-size: 0.65rem;
  color: rgba(0, 242, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 3px;
}

.universe-tooltip .tooltip-label {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 500;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Override force-graph default tooltip styling */
.scene-tooltip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  pointer-events: none;
}

/* ============================================================
   Cockpit Sidebar
   ============================================================ */

.ucockpit {
  position: absolute;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 8;
  background: rgba(8, 8, 20, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0, 242, 255, 0.08);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  overflow: hidden;
}

.ucockpit.closed {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.ucockpit.open {
  width: 280px;
  opacity: 1;
}

.ucockpit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.06);
  flex-shrink: 0;
}

.ucockpit-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(0, 242, 255, 0.6);
  letter-spacing: 3px;
}

.ucockpit-toggle {
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.25);
  color: #00f2ff;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ucockpit-toggle:hover {
  background: rgba(0, 242, 255, 0.18);
  color: #fff;
  border-color: rgba(0, 242, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.2);
}

/* Floating open button when cockpit is closed */
.ucockpit-float-btn {
  position: absolute;
  top: 68px;
  left: 10px;
  z-index: 9;
  background: rgba(8, 8, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 242, 255, 0.3);
  color: #00f2ff;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(0, 242, 255, 0.1);
}

.ucockpit-float-btn:hover {
  background: rgba(0, 242, 255, 0.15);
  color: #fff;
  border-color: rgba(0, 242, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 242, 255, 0.25);
}

.ucockpit-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 242, 255, 0.15) transparent;
}

.ucockpit-body::-webkit-scrollbar { width: 4px; }
.ucockpit-body::-webkit-scrollbar-track { background: transparent; }
.ucockpit-body::-webkit-scrollbar-thumb { background: rgba(0, 242, 255, 0.15); border-radius: 4px; }

/* ── Cockpit Sections ── */

.ucockpit-section {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ucockpit-section:last-child {
  border-bottom: none;
}

.ucockpit-section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Stats Grid ── */

.ucockpit-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ucockpit-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.ucockpit-stat .stat-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #00f2ff;
  text-shadow: 0 0 8px rgba(0, 242, 255, 0.3);
}

.ucockpit-stat .stat-label {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Filter Badge ── */

.ucockpit-filter-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 242, 255, 0.06);
  border-bottom: 1px solid rgba(0, 242, 255, 0.1);
  font-size: 0.78rem;
  color: #00f2ff;
}

.ucockpit-reset-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ucockpit-reset-btn:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff8080;
  border-color: rgba(255, 80, 80, 0.3);
}

/* ── List Items (Projects / Tags / Recent) ── */

.ucockpit-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

.ucockpit-list-item:hover {
  background: rgba(0, 242, 255, 0.06);
  color: #fff;
}

.ucockpit-list-item.active {
  background: rgba(0, 242, 255, 0.1);
  color: #00f2ff;
  border-left: 2px solid #00f2ff;
  padding-left: 6px;
}

.ucockpit-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ucockpit-item-icon {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.ucockpit-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ucockpit-item-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  color: rgba(0, 242, 255, 0.5);
  background: rgba(0, 242, 255, 0.06);
  padding: 2px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* ============================================================
   Document Detail Panel
   ============================================================ */

.udetail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 14;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.udetail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.udetail {
  position: absolute;
  top: 56px;
  right: -360px;
  bottom: 0;
  width: 360px;
  z-index: 15;
  background: rgba(8, 8, 20, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(0, 242, 255, 0.1);
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}

.udetail.open {
  right: 0;
}

.udetail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.06);
  flex-shrink: 0;
}

.udetail-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(0, 242, 255, 0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.udetail-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.3rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.udetail-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.udetail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 242, 255, 0.15) transparent;
}

.udetail-body::-webkit-scrollbar { width: 4px; }
.udetail-body::-webkit-scrollbar-track { background: transparent; }
.udetail-body::-webkit-scrollbar-thumb { background: rgba(0, 242, 255, 0.15); border-radius: 4px; }

.udetail-doc-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.4;
}

.udetail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.udetail-meta-item {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

.udetail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.udetail-tag {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid rgba(199, 125, 255, 0.3);
  border-radius: 12px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.udetail-tag:hover {
  background: rgba(199, 125, 255, 0.12);
  color: #c77dff;
}

.udetail-preview {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.65;
  max-height: 300px;
  overflow-y: auto;
}

.udetail-preview h1, .udetail-preview h2, .udetail-preview h3 {
  color: rgba(255, 255, 255, 0.9);
  margin-top: 0.6em;
  margin-bottom: 0.3em;
  font-size: 1em;
}

.udetail-preview code {
  background: rgba(0, 242, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.85em;
}

.udetail-preview pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
}

.udetail-preview.udetail-empty {
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  font-style: italic;
}

.udetail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.udetail-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.udetail-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(0, 242, 255, 0.2);
}

.udetail-action-btn.primary {
  background: rgba(0, 242, 255, 0.08);
  border-color: rgba(0, 242, 255, 0.2);
  color: #00f2ff;
}

.udetail-action-btn.primary:hover {
  background: rgba(0, 242, 255, 0.15);
  border-color: rgba(0, 242, 255, 0.4);
}
