/* GRAPH UI STYLESHEET
   Note: Editor UI uses editor.css with its own token set.
   Keep tokens/variables scoped to their surface to avoid drift.
*/

/* ============================================
   PC MUSIC NETWORK - STYLES
   Futuristic Hyperpop Aesthetic
   Mobile-First Responsive Design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   CSS VARIABLES
   Light Theme is DEFAULT (in :root)
   Dark Theme is an override via [data-theme="dark"]
   ============================================ */
:root {
  /* Debug / base primaries (used in a few accents) */
  --pc-blue: #0000ff;
  --pc-red: #ff0000;
  --pc-green: #00ff00;

  /* Brand Colors */
  --pc-user: #7300FF;
  --pc-person: #0066FF;
  --pc-group: #FF6B35;
  --pc-label: #FF2D92;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);

  /* Light Theme (Default) */
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef0f5;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-glass-light: rgba(0, 0, 0, 0.03);

  --text-primary: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.7);
  --text-tertiary: rgba(26, 26, 46, 0.4);

  --border-color: rgba(0, 0, 255, 0.12);
  --border-glow: rgba(0, 0, 0, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.15);

  /* Grid + Canvas tokens (Canvas link rendering should read these vars via JS) */
  --grid-line: rgba(0, 0, 0, 0.03);
  --link-stroke: rgba(0, 0, 0, 0.10);
  --link-stroke-highlight: rgba(0, 102, 255, 0.55);

  /* Sizing */
  --header-height: 60px;
  --sidebar-width: 240px;
  --panel-width: 380px;
  --panel-width-expanded: 520px;
  --mobile-bar-height: 64px;
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-lg: 24px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Z-Index Scale */
  --z-graph: 1;
  --z-sidebar: 50;
  --z-panel: 100;
  --z-mobile-bar: 150;
  --z-modal: 200;
  --z-tooltip: 300;
  --z-loading: 500;

  /* Safe Areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Dark Theme Override */
[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-glass: rgba(18, 18, 26, 0.9);
  --bg-glass-light: rgba(255, 255, 255, 0.05);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.4);

  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(255, 255, 255, 0.2);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);

  --grid-line: rgba(255, 255, 255, 0.02);
  --link-stroke: rgba(255, 255, 255, 0.12);
  --link-stroke-highlight: rgba(0, 102, 255, 0.6);
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ============================================
   LOADING SCREEN
   ============================================ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-loading);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
}

.loading-svg {
  width: 100%;
  height: 100%;
  animation: rotate 3s linear infinite;
}

.loading-ring {
  fill: none;
  stroke: var(--pc-blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 150 100;
  animation: dash 2s ease-in-out infinite;
}

.loading-ring.delay-1 {
  stroke: var(--pc-blue);
  animation-delay: -0.5s;
}

.loading-ring.delay-2 {
  stroke: var(--pc-blue);
  animation-delay: -1s;
}

.loading-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-status {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-progress {
  height: 100%;
  background: var(--gradient-accent);
  animation: loading 2s ease-in-out infinite;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes dash {
  0% {
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dashoffset: 100;
  }

  100% {
    stroke-dashoffset: 250;
  }
}

@keyframes loading {
  0% {
    width: 0;
    margin-left: 0;
  }

  50% {
    width: 100%;
    margin-left: 0;
  }

  100% {
    width: 0;
    margin-left: 100%;
  }
}

/* ============================================
   AMBIENT BACKGROUND
   ============================================ */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--pc-label);
  top: -100px;
  right: -100px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--pc-person);
  bottom: -50px;
  left: -50px;
  animation-delay: -7s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: var(--pc-user);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

/* If you still want darker / stronger orbs in dark mode */
[data-theme="dark"] .gradient-orb {
  opacity: 0.3;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 50px 50px;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(30px, -30px) scale(1.1);
  }

  50% {
    transform: translate(-20px, 20px) scale(0.9);
  }

  75% {
    transform: translate(40px, 10px) scale(1.05);
  }
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: var(--z-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: var(--safe-top);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  color: var(--pc-blue);
  transition: var(--transition-base);
}

.brand-icon-svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
  transform: scale(1.15);
  transform-origin: center;
}

