/* Transaction Graph Explorer */

.graph-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  min-height: 500px;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}

.graph-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.graph-toolbar-left h2 {
  margin: 0;
  font-size: 1.1rem;
}

.graph-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.graph-control {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.graph-control select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
}

.graph-container {
  position: relative;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
}

#graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#graph-canvas:active {
  cursor: grabbing;
}

/* Info panel */
.graph-info-panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 320px;
  max-height: calc(100% - 1.5rem);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10;
}

.graph-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.graph-info-header h4 {
  margin: 0;
  font-size: 0.9rem;
}

.graph-info-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}

.graph-info-close:hover {
  color: var(--text);
}

.graph-info-body {
  padding: 0.8rem;
  font-size: 0.85rem;
}

.graph-info-body .info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.graph-info-body .info-row:last-child {
  border-bottom: none;
}

.graph-info-body .info-label {
  color: var(--text-secondary);
}

.graph-info-body .info-value {
  color: var(--text);
  font-family: monospace;
  text-align: right;
  word-break: break-all;
}

.graph-info-body .info-txid {
  word-break: break-all;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}

.graph-info-body .info-txid:hover {
  text-decoration: underline;
}

.graph-info-body .info-protocols {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

/* Legend */
.graph-legend {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 5;
}

.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.graph-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Status */
.graph-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  font-size: 0.9rem;
  z-index: 5;
  pointer-events: none;
}

/* Fullscreen */
.graph-page.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: var(--bg);
  padding: 0.5rem;
}

.graph-page.fullscreen .graph-container {
  border-radius: 0;
}

/* Mobile */
@media (max-width: 768px) {
  .graph-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .graph-info-panel {
    width: calc(100% - 1.5rem);
    max-height: 40%;
    bottom: 0.75rem;
    top: auto;
  }

  .graph-legend.legend-shifted {
    bottom: calc(40% + 1.5rem);
  }
}
