/* Base styles and CSS variables */

:root {
  /* Light theme colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #212529;
  --text-secondary: #ababad;
  --border-color: #dee2e6;
  --link-color: #6c757d;
  --node-main: #ff6b6b;
  --node-connected: #4dabf7;
  --node-text: #212529;
  --accent-color: #0d6efd;
  --primary-color: #0d6efd;
  --primary-color-dark: #0a84c9;
  --primary-color-alpha: rgba(14, 165, 233, 0.2);
  --bg-hover: #f7fafc;
}

[data-theme="dark"] {
  /* Dark theme colors */
  --bg-primary: #28282b;
  --bg-secondary: #343a40;
  --text-primary: #f8f9fa;
  --text-secondary: #ababad;
  --border-color: #495057;
  --link-color: #adb5bd;
  --node-main: #fa5252;
  --node-connected: #339af0;
  --node-text: #f8f9fa;
  --accent-color: #0d6efd;
  --primary-color: #0d6efd;
  --primary-color-dark: #0a84c9;
  --primary-color-alpha: rgba(14, 165, 233, 0.2);
  --bg-hover: #1e293b;
}

/* Global styles */

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

body {
  font-family: "Poppins", sans-serif;
  width: 100%;
  background-color: #28282b;
  color: #fff;
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main {
  background-image: url(../assets/bg.png);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  padding-top: 80px;
  min-height: calc(100vh - 69px);
}

.dashboard-tab {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Header and Navigation */

header {
  background-color: #0d0d10;
  border-bottom: 1px solid #28282b;
  padding: 1rem 0;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 100;
}

nav {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  position: relative;
  height: 60px;
}

.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mode-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  background: #f8f9fa;
  color: #495057;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  opacity: 0.7;
}

.mode-btn.active {
  color: #44e48e;
  border-color: #44e48e;
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-secondary);
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.theme-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Dashboard Content */

.dashboard-content {
  max-width: 800px;
  margin: 0 auto;
}

/* Analysis Section */

.analysis-section {
  border-radius: 8px;
  padding: 2rem;
  margin-top: 50px;
}

.analysis-section .container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
}

.analysis-section h1 {
  margin-bottom: 1.5rem;
}

