/* Multi-chain Address Analyzer — Consensix Labs */

:root {
  --bg-primary: #0a0e1a;
  --bg-surface: #111827;
  --bg-surface-hover: #1a2235;
  --accent-primary: #2635aa;
  --accent-secondary: #4f5fff;
  --accent-glow: rgba(79, 95, 255, 0.15);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --border: #1e293b;
  --border-focus: #4f5fff;

  /* Segment colors for address breakdown */
  --seg-prefix: #60a5fa;
  --seg-version: #c084fc;
  --seg-payload: #34d399;
  --seg-checksum: #fb923c;
  --seg-witness: #f472b6;
  --seg-hrp: #fbbf24;
  --seg-separator: #94a3b8;

  --font-mono: Consolas, 'Source Code Pro', 'DejaVu Sans Mono', 'Liberation Mono', Menlo, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Layout ---- */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  flex: 1;
  width: 100%;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

header h1 .accent {
  color: var(--accent-secondary);
}

header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ---- Input area ---- */

.input-area {
  margin-bottom: 1.5rem;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 0.875rem 1rem;
  padding-right: 3rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem;
  display: none;
}

.clear-btn:hover {
  color: var(--text-secondary);
}

.clear-btn.visible {
  display: block;
}

/* ---- Example addresses ---- */

.examples {
  margin-bottom: 2rem;
}

.examples-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.example-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  padding: 0.3rem 0.6rem;
  transition: all 0.15s;
  white-space: nowrap;
}

.example-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-secondary);
  color: var(--text-primary);
}

.example-chip .chip-chain {
  color: var(--accent-secondary);
  font-weight: 600;
  margin-right: 0.25rem;
}

/* ---- Chain icons ---- */

.chain-icon,
.chip-icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

.chain-icon {
  font-size: 1.15rem;
  color: var(--accent-secondary);
}

.chip-icon {
  font-size: 0.8rem;
  color: var(--accent-secondary);
  margin-right: 0.2rem;
}

/* ---- Results ---- */

#results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.result-chain {
  font-weight: 700;
  font-size: 1rem;
}

.result-type {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(79, 95, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.result-status {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.result-status.valid {
  color: var(--success);
}

.result-status.invalid {
  color: var(--error);
}

.result-status.warning {
  color: var(--warning);
}

/* ---- Breakdown ---- */

.breakdown {
  margin-bottom: 1rem;
}

.breakdown-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.address-visual {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  word-break: break-all;
  padding: 0.75rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.seg {
  border-radius: 3px;
  padding: 0.1rem 0;
  position: relative;
}

.seg-prefix { color: var(--seg-prefix); }
.seg-version { color: var(--seg-version); }
.seg-payload { color: var(--seg-payload); }
.seg-checksum { color: var(--seg-checksum); }
.seg-witness { color: var(--seg-witness); }
.seg-hrp { color: var(--seg-hrp); }
.seg-separator { color: var(--seg-separator); }

.segment-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-secondary);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

/* ---- Detail rows ---- */

.details {
  display: grid;
  gap: 0.5rem;
}

.detail-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

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

.detail-label {
  color: var(--text-muted);
  min-width: 140px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.detail-value.text {
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

/* ---- Educational context ---- */

.education {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.education summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.education summary:hover {
  color: var(--text-primary);
}

.education .edu-content {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.edu-content p {
  margin-bottom: 0.5rem;
}

.edu-content p:last-child {
  margin-bottom: 0;
}

/* ---- Multi-chain note ---- */

.also-valid {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(79, 95, 255, 0.06);
  border: 1px solid rgba(79, 95, 255, 0.15);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.also-valid strong {
  color: var(--accent-secondary);
}

/* ---- Error card ---- */

.error-card {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}

.error-message {
  color: var(--error);
  font-size: 0.85rem;
}

/* ---- Footer ---- */

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

footer a {
  color: var(--accent-secondary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  .container {
    padding: 1.25rem 1rem 3rem;
  }

  header h1 {
    font-size: 1.35rem;
  }

  .detail-row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .detail-label {
    min-width: unset;
  }

  .input-wrapper input {
    font-size: 0.8rem;
  }
}

/* ---- Accessibility: focus visible ---- */

:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

button:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}
