:root {
  --bg-color: #050505;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a1c29 0%, #050505 70%);
  --text-primary: #f8f9fa;
  --text-secondary: #a0aab2;
  --accent-color: #00f2fe;
  --accent-glow: rgba(0, 242, 254, 0.5);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --glass-bg: rgba(20, 22, 28, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.15);
  --panel-radius: 16px;
  --transition-speed: 0.3s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Subtle background animation */
body::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(0, 242, 254, 0.05) 0%, transparent 40%);
  animation: bgGlow 15s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

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

h1, h2, h3 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.75rem;
  background: var(--accent-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#graph-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Glassmorphism utility with premium feel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-highlight); /* Subtle top light */
  border-radius: var(--panel-radius);
  box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  z-index: 10;
  position: absolute;
  animation: panelFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
header {
  top: 24px;
  left: 24px;
  right: 24px;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-container input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 10px 20px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  width: 280px;
  transition: all var(--transition-speed) ease;
}

.search-container input:focus {
  border-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 16px var(--accent-glow), inset 0 0 8px rgba(0,0,0,0.5);
  transform: translateY(-1px);
}

/* Control Panel */
#control-panel {
  bottom: 24px;
  left: 24px;
  padding: 24px;
  width: 260px;
}

#control-panel h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  color: #fff;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.control-group:last-child { margin-bottom: 0; }

.control-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.control-group select {
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: 1px solid var(--glass-border);
  padding: 10px;
  border-radius: 8px;
  outline: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}
.control-group select:hover {
  border-color: rgba(255,255,255,0.2);
}
.control-group select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Hop buttons */
.hop-buttons {
  display: flex;
  gap: 8px;
}
.hop-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', sans-serif;
}
.hop-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  transform: translateY(-2px);
}
.hop-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Social link buttons */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}
.social-btn:hover {
  transform: translateY(-2px) scale(1.02);
}
.social-btn.hidden { display: none; }

.yt-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); color: #e0e0e0; }
.yt-btn:hover { background: rgba(255,255,255,0.15); color: #fff; box-shadow: 0 4px 8px rgba(255,255,255,0.1); }

.tw-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); color: #eee; }
.tw-btn:hover { background: rgba(255,255,255,0.15); color: #fff; box-shadow: 0 4px 8px rgba(255,255,255,0.1); }

.twch-btn { background: rgba(145,70,255,0.1); border-color: rgba(145,70,255,0.3); color: #b983ff; }
.twch-btn:hover { background: rgba(145,70,255,0.2); color: #d1b3ff; box-shadow: 0 4px 8px rgba(145,70,255,0.2); }

.nico-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); color: #fff; }
.nico-btn:hover { background: rgba(255,255,255,0.15); color: #fff; box-shadow: 0 4px 8px rgba(255,255,255,0.1); }

.bili-btn { background: rgba(0,161,214,0.1); border-color: rgba(0,161,214,0.3); color: #00a1d6; }
.bili-btn:hover { background: rgba(0,161,214,0.2); color: #33bced; box-shadow: 0 4px 8px rgba(0,161,214,0.2); }

.ig-btn { background: linear-gradient(45deg, rgba(240,148,51,0.1) 0%, rgba(230,104,60,0.1) 25%, rgba(220,39,67,0.1) 50%, rgba(204,35,102,0.1) 75%, rgba(188,24,136,0.1) 100%); border-color: rgba(220,39,67,0.3); color: #ff5e7e; }
.ig-btn:hover { box-shadow: 0 4px 8px rgba(220,39,67,0.2); filter: brightness(1.2); }

.tk-btn { background: rgba(255,255,255,0.05); border-color: rgba(0,242,254,0.3); color: #fff; text-shadow: -1px -1px 0 #00f2fe, 1px 1px 0 #ff0050; }
.tk-btn:hover { background: rgba(255,255,255,0.1); box-shadow: 0 4px 8px rgba(0,242,254,0.2); }

.fan-btn { background: rgba(255,204,0,0.1); border-color: rgba(255,204,0,0.3); color: #ffcc00; }
.fan-btn:hover { background: rgba(255,204,0,0.2); box-shadow: 0 4px 8px rgba(255,204,0,0.2); }

.amz-btn { background: rgba(255,153,0,0.1); border-color: rgba(255,153,0,0.3); color: #ff9900; }
.amz-btn:hover { background: rgba(255,153,0,0.2); box-shadow: 0 4px 8px rgba(255,153,0,0.2); }

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin-top: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
#minCollabValue {
  color: var(--accent-color);
  font-weight: 700;
  font-size: 0.95rem;
}

/* Legend Panel */
#legend-panel {
  top: 104px;
  right: 24px;
  padding: 20px;
  width: 240px;
  font-size: 0.85rem;
  z-index: 9;
}
#legend-panel h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.legend-section {
  margin-bottom: 14px;
}
.legend-section:last-child { margin-bottom: 0; }
.legend-section-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  font-weight: 600;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: #eee;
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}
.legend-line, .legend-thick-line {
  display: inline-block;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-line { width: 30px; height: 3px; }
.legend-thick-line { width: 30px; height: 4px; background: rgba(0,220,254,0.8); }
.legend-thick-line.thin { height: 2px; opacity: 0.5; }
.legend-thick-line.thick { height: 6px; }

.legend-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.legend-circle {
  display: inline-block;
  border-radius: 50%;
  background: rgba(85,204,255,0.4);
  border: 2px solid #55ccff;
  flex-shrink: 0;
}
.legend-circle.sm  { width:12px; height:12px; }
.legend-circle.md  { width:18px; height:18px; }
.legend-circle.lg  { width:26px; height:26px; }
.legend-size-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex: 1;
  line-height: 1.4;
}

/* Details Panel (Sidebar) */
#details-panel {
  top: 104px;
  right: 24px;
  bottom: 24px;
  width: 360px;
  padding: 28px;
  transform: translateX(120%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
}

#details-panel:not(.hidden) {
  transform: translateX(0);
}

.close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  color: white;
  background: rgba(255,255,255,0.1);
  transform: scale(1.1) rotate(90deg);
}

#idol-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding-right: 12px;
  margin-right: -12px;
}

/* Custom Scrollbar for idol-info */
#idol-info::-webkit-scrollbar {
  width: 6px;
}
#idol-info::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}
#idol-info::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}
#idol-info::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

#idol-name {
  font-size: 1.9rem;
  margin-bottom: 6px;
  line-height: 1.2;
}