.description {
  margin-bottom: 2.5rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.analysis-form {
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: white;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #28282b;
  color: white;
  background: #28282b;
  border-radius: 12px;
  font-size: 1rem;
}

.primary-button {
  background: #44e48e;
  color: black;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary-button:hover {
  opacity: 0.8;
}

/* Bundle Results */

.bundle-results {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
}

.bundle-header {
  text-align: center;
  margin-bottom: 2rem;
}

.bundle-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.bundle-stats {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.stats-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-top: 0.25rem;
}

.transaction-count {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.bundle-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bundle-item {
  padding: 1rem;
  background-color: #1c1c1e;
  border: 1px solid #44e48e;
  border-radius: 0.5rem;
}

.bundle-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.bundle-item-title {
  font-weight: 600;
  color: var(--text-primary);
}

.bundle-item-block {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.bundle-transactions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.transaction-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  padding: 0.5rem;
  background-color: var(--bg-secondary);
  border-radius: 0.25rem;
}

.transaction-hash {
  font-family: "Poppins", sans-serif;
  color: var(--link-color);
  cursor: pointer;
}

.transaction-addresses {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.transaction-value {
  font-family: "Poppins", sans-serif;

  color: var(--text-primary);
}

.arrow-icon {
  width: 1rem;
  height: 1rem;
  stroke: var(--text-secondary);
}

/* Loading Indicator for Bundle Detection */

.bundle-loading {
  text-align: center;
  padding: 2rem;
}

.bundle-loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-progress {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Hidden Elements */

.hidden {
  display: none !important;
}

/* Visualization Section */

.visualization-section {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  min-height: 500px;
  transition: background-color 0.3s;
}

.bubble-chart {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  border-radius: 0.5rem;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.error-message {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

/* Node and Link Styles */

.link {
  stroke-opacity: 0.4;
  stroke: var(--border-color);
  transition: stroke 0.3s;
}

circle {
  fill-opacity: 0.8;
  transition: fill-opacity 0.2s;
}

circle:hover {
  fill-opacity: 1;
}

/* Tooltip */

.tooltip {
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  background-color: #1c1c1e !important;
  border: 1px solid transparent !important;
  border-radius: 4px;
  padding: 12px;
  min-width: 280px;
  max-width: 320px;
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000;
}

.tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  word-wrap: break-word;
}

.tooltip-address {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.tooltip-address code {
  font-family: "Poppins", sans-serif;
  color: #fff;
  background: #28282b;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  word-break: break-all;
  flex: 1;
  min-width: 200px;
}

.copy-button {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  margin-left: auto;
}

.copy-button:hover {
  background: #f0f0f0;
  color: #333;
}

.tooltip.visible {
  opacity: 1;
}

.wallet-viz {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-primary);
  overflow: hidden;
}

/* Graph Elements */

.node {
  fill: var(--node-connected);
  stroke: var(--border-color);
  stroke-width: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.node text {
  fill: var(--node-text);
  font-family: "Poppins", sans-serif;

  font-size: 12px;
  pointer-events: none;
  transition: fill 0.3s;
}

.node:hover {
  stroke: var(--accent-color);
  stroke-width: 3px;
}

.node:hover text {
  font-weight: bold;
}

.node.main {
  fill: var(--node-main);
}

.node-label {
  font-family: "Poppins", sans-serif;

  font-size: 10px;
  pointer-events: none;
  user-select: none;
}

/* Loading and Error Messages */

.loading-message {
  fill: var(--text-secondary);
  font-size: 1rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.error-message {
  fill: var(--node-connected);
  font-size: 1rem;
}

.no-data-message {
  fill: var(--text-secondary);
  font-size: 1rem;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Tooltip */

.wallet-tooltip {
  position: absolute;
  display: none;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.75rem;
  pointer-events: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.tooltip-content {
  font-size: 0.9rem;
}

.tooltip-title {
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.tooltip-address {
  color: var(--text-secondary);
  font-family: "Poppins", sans-serif;

  margin-bottom: 0.25rem;
}

.tooltip-interactions {
  color: var(--accent-color);
  font-weight: bold;
}

/* Wallet List */

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.wallet-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.wallet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-color);
}

.wallet-address {
  color: var(--primary-color);
  font-family: "Poppins", sans-serif;

  cursor: pointer;
}

.wallet-address:hover {
  text-decoration: underline;
}

.wallet-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bnb-amount {
  color: var(--text-primary);
  font-weight: 500;
}

.percentage {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.total-volume {
  margin-top: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.transaction-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.25rem;
  background: var(--bg-primary);
}

.transaction-hash {
  color: var(--text-secondary);
  font-family: "Poppins", sans-serif;

  cursor: pointer;
}

.transaction-hash:hover {
  color: var(--primary-color);
}

.transaction-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Bundle Header */

.bundle-header {
  text-align: center;
  padding: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin-top: 2rem;
}

.bundle-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.bundle-stats {
  color: var(--text-secondary);
}

/* Footer */

footer {
  padding: 2rem 0;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
}

/* Dashboard-specific theme variables */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --accent-color: #0d6efd;
  --error-color: #dc3545;
  --success-color: #198754;
  --node-main: #ff6b6b;
  --node-connected: #4dabf7;
  --node-text: #212529;
  --link-color: #6c757d;
}

/* Dark theme only for dashboard */

[data-theme="dark"] {
  --bg-primary: #212529;
  --bg-secondary: #343a40;
  --text-primary: #f8f9fa;
  --text-secondary: #adb5bd;
  --border-color: #495057;
  --accent-color: #0d6efd;
  --error-color: #dc3545;
  --success-color: #198754;
  --node-main: #fa5252;
  --node-connected: #339af0;
  --node-text: #f8f9fa;
  --link-color: #adb5bd;
}

/* Visualization section */

.visualization-section {
  background-color: var(--bg-secondary);
  border-radius: 0.5rem;
  padding: 2rem;
  min-height: 600px;
  transition: background-color 0.3s;
}

/* Bubble chart styles */

.bubble-chart {
  width: 100%;
  height: 100%;
}

.node circle {
  stroke: var(--border-color);
  stroke-width: 1.5;
  transition: stroke 0.3s;
}

.node.main circle {
  fill: var(--node-main);
}

.node.connected circle {
  fill: var(--node-connected);
}

.node text {
  fill: var(--node-text);
  font-family: "Poppins", sans-serif;

  font-size: 12px;
  pointer-events: none;
  transition: fill 0.3s;
}

.node:hover circle {
  stroke: var(--accent-color);
  stroke-width: 2;
}

.node:hover text {
  font-weight: bold;
}

.link {
  stroke: var(--link-color);
  stroke-opacity: 0.6;
  transition: stroke 0.3s;
}

/* Tooltip styles */

.tooltip {
  position: absolute;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, background-color 0.3s, color 0.3s;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tooltip.visible {
  opacity: 1;
}

.tooltip-header {
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.tooltip-content {
  color: var(--text-secondary);
}

.tooltip-content div {
  margin: 2px 0;
}

/* Loading and error states */

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error-message {
  color: var(--error-color);
  text-align: center;
  padding: 2rem;
}

/* Dashboard specific styles */

.dashboard {
  padding: 2rem 0;
}

.analysis-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.analysis-section h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: white;
}

.analysis-section .description {
  color: #ababad;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.analysis-form {
  background: #1c1c1e;
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid #28282b;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: white;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #28282b;
  color: white;
  background: #28282b;
  border-radius: 12px;
  font-size: 1rem;
}

.form-group input:focus {
  border-color: #44e48e;
  outline: none;
}

.primary-button {
  background: #44e48e;
  color: black;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  width: 100%;
  transition: background 0.3s ease;
}

.primary-button:hover {
  opacity: 0.8;
}

.primary-button:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.results-container {
  margin-top: 2rem;
}

.error-message {
  color: #e74c3c;
  background: #fde8e7;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: none;
}

/* Results Container */

.results-container {
  margin-top: 2rem;
}

.loading {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.error-message {
  color: #e74c3c;
  padding: 1rem;
  border-radius: 4px;
  background: #fdf2f2;
  margin-top: 1rem;
  display: none;
}
