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

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #e8f0fc 0%, #f5f9ff 50%, #e8f0fc 100%);
  height: 100vh;
  overflow: hidden;
  color: #333;
}

/* ============ Header ============ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: linear-gradient(90deg, #1e6fd9 0%, #4a90d9 50%, #6ba8e8 100%);
  box-shadow: 0 2px 8px rgba(30, 111, 217, 0.3);
  position: relative;
  z-index: 100;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #fff, #b4c7e7, #fff);
  opacity: 0.6;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.major-selector select {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  min-width: 180px;
}

.major-selector select option {
  color: #333;
  background: #fff;
}

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

.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 4px;
  padding: 0 6px 0 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.search-box input {
  border: none;
  outline: none;
  padding: 6px 8px;
  font-size: 13px;
  width: 180px;
  color: #555;
}

.search-btn {
  background: #fff;
  border: 1px solid #b4c7e7;
  border-radius: 3px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.search-btn:hover {
  background: #eaf2fb;
  border-color: #4a90d9;
}

.btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ Main ============ */
.main {
  height: calc(100vh - 100px);
  overflow: hidden;
  position: relative;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  transform-origin: 0 0;
  transition: transform 0.15s ease;
}

.links-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

.columns-container {
  display: flex;
  gap: 14px;
  padding: 16px;
  min-width: max-content;
  position: relative;
  z-index: 1;
}

/* ============ Column ============ */
.column {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fafcff 0%, #eef4fb 100%);
  border: 1px solid #c5d6ec;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.12);
  min-width: 170px;
  max-width: 200px;
  flex-shrink: 0;
}

.column-header {
  background: linear-gradient(90deg, #3a7bc8 0%, #5b9bd5 100%);
  color: #fff;
  padding: 8px 12px;
  border-radius: 7px 7px 0 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.column-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.column-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* ============ Items ============ */
.item {
  background: #eaf2fb;
  border: 1px solid #b4c7e7;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: #2c5282;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  line-height: 1.4;
  word-break: break-all;
}

.item:hover {
  background: #d4e5f7;
  border-color: #5b9bd5;
  box-shadow: 0 2px 6px rgba(74, 144, 217, 0.25);
  z-index: 5;
}

.item.selectable::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #4a90d9;
  border-radius: 6px 0 0 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.item.selectable:hover::before {
  opacity: 1;
}

.item.selected {
  background: linear-gradient(90deg, #4a90d9, #5b9bd5);
  color: #fff;
  border-color: #3a7bc8;
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.4);
}

.item.connected {
  background: #d6e8f9;
  border-color: #5b9bd5;
  color: #1a4f8c;
}

.item.dimmed {
  opacity: 0.35;
  filter: grayscale(0.5);
}

.item.highlight-search {
  background: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

/* ============ Footer ============ */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(90deg, #f0f5fc, #fff, #f0f5fc);
  border-top: 1px solid #c5d6ec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #b4c7e7;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  color: #4a90d9;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.zoom-btn:hover {
  background: #eaf2fb;
}

#zoomSlider {
  width: 120px;
  accent-color: #4a90d9;
}

.zoom-value {
  font-size: 13px;
  color: #4a90d9;
  font-weight: 600;
  min-width: 42px;
}

.reset-btn {
  padding: 4px 14px;
  border: 1px solid #4a90d9;
  background: #fff;
  color: #4a90d9;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 6px;
}

.reset-btn:hover {
  background: #4a90d9;
  color: #fff;
}

.legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: #666;
}

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

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #b4c7e7;
}

/* ============ Tooltip ============ */
.tooltip {
  position: fixed;
  background: rgba(30, 41, 59, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 280px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tooltip.show {
  opacity: 1;
}

/* ============ SVG Links ============ */
.link-path {
  fill: none;
  stroke: #5b9bd5;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0.6;
  transition: all 0.2s;
}

.link-path.active {
  stroke: #2e7dd1;
  stroke-width: 1.8;
  stroke-dasharray: 6 4;
  opacity: 0.8;
}

.link-path.dimmed {
  opacity: 0.1;
}

/* Scrollbar styling */
.canvas-wrapper::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.canvas-wrapper::-webkit-scrollbar-track {
  background: #eef4fb;
}

.canvas-wrapper::-webkit-scrollbar-thumb {
  background: #b4c7e7;
  border-radius: 5px;
}

.canvas-wrapper::-webkit-scrollbar-thumb:hover {
  background: #8faed6;
}
