/* Enhanced styles based on popup.css */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600&display=swap');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  padding: 30px 0;
  border-bottom: 1px solid #333;
  margin-bottom: 30px;
  position: relative;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.title-section {
  flex: 1;
  text-align: center;
}

header h1 {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: #f0f0f0;
  letter-spacing: 2px;
}

header h1::before {
  content: '#';
  color: #666;
  margin-right: 4px;
  font-weight: 400;
}

.subtitle {
  display: block;
  font-size: 0.9rem;
  color: #888;
  margin-top: 8px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

/* Info button */
.info-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
  margin-top: 2px;
  position: relative;
}

.info-btn:hover {
  color: #888;
  background: rgba(255, 255, 255, 0.05);
}

.info-btn.active {
  color: #4a7c4a;
  background: rgba(76, 175, 80, 0.1);
}

.info-btn:hover .tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

/* API Section */
.api-section {
  margin-bottom: 30px;
}

.api-details {
  background: #222;
  border: 1px solid #404040;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.api-summary {
  padding: 15px 20px;
  cursor: pointer;
  user-select: none;
  color: #ccc;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: background-color 0.3s;
  list-style: none;
}

.api-summary:hover {
  background: rgba(255, 255, 255, 0.02);
  color: #e0e0e0;
}

.api-summary::marker,
.api-summary::-webkit-details-marker {
  display: none;
}

.api-content {
  padding: 0 20px 20px 20px;
  border-top: 1px solid #333;
}

/* Input Section */
.input-section {
  background: #222;
  border: 1px solid #404040;
  border-radius: 4px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.input-group {
  margin-bottom: 20px;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  color: #e0e0e0;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.address-input, .api-input {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: all 0.2s ease;
}

.address-input:focus, .api-input:focus {
  outline: none;
  border-color: #4a7c4a;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.api-input {
  font-family: 'Inter', sans-serif;
}

.input-help {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 5px;
  line-height: 1.4;
}

.input-help a {
  color: #4a7c4a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.input-help a:hover {
  color: #5cb85c;
  text-decoration: underline;
}

/* Control tooltips */
.control-label-with-tooltip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tooltip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: #666;
  cursor: help;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.tooltip-trigger:hover {
  color: #888;
  background: rgba(255, 255, 255, 0.05);
}

.tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a2a;
  border: 1px solid #404040;
  color: #e0e0e0;
  text-align: left;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  pointer-events: none;
  transition: all 0.2s ease;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #2a2a2a transparent transparent transparent;
}

.tooltip-trigger:hover .tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

/* Controls */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-group label {
  font-size: 12px;
  color: #ccc;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.number-input {
  padding: 8px 12px;
  background: #333;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: all 0.2s ease;
}

.number-input:focus {
  outline: none;
  border-color: #4a7c4a;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.checkbox-group {
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
}

.checkbox-group input[type="checkbox"] {
  position: relative;
  width: 50px;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: #404040;
  border: 1px solid #555;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkbox-group input[type="checkbox"]:checked {
  background: #2d5a2d;
  border-color: #4a7c4a;
}

.checkbox-group input[type="checkbox"]::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  top: 2px;
  background: #666;
  border-radius: 50%;
  transition: all 0.2s ease;
  border: 1px solid #777;
}

.checkbox-group input[type="checkbox"]:checked::before {
  transform: translateX(22px);
  background: #5cb85c;
  border-color: #6cc76c;
}

.checkbox-group label {
  cursor: pointer;
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin: 0;
}

/* Advanced Options */
.advanced-options {
  margin: 20px 0;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #222;
}

