/*
 * CRYPTOGRAPHIC SYMBOLOGY ENGINE — Stylesheet
 * BLOK® brand system: pure black, electric blue, white
 */

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #000000;
  --bg-panel:     #0a0a0a;
  --bg-panel-alt: #0f0f0f;
  --bg-inset:     #050505;
  --border:       #1c1c1c;
  --border-hi:    #2e2e2e;
  --cyan:         #1A6FFF;
  --cyan-dim:     #1050CC;
  --cyan-glow:    rgba(26, 111, 255, 0.15);
  --violet:       #1A6FFF;
  --violet-dim:   #1050CC;
  --violet-glow:  rgba(26, 111, 255, 0.12);
  --green:        #22c55e;
  --red:          #ef4444;
  --text:         #ffffff;
  --text-muted:   #666666;
  --text-dim:     #999999;
  --mono:         'Space Mono', monospace;
  --sans:         'Inter', system-ui, sans-serif;
  --radius:       8px;
  --radius-lg:    12px;
  --panel-pad:    24px;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.97);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.logo-icon svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(26, 111, 255, 0.5));
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-brand-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.2;
}

.logo-blok {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.logo-reg {
  font-size: 9px;
  font-weight: 600;
  color: var(--cyan);
  vertical-align: super;
  letter-spacing: 0;
}

.logo-divider {
  color: var(--border-hi);
  font-weight: 300;
  font-size: 16px;
}

.logo-title {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.logo-subtitle {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(26, 111, 255, 0.1);
  border: 1px solid rgba(26, 111, 255, 0.3);
  color: var(--cyan);
  text-transform: uppercase;
}

.badge-blue {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
  margin-left: 6px;
}

.status-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

/* ─── Pipeline Labels ────────────────────────────────────────────────────────── */
.pipeline-label {
  max-width: 1440px;
  margin: 20px auto 0;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 5px;
  transition: color 0.2s, background 0.2s;
}

.pipeline-step.active {
  color: var(--cyan);
  background: rgba(26, 111, 255, 0.07);
}

.pipeline-step.done {
  color: var(--green);
}

.step-num {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.6;
}

.pipeline-arrow {
  color: var(--border-hi);
  font-size: 14px;
}

/* ─── Main Panels Layout ─────────────────────────────────────────────────────── */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  max-width: 1440px;
  margin: 16px auto 0;
  padding: 0 28px 40px;
  align-items: start;
}

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

/* ─── Panel ──────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--panel-pad);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.3s;
}

.panel:hover {
  border-color: var(--border-hi);
}

.panel-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.panel-number {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--border-hi);
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.panel-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ─── Field Label ────────────────────────────────────────────────────────────── */
.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Byte Badge ─────────────────────────────────────────────────────────────── */
.byte-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  background: rgba(26, 111, 255, 0.08);
  border: 1px solid rgba(26, 111, 255, 0.2);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

/* ─── Input / Textarea ───────────────────────────────────────────────────────── */
.input-area {
  width: 100%;
  min-height: 140px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  padding: 14px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}

.input-area:focus {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 0 2px rgba(26, 111, 255, 0.12);
}

.hash-input {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.04em;
}

.hash-input:focus {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 0 2px rgba(26, 111, 255, 0.12);
}

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

.output-area {
  width: 100%;
  min-height: 100px;
  background: rgba(34, 197, 94, 0.04);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  padding: 14px;
  resize: vertical;
  outline: none;
  letter-spacing: 0.02em;
}

/* ─── Metrics Row ────────────────────────────────────────────────────────────── */
.metrics-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metric-chip {
  flex: 1;
  min-width: 80px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-chip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-chip-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.metric-chip-value.cyan { color: var(--cyan); }
.metric-chip-value.green { color: var(--green); }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  letter-spacing: 0.02em;
  transition: all 0.18s ease;
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #0d47cc, #1A6FFF);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(26, 111, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 28px rgba(26, 111, 255, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(26, 111, 255, 0.08);
  color: var(--cyan);
  border: 1px solid rgba(26, 111, 255, 0.3);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(26, 111, 255, 0.16);
  border-color: rgba(26, 111, 255, 0.55);
}

.btn-accent {
  background: linear-gradient(135deg, #0d47cc, #1A6FFF);
  color: #fff;
  box-shadow: 0 0 16px rgba(26, 111, 255, 0.2);
}

.btn-accent:hover:not(:disabled) {
  box-shadow: 0 0 28px rgba(26, 111, 255, 0.45);
  transform: translateY(-1px);
}

/* ─── Processing Block ───────────────────────────────────────────────────────── */
.processing-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--bg-inset);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  border-radius: 99px;
  transition: width 0.1s ease;
  box-shadow: 0 0 8px var(--cyan);
}

.processing-msg {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.04em;
  animation: blink 1s step-end infinite;
}

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

/* ─── Panel Note ─────────────────────────────────────────────────────────────── */
.panel-note {
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  line-height: 1.6;
}

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.empty-icon { opacity: 0.5; }

/* ─── Glyph Block ────────────────────────────────────────────────────────────── */
.glyph-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.5s ease;
}

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

.glyph-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.glyph-svg {
  filter: drop-shadow(0 0 20px rgba(26, 111, 255, 0.35));
  transition: filter 0.3s;
}

.glyph-svg:hover {
  filter: drop-shadow(0 0 32px rgba(26, 111, 255, 0.6));
}

.glyph-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
}

.hash-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hash-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  background: var(--bg-inset);
  border: 1px solid rgba(26, 111, 255, 0.15);
  border-radius: 6px;
  padding: 10px 12px;
  word-break: break-all;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* ─── Export States ──────────────────────────────────────────────────────────── */
.export-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 0;
  animation: fadeIn 0.3s ease;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.export-success {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.4s ease;
}

.success-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
}

.payload-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

.payload-json {
  background: var(--bg-inset);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: #86efac;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  letter-spacing: 0.02em;
}

.payload-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid var(--cyan-dim);
  padding-left: 10px;
}

/* ─── Decode Results ─────────────────────────────────────────────────────────── */
.fidelity-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 6px;
  padding: 6px 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: fadeIn 0.4s ease;
}

.fidelity-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.fidelity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

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

.fidelity-key {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.fidelity-val {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

.fidelity-val.mono { font-family: var(--mono); font-size: 10.5px; color: var(--cyan); }
.fidelity-val.green { color: var(--green); font-weight: 600; }
.fidelity-val.cyan { color: var(--cyan); font-weight: 600; }

/* ─── Decode Error ───────────────────────────────────────────────────────────── */
.decode-error {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--red);
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  animation: fadeIn 0.3s ease;
}

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 20px 28px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  letter-spacing: 0.04em;
}

/* ─── Utility ────────────────────────────────────────────────────────────────── */
.mono { font-family: var(--mono); }

::selection {
  background: rgba(26, 111, 255, 0.2);
  color: var(--text);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan-dim); }
