/* RANDPROOF Scan — explorer-style styles */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f6f7f9;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: #111;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 50%;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 2px;
}

.brand-text h1 span {
  color: #00ff88;
  font-weight: 500;
}

.global-search {
  flex: 1;
  display: flex;
  gap: 8px;
  max-width: 640px;
}

.global-search input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 14px;
  font-family: "SF Mono", "Courier New", monospace;
}

.global-search input[type="text"]:focus {
  outline: none;
  border-color: #00ff88;
}

.global-search select {
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 13px;
}

.global-search button {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  background: #00ff88;
  color: #000;
  font-weight: 600;
  cursor: pointer;
}

.global-search button:hover {
  background: #00e67a;
}

.topbar-actions {
  margin-left: auto;
}

.topbar-link {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  opacity: 0.8;
}

.topbar-link:hover {
  opacity: 1;
}

/* Main */
main {
  flex: 1;
  padding: 32px 24px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

/* Hero */
.hero {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
  text-align: center;
}

.hero h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
}

.hero p {
  color: #555;
  font-size: 15px;
  max-width: 640px;
  margin: 0 auto;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-card.error {
  color: #c00;
  border-color: #fcc;
  background: #fff5f5;
}

.stat-card.skeleton {
  color: #999;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #000;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: #666;
}

/* Panels */
.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-header .panel-title {
  margin-bottom: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.last-updated {
  font-size: 12px;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.refresh-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.refresh-btn:hover:not(:disabled) {
  background: #e5e5e5;
  border-color: #ccc;
}

.refresh-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.events-table th,
.events-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.events-table th {
  color: #666;
  font-weight: 600;
}

.events-table a {
  color: #000;
  text-decoration: underline;
}

.events-table a:hover {
  color: #00a854;
}

.loading-cell {
  text-align: center;
  color: #999;
  padding: 24px !important;
}

.loading-cell.error {
  color: #c00;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.fulfilled {
  background: #e6f9ef;
  color: #0a6;
}

.version-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: #f0f0f0;
  color: #666;
  margin-left: 4px;
}

.view-btn {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #000;
  border-radius: 6px;
  background: #fff;
  color: #000;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}

.view-btn:hover {
  background: #000;
  color: #fff;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.two-col .panel p,
.two-col .panel ol {
  font-size: 14px;
  color: #444;
  line-height: 1.6;
}

.two-col .panel ol {
  padding-left: 20px;
}

.two-col .panel li {
  margin-bottom: 8px;
}

/* Detail view */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.back-btn {
  padding: 8px 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.detail-header h2 {
  font-size: 22px;
}

/* Receipt */
.receipt-section {
  text-align: center;
}

#receipt-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

#receipt-container svg {
  max-width: 100%;
  height: auto;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fff;
}

.explorer-links {
  margin-bottom: 20px;
}

.explorer-link {
  display: inline-block;
  margin: 0 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: #000;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
}

.explorer-link:hover {
  border-color: #000;
}

.explorer-link.primary {
  background: #000;
  color: #fff;
  border-color: #000;
}

.explorer-link.primary:hover {
  background: #333;
}

.no-tx {
  font-size: 13px;
  color: #999;
}

.receipt-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.receipt-actions button {
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.receipt-actions button:hover {
  border-color: #000;
}

/* Status / error */
.status-section,
.error-section {
  text-align: center;
  padding: 40px 20px;
}

.status-message {
  font-size: 15px;
  color: #666;
}

.error-message {
  font-size: 14px;
  color: #c00;
  background: #fff5f5;
  padding: 16px 24px;
  border-radius: 8px;
  border: 1px solid #fcc;
  display: inline-block;
  max-width: 100%;
  word-break: break-word;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  font-size: 13px;
  color: #999;
}

.footer-links {
  margin-bottom: 8px;
}

.footer-links a {
  color: #000;
  text-decoration: none;
  margin: 0 8px;
}

.footer-note {
  font-size: 11px;
}

/* Utility */
.hidden { display: none !important; }
.mono { font-family: "SF Mono", "Courier New", monospace; }

/* Responsive */
@media (max-width: 800px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .global-search {
    order: 3;
    width: 100%;
    max-width: none;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Print */
@media print {
  .topbar,
  .hero,
  .stats-grid,
  .panel,
  .detail-header,
  .explorer-links,
  .receipt-actions,
  footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  #receipt-container svg {
    border: none;
  }
}