.header-brand:hover .brand-icon {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
  transition: var(--transition-base);
}

.brand-text {
  display: none;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-stats {
  display: none;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--bg-glass-light);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
}

.stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-glass-light);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
}

.header-button:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-glow);
}

.header-button:active {
  transform: scale(0.95);
}

.header-button svg {
  width: 20px;
  height: 20px;
}

a.header-button {
  text-decoration: none;
}

a.header-button:hover {
  background: var(--pc-label);
  color: white;
  border-color: transparent;
}

/* Theme toggle icons:
   Default is light, so show "moon" (go dark) by default.
*/
.icon-sun {
  display: none;
}

.icon-moon {
  display: block;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

/* ============================================
   LEFT SIDEBAR
   ============================================ */
.left-sidebar {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: var(--z-sidebar);
  padding: 16px;
  padding-left: calc(16px + var(--safe-left));
  padding-bottom: calc(16px + var(--safe-bottom));
  display: none;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.left-sidebar::-webkit-scrollbar {
  width: 4px;
}

.left-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.sidebar-section {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px;
}

.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.section-header-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
}

.section-header-toggle .section-label {
  margin-bottom: 0;
}

.toggle-icon {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  transition: transform var(--transition-base);
}

.section-header-toggle[aria-expanded="false"] .toggle-icon {
  transform: rotate(180deg);
}

/* Search */
.search-section {
  position: relative;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 36px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  outline: none;
  transition: var(--transition-base);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-input:focus {
  border-color: var(--pc-person);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear svg {
  width: 14px;
  height: 14px;
}

.search-clear.visible {
  opacity: 1;
  visibility: visible;
}

.search-clear:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-base);
  z-index: 10;
}

.search-results.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

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

.search-result-item:hover {
  background: var(--bg-glass-light);
}

.search-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-type {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

/* Filters */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.filter-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.filter-chip:hover {
  border-color: var(--border-glow);
}

.filter-chip:active {
  transform: scale(0.97);
}

.filter-chip.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: transparent;
}

.chip-icon {
  font-size: 8px;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-color);
}

/* Controls */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.control-button {
  height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
}

.control-button svg {
  width: 18px;
  height: 18px;
}

.control-button:hover {
  background: var(--pc-person);
  color: white;
}

.control-button:active {
  transform: scale(0.95);
}

/* ============================================
   MOBILE BOTTOM BAR
   ============================================ */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-bar-height);
  padding-bottom: var(--safe-bottom);
  z-index: var(--z-mobile-bar);
  display: flex;
  align-items: stretch;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-base);
}

.mobile-tab svg {
  width: 22px;
  height: 22px;
}

.mobile-tab span {
  font-size: 10px;
  font-weight: 500;
}

.mobile-tab.active {
  color: var(--pc-person);
}

.mobile-tab:active {
  transform: scale(0.95);
}

/* Mobile Tools Panel */
.mobile-tools-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--mobile-bar-height);
  max-height: 50vh;
  z-index: var(--z-panel);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
}

.mobile-tools-panel.active {
  transform: translateY(0);
}

.mobile-panel-header {
  position: relative;
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
}

.handle-bar {
  width: 40px;
  height: 4px;
  background: var(--text-tertiary);
  border-radius: 2px;
}

.mobile-panel-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-panel-close svg {
  width: 16px;
  height: 16px;
}

.mobile-panel-content {
  padding: 16px;
  overflow-y: auto;
  max-height: calc(50vh - 60px);
}

/* ============================================
   GRAPH CONTAINER
   ============================================ */
.graph-container {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: 0;
  right: 0;
  bottom: calc(var(--mobile-bar-height) + var(--safe-bottom));
  z-index: var(--z-graph);
  transition: var(--transition-smooth);
  overflow: hidden;
}

/* Canvas layer for fast link rendering */
.graph-container .graph-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.graph-container svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================
   SVG NODE STYLES
   ============================================ */
.node {
  cursor: pointer;
  transition: opacity var(--transition-base);
}

.node:hover {
  filter: brightness(1.1);
}

.node-ring {
  fill: none;
  stroke-width: 3;
  stroke-dasharray: 8 4;
  opacity: 0;
  filter: drop-shadow(0 0 8px currentColor);
  animation: ring-rotate 4s linear infinite;
  transition: opacity var(--transition-base);
}

