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

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #1f2a42;
  --border: #2a3550;
  --border-glow: rgba(99, 179, 237, 0.3);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #63b3ed;
  --accent-bright: #90cdf4;
  --danger: #fc8181;
  --danger-bg: rgba(252, 129, 129, 0.1);
  --warning: #f6e05e;
  --warning-bg: rgba(246, 224, 94, 0.1);
  --success: #68d391;
  --success-bg: rgba(104, 211, 145, 0.1);
  --critical: #f56565;
  --critical-glow: rgba(245, 101, 101, 0.4);
  --gradient-accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-danger: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  --gradient-safe: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 179, 237, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(99, 179, 237, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 80% 20%,
      rgba(118, 75, 162, 0.03) 0%,
      transparent 50%
    );
}

main {
  flex: 1;
}

/* === HEADER === */
.header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.logo-icon img {
  width: 36px;
  height: 36px;
  border-radius: 7.2px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--accent);
}

.header-stats {
  margin-left: auto;
  display: flex;
  gap: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.header-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-stat .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.dot-green {
  background: var(--success);
}
.dot-yellow {
  background: var(--warning);
}

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

.flicker {
  animation: flicker-slow 2s infinite ease-in-out;
}

@keyframes btn-blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}
.btn-animate {
  animation: btn-blink 0.3s ease-in-out;
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
  }
}
.blink {
  animation: blink 0.4s ease-in-out;
}

@keyframes flicker-slow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* === SEARCH === */
.search-section {
  padding: 40px 32px;
  max-width: 900px;
  margin: 0 auto;
}

.search-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.search-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.search-bar {
  display: flex;
  gap: 12px;
  position: relative;
}

.search-input {
  flex: 1;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.search-input--error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.25);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  padding: 16px 32px;
  background: var(--gradient-accent);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.currency-select {
  padding: 16px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* === RESULTS === */
.results {
  padding: 0 32px 40px;
  max-width: 1400px;
  margin: 0 auto;
}
.hidden {
  display: none;
}

.results-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .search-bar {
    flex-wrap: wrap;
  }
  .search-input {
    flex: 0 0 100%;
  }
  .currency-select {
    flex: 1;
  }
  .search-btn {
    flex: 1;
  }
}

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--border-glow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.card-body {
  padding: 20px;
}

/* === RISK SCORE DISPLAY === */
.risk-score-card {
  text-align: center;
  padding: 32px 20px;
}

.risk-gauge {
  width: 180px;
  height: 180px;
  margin: 0 auto 20px;
  position: relative;
}

.risk-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.risk-gauge-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

.risk-gauge-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition:
    stroke-dashoffset 1.5s ease,
    stroke 0.5s ease;
}

.risk-score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -2px;
}

.risk-score-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.risk-label-low {
  color: var(--success);
}
.risk-label-medium {
  color: var(--warning);
}
.risk-label-high {
  color: var(--danger);
}
.risk-label-critical {
  color: var(--critical);
}

.risk-score-intel-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 8px;
  margin-bottom: 2px;
  letter-spacing: 0.3px;
}

.risk-score-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  word-break: break-all;
}

/* === SANCTIONS BADGE === */
.sanctions-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 12px;
}

.sanctions-badge.sanctioned {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(252, 129, 129, 0.3);
  animation: sanction-pulse 1.5s infinite;
}

.sanctions-badge.clear {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(104, 211, 145, 0.3);
}

@keyframes sanction-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.3);
  }
  50% {
    box-shadow: 0 0 12px 4px rgba(245, 101, 101, 0.15);
  }
}

/* === SIGNAL BARS === */
.signal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 53, 80, 0.5);
}

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

.signal-name {
  width: 140px;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.signal-bar-container {
  flex: 1;
  height: 6px;
  background: rgba(42, 53, 80, 0.8);
  border-radius: 3px;
  overflow: hidden;
}

.signal-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.signal-value {
  width: 40px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

/* === GRAPH === */
.graph-section {
  display: flex;
  flex-direction: column;
}

#cy {
  width: 100%;
  height: 500px;
  background: var(--bg-primary);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* === ENTITY CLUSTER === */
.cluster-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 53, 80, 0.5);
}

.cluster-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.cluster-address:hover {
  color: var(--accent-bright);
}

/* === CONNECTIONS === */
.connection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.connection-item:hover {
  color: var(--accent);
}

.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* === LOADING === */
.loading {
  text-align: center;
  padding: 60px;
}

.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 14px;
  color: var(--text-secondary);
}

/* === ERROR === */
.error-msg {
  text-align: center;
  padding: 24px;
  color: var(--danger);
  font-size: 14px;
}

/* === INFO GRID === */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item {
  padding: 12px;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.info-value {
  font-size: 16px;
  font-weight: 600;
}

/* === BOTTOM STATS === */
.bottom-stats {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

/* === FOOTER === */
.footer {
  text-align: center;
  padding: 40px 20px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}
.footer a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s;
}
.footer a:hover {
  color: var(--text-primary);
}
.footer-text {
  font-weight: 500;
  font-size: 14px;
}

.footer-container {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
}
.footer-sep {
  color: var(--border);
  font-weight: 300;
  user-select: none;
}
.pdf-download-link {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: all 0.3s ease;
  text-decoration: none;
}
.pdf-download-link:hover {
  color: var(--danger);
  transform: translateY(-2px);
}
.footer-wa-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-wa-link:hover {
  color: #25d366;
}
