/* Tech Tree Visualization Styles */

.network-container {
  position: relative;
  width: 100%;
  flex: 1;
  margin-bottom: 1rem;
}

#network {
  width: 100%;
  height: 100%;
  border-radius: 1.5rem;
  background: var(--surface);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

#visNetworkContainer,
#htmlContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

#htmlContainer {
  overflow: hidden;
  cursor: default;
}

#htmlContainer svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#htmlContainer .tech-node {
  position: absolute;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: normal;
  text-align: center;
  user-select: text;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: none; /* Disable transitions for performance */
}

#htmlContainer .tech-node .node-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-line;
  line-height: 1.3;
  overflow: hidden;
  box-sizing: border-box;
}

#htmlContainer .tech-node.simplified .node-text {
  font-size: 35px;
}


#htmlContainer .tech-node.selected {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}


/* Wonder Tooltip */
.wonder-tooltip {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-alt) 100%);
  border: 2px solid var(--secondary);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(var(--secondary-rgb), 0.1);
  max-width: min(320px, 90vw);
  min-width: min(240px, 90vw);
  font-family: inherit;
  color: var(--text);
  backdrop-filter: blur(10px);
  user-select: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.wonder-tooltip-header {
  background: linear-gradient(90deg, var(--secondary) 0%, var(--secondary-strong) 100%);
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  position: relative;
  border-radius: 10px 10px 0 0;
}

.wonder-icon {
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-inverse);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 0.5rem;
  min-width: 3rem;
  text-align: center;
}

.wonder-title {
  flex: 1;
  min-width: 0;
}

.wonder-title h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-inverse);
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
}

.wonder-type {
  font-size: 0.65rem;
  color: var(--gray-700);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 0.15rem;
}

.wonder-tooltip-close {
  position: static;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.35);
  background: rgba(30, 41, 59, 0.72);
  color: var(--gray-100);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  padding: 0;
}

.wonder-tooltip-close span {
  display: block;
  line-height: 1;
  font-size: 1.1rem;
  margin-top: -1px;
}

.wonder-tooltip-close:hover,
.wonder-tooltip-close:focus-visible {
  background: rgba(15, 23, 42, 0.85);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.45);
}

.wonder-tooltip-content {
  padding: 0.6rem 0.7rem;
  user-select: text;
  font-size: 0.75rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.wonder-stats {
  margin-bottom: 0.6rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.stat-value {
  font-weight: 700;
  color: var(--text);
  font-size: 0.72rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: right;
}

.wonder-buffs h4 {
  margin: 0 0 0.4rem 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--secondary);
  border-bottom: 1.5px solid var(--secondary);
  padding-bottom: 0.2rem;
}

.buff-item {
  background: rgba(var(--secondary-rgb), 0.05);
  border: 1px solid rgba(var(--secondary-rgb), 0.2);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.4rem;
}

.buff-item:last-child {
  margin-bottom: 0;
}

.buff-name {
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--secondary);
  margin-bottom: 0.15rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.2;
}

.buff-description {
  color: var(--gray-200);
  line-height: 1.3;
  font-size: 0.68rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  white-space: normal;
}

.buff-value {
  color: var(--primary);
  font-weight: 600;
}

.buff-stack {
  margin-top: 0.3rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

.wonder-tooltip-hint {
  margin-top: 0.4rem;
  padding: 0;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  opacity: 0.7;
  pointer-events: none;
}

/* Permanent tooltip styles */
.wonder-tooltip.permanent .wonder-tooltip-header {
  cursor: move;
}

.wonder-tooltip.permanent.dragging {
  opacity: 0.8;
  transform: rotate(2deg);
  transition: none;
}

.wonder-tooltip.permanent .wonder-tooltip-header.draggable {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.wonder-tooltip.permanent .wonder-title {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.wonder-tooltip-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  align-self: flex-start;
}

.wonder-tooltip-pin {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.4));
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 200ms ease, opacity 200ms ease;
  opacity: 0.5;
}

.wonder-tooltip-pin.pinned {
  opacity: 1;
}

.wonder-tooltip-pin:hover {
  transform: translateY(-1px);
  opacity: 1;
}

/* Hover Zoom Tooltip */
.hover-zoom-tooltip {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-line;
  word-wrap: break-word;
  overflow-wrap: break-word;
  user-select: none;
  z-index: 1000;
}