.node-ring.active {
  opacity: 1;
}

@keyframes ring-rotate {
  100% {
    stroke-dashoffset: -24;
  }
}

.node-glow {
  opacity: 0;
  transition: opacity var(--transition-base);
}

.node:hover .node-glow {
  opacity: 0.5;
}

.node-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 500;
  fill: var(--text-primary);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
}

/* SVG links (only relevant if you ever fall back to SVG link rendering) */
.link {
  stroke: var(--link-stroke);
  stroke-opacity: 0.12;
  transition: stroke-opacity var(--transition-base);
}

.link.highlight {
  stroke-opacity: 0.6;
  stroke: var(--pc-person);
}

/* ============================================
   INFO PANEL TOGGLE
   ============================================ */
.info-panel-toggle {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-panel);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-base);
  box-shadow: var(--shadow-md);
}

.info-panel-toggle:not([hidden]) {
  display: flex;
}

.info-panel-toggle:hover {
  background: var(--bg-tertiary);
}

.info-panel-toggle svg {
  width: 18px;
  height: 18px;
}

.toggle-label {
  font-size: 13px;
  font-weight: 500;
}

/* ============================================
   INFO PANEL (Desktop)
   ============================================ */
.info-panel {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  right: 0;
  bottom: 0;
  width: var(--panel-width);
  z-index: var(--z-panel);
  background: var(--bg-glass);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--transition-smooth), width var(--transition-smooth);
  display: none;
  flex-direction: column;
}

.info-panel.active {
  transform: translateX(0);
}

.info-panel.expanded {
  width: var(--panel-width-expanded);
}

.panel-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.panel-control-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
}

.panel-control-btn svg {
  width: 16px;
  height: 16px;
}

.panel-control-btn:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

.panel-close-btn:hover {
  background: var(--pc-label);
  color: white;
}

.info-panel.expanded #panel-expand svg {
  transform: rotate(180deg);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.panel-content::-webkit-scrollbar {
  width: 6px;
}

.panel-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* ============================================
   INFO PANEL CONTENT
   ============================================ */
/* Cover Image */
.info-cover {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.info-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-glass) 0%, transparent 60%);
}

/* Avatar */
.info-avatar-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: -50px;
  padding: 0 20px;
}

.info-avatar {
  position: relative;
  width: 100px;
  height: 100px;
}

.info-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-secondary);
  box-shadow: var(--shadow-lg);
}

.info-avatar-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid;
  opacity: 0.5;
  animation: avatar-pulse 2s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.2;
  }
}

/* Info Header */
.info-header {
  text-align: center;
  padding: 16px 20px;
}

.info-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  border-radius: 100px;
  margin-bottom: 8px;
}

.info-type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.info-name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.info-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 0 20px;
  text-align: center;
}

/* Social Links */
.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-base);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

social-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.social-link.spotify:hover {
  background: #1DB954;
  color: white;
  border-color: transparent;
}

.social-link.apple:hover {
  background: #fc3c44;
  color: white;
  border-color: transparent;
}

.social-link.bandcamp:hover {
  background: #629aa9;
  color: white;
  border-color: transparent;
}

.social-link.soundcloud:hover {
  background: #ff5500;
  color: white;
  border-color: transparent;
}

.social-link.instagram:hover {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  color: white;
  border-color: transparent;
}

.social-link.twitter:hover {
  background: #1DA1F2;
  color: white;
  border-color: transparent;
}

.social-link.website:hover {
  background: var(--pc-person);
  color: white;
  border-color: transparent;
}

.social-link.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 20px;
}

.stat-card {
  background: var(--bg-glass-light);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
  text-align: center;
  transition: var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.stat-card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.stat-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Connections Section */
.connections-section {
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.connections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.connections-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connections-title svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.connections-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 100px;
}

.connections-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-glass-light);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.connection-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-glow);
  transform: translateX(4px);
}

.connection-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--connection-color, var(--border-color));
}

.connection-info {
  flex: 1;
  min-width: 0;
}

.connection-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-type {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

.connection-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  transition: var(--transition-fast);
}

.connection-card:hover .connection-arrow {
  color: var(--text-primary);
  transform: translateX(4px);
}

/* ============================================
   MOBILE INFO PANEL (Top Sheet)
   ============================================ */
.mobile-info-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--header-height) + var(--safe-top));
  bottom: calc(var(--mobile-bar-height) + var(--safe-bottom));
  z-index: var(--z-modal);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(-100%);
  transition: transform var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-info-panel.active {
  transform: translateY(0);
}

.sheet-header {
  position: relative;
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
}

.sheet-controls {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
}

.sheet-control-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-control-btn svg {
  width: 16px;
  height: 16px;
}

.sheet-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   TOOLTIP
   ============================================ */
.tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
}

.tooltip-name {
  font-size: 13px;
  font-weight: 600;
}

.tooltip-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.modal-overlay.visible .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--transition-fast);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-close:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 20px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shortcut-item kbd {
  min-width: 32px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-align: center;
}

.shortcut-item span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: calc(var(--mobile-bar-height) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
}

.toast.hiding {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast-icon.success {
  color: #22c55e;
}

.toast-icon.error {
  color: #ef4444;
}

.toast-icon.info {
  color: var(--pc-person);
}

.toast-message {
  font-size: 13px;
}

/* ============================================
   RESPONSIVE - TABLET (768px+)
   ============================================ */
@media (min-width: 768px) {
  .brand-text {
    display: block;
  }

  .header-stats {
    display: flex;
  }

  .left-sidebar {
    display: flex;
  }

  .mobile-bottom-bar,
  .mobile-tools-panel,
  .mobile-info-panel {
    display: none !important;
  }

  .graph-container {
    left: var(--sidebar-width);
    bottom: 0;
  }

  .graph-container.panel-open {
    right: var(--panel-width);
  }

  .graph-container.panel-expanded {
    right: var(--panel-width-expanded);
  }

  .info-panel {
    display: flex;
  }

  .info-panel-toggle {
    right: calc(var(--safe-right) + 16px);
  }

  .node-label {
    opacity: 1;
  }

  .toast-container {
    bottom: 24px;
    left: calc(var(--sidebar-width) + 50%);
    transform: translateX(-50%);
  }

  body.info-open .toast-container {
    left: calc(var(--sidebar-width) + (100% - var(--sidebar-width) - var(--panel-width)) / 2);
  }
}

/* ============================================
   RESPONSIVE - DESKTOP (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  :root {
    --sidebar-width: 260px;
    --panel-width: 420px;
    --panel-width-expanded: 600px;
  }

  .connections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .info-panel.expanded .connections-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .info-panel.expanded .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   RESPONSIVE - MOBILE ONLY (< 768px)
   ============================================ */
@media (max-width: 767px) {
  .left-sidebar {
    display: none !important;
  }

  .info-panel {
    display: none !important;
  }

  .info-panel-toggle {
    display: none !important;
  }

  .mobile-info-panel {
    display: flex;
  }

  body.info-open .mobile-bottom-bar,
  body.info-open .mobile-tools-panel {
    opacity: 0;
    pointer-events: none;
  }

  .info-cover {
    height: 140px;
  }

  .info-avatar {
    width: 80px;
    height: 80px;
  }

  .info-avatar-wrapper {
    margin-top: -40px;
  }

  .info-name {
    font-size: 20px;
  }

  .social-links {
    gap: 6px;
    padding: 16px;
  }

  .social-link {
    width: 40px;
    height: 40px;
  }

  .social-link svg {
    width: 18px;
    height: 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 16px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card-value {
    font-size: 18px;
  }

  .connections-section {
    padding: 16px;
  }

  .connection-card {
    padding: 10px;
  }
}

/* ============================================
   RESPONSIVE - SMALL MOBILE (< 480px)
   ============================================ */
@media (max-width: 479px) {
  .header {
    padding: 0 12px;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    padding: 5px;
  }

  .header-button {
    width: 36px;
    height: 36px;
  }

  .modal-content {
    margin: 16px;
  }

  .shortcuts-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .social-link {
    width: 36px;
    height: 36px;
  }

  .social-link svg {
    width: 16px;
    height: 16px;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--pc-person);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 12px 24px;
  background: var(--pc-person);
  color: white;
  font-weight: 600;
  z-index: 9999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}