.agency-tag {
  display: inline-block;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.2);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,242,254,0.1);
}

.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
}

.stat-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s;
}
.stat-box:hover {
  transform: translateY(-2px);
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255,255,255,0.15);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #fff;
}

.connections-list {
  display: flex;
  flex-direction: column;
}

.connections-list h3, .events-list h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
  color: #fff;
}

#collab-list, #upcoming-events-list {
  list-style: none;
}

/* Custom Scrollbar for search-suggestions */
#search-suggestions::-webkit-scrollbar {
  width: 6px;
}
#search-suggestions::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}
#search-suggestions::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}
#search-suggestions::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.events-list {
  margin-bottom: 24px;
}

#upcoming-events-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  transition: background 0.2s;
  border-radius: 6px;
}
#upcoming-events-list li:hover {
  background: rgba(255,255,255,0.03);
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}
#upcoming-events-list li:last-child {
  border-bottom: none;
}

.event-date {
  font-size: 0.85rem;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-color);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.event-title {
  flex: 1;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
}

.event-link {
  text-decoration: none;
  font-size: 1.1rem;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}
.event-link:hover {
  opacity: 1;
  transform: scale(1.1);
}

#collab-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  transition: background 0.2s;
  border-radius: 6px;
}
#collab-list li:hover {
  background: rgba(255,255,255,0.03);
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}

#collab-list li:last-child {
  border-bottom: none;
}

.collab-name {
  cursor: pointer;
  transition: color 0.2s;
  font-weight: 500;
}

.collab-name:hover {
  color: var(--accent-color);
}

.collab-count {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
  color: #ccc;
}

/* Tooltip for graph */
.graph-tooltip {
  background: rgba(15,17,25,0.85) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  backdrop-filter: blur(8px) !important;
  color: white !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}

/* ── Search suggestions dropdown ─────────────────────────── */
.search-container {
  position: relative;
}

#search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: rgba(20, 22, 28, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  list-style: none;
  padding: 8px 0;
  z-index: 100;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-height: 360px;
  overflow-y: auto;
  animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

#search-suggestions.hidden { display: none; }

#search-suggestions li {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

#search-suggestions li:last-child { border-bottom: none; }

#search-suggestions li:hover {
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-color);
  padding-left: 24px;
}

/* ── View status bar ─────────────────────────────────────── */
#view-status-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  display: flex;
  gap: 12px;
}

#view-status {
  display: inline-block;
  background: rgba(15, 17, 25, 0.8);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 24px;
  padding: 8px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  backdrop-filter: blur(12px);
  letter-spacing: 0.05em;
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.15);
  animation: pulseStatus 2s infinite alternate;
}

@keyframes pulseStatus {
  0% { box-shadow: 0 4px 16px rgba(0, 242, 254, 0.15); }
  100% { box-shadow: 0 4px 24px rgba(0, 242, 254, 0.3); }
}