.advanced-summary {
  padding: 15px 20px;
  cursor: pointer;
  user-select: none;
  color: #ccc;
  font-weight: 500;
  transition: background-color 0.3s;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

.advanced-summary:hover {
  background: rgba(255, 255, 255, 0.02);
  color: #e0e0e0;
}

.advanced-summary::marker,
.advanced-summary::-webkit-details-marker {
  color: #4a7c4a;
}

.advanced-content {
  padding: 0 20px 20px 20px;
  border-top: 1px solid #333;
}

.ignore-list-textarea {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  resize: vertical;
  min-height: 80px;
  transition: all 0.2s ease;
}

.ignore-list-textarea:focus {
  outline: none;
  border-color: #4a7c4a;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.ignore-list-textarea::placeholder {
  color: #666;
  font-size: 10px;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 15px;
  background: #2d5a2d;
  border: 1px solid #4a7c4a;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  background: #3a6a3a;
  border-color: #5a8a5a;
  color: #f0f0f0;
}

.btn-primary:active {
  background: #2a5a2a;
  transform: translateY(1px);
}

.btn-secondary {
  padding: 8px 16px;
  background: #333;
  border: 1px solid #555;
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
}

.btn-secondary:hover {
  background: #404040;
  border-color: #666;
  color: #e0e0e0;
}

/* Loading */
.loading-section {
  text-align: center;
  padding: 60px 0;
  background: #222;
  border: 1px solid #404040;
  border-radius: 4px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #404040;
  border-top: 3px solid #4a7c4a;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

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

.loading-section p {
  color: #ccc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Error */
.error-section {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid #f44336;
  border-left: 4px solid #f44336;
  padding: 20px;
  border-radius: 4px;
  margin: 20px 0;
}

.error-message {
  color: #ff6b6b;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

/* Results */
.results-section {
  margin: 30px 0;
}

.result-card {
  background: #222;
  border: 1px solid #404040;
  padding: 25px;
  border-radius: 4px;
  margin-bottom: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.result-card h3 {
  color: #f0f0f0;
  margin-bottom: 15px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.result-content {
  color: #e0e0e0;
}

.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  margin-bottom: 10px;
}

.status-badge.success {
  background: rgba(76, 175, 80, 0.2);
  color: #5cb85c;
  border: 1px solid #4a7c4a;
}

.status-badge.error {
  background: rgba(244, 67, 54, 0.2);
  color: #ff6b6b;
  border: 1px solid #f44336;
}

.no-data {
  color: #666;
  font-style: italic;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Signatures */
.signatures {
  margin-top: 15px;
}

.signature {
  display: inline-block;
  padding: 6px 10px;
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  margin: 5px 5px 5px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #ccc;
}

.signature:hover {
  border-color: #4a7c4a;
  background: #404040;
  color: #e0e0e0;
}

/* Tables */
.counterparties-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}

.counterparties-table th {
  background: #333;
  padding: 10px;
  text-align: left;
  color: #ccc;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 2px solid #404040;
  font-family: 'Inter', sans-serif;
}

.counterparties-table td {
  padding: 10px;
  border-bottom: 1px solid #333;
  font-size: 12px;
}

.counterparties-table .address {
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  color: #4a7c4a;
  transition: color 0.2s ease;
}

.counterparties-table .address:hover {
  color: #5cb85c;
  text-decoration: underline;
}

/* Path Display */
.path-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 15px;
  gap: 10px;
}

.path-node {
  padding: 8px 12px;
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  transition: all 0.2s ease;
}

.path-node.source {
  border-color: #4a7c4a;
  background: rgba(76, 175, 80, 0.1);
  color: #5cb85c;
}

.path-node.target {
  border-color: #4a7c9a;
  background: rgba(76, 175, 154, 0.1);
  color: #5cb8b5;
}

.path-node span {
  cursor: pointer;
  color: inherit;
}

.path-node span:hover {
  text-decoration: underline;
}

.path-arrow {
  color: #666;
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-label {
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}

.stat-value {
  color: #f0f0f0;
  font-size: 20px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.summary {
  color: #888;
  font-size: 12px;
  margin-top: 10px;
  font-family: 'Inter', sans-serif;
}

/* Graph */
.graph-section {
  margin: 30px 0;
}

.graph-header {
  background: #222;
  border: 1px solid #404040;
  border-bottom: none;
  padding: 20px;
  border-radius: 4px 4px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.graph-header h3 {
  color: #f0f0f0;
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.graph-controls {
  display: flex;
  gap: 10px;
}

.graph-container {
  height: 600px;
  background: #1a1a1a;
  border: 1px solid #404040;
  border-radius: 0 0 4px 4px;
  position: relative;
}

.graph-tooltip {
  position: fixed;
  background: #222;
  border: 1px solid #404040;
  padding: 10px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  z-index: 1000;
  pointer-events: none;
  max-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.graph-tooltip strong {
  color: #f0f0f0;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #222;
  border-radius: 4px;
  border: 1px solid #404040;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  margin: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #404040;
  background: #2a2a2a;
}

.modal-header h3 {
  color: #f0f0f0;
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: #e0e0e0;
}

.modal-body {
  padding: 25px;
}

.modal-body h4 {
  color: #f0f0f0;
  margin: 20px 0 10px 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body p {
  margin-bottom: 15px;
  line-height: 1.6;
  color: #ccc;
  font-size: 13px;
}

.modal-body ol,
.modal-body ul {
  margin: 10px 0 15px 20px;
  color: #ccc;
}

.modal-body li {
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 13px;
}

.modal-body a {
  color: #4a7c4a;
  text-decoration: none;
}

.modal-body a:hover {
  color: #5cb85c;
  text-decoration: underline;
}

.modal-body strong {
  color: #f0f0f0;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #2a2a2a;
}

::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Selection */
::selection {
  background: #404040;
  color: #f0f0f0;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .controls {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .graph-container {
    height: 400px;
  }
  
  .graph-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .modal-content {
    margin: 10px;
    max-width: calc(100% - 20px);
  }
}