/* =========================================================================
   CRISP Proof — Global Styles
   Dark, minimal, professional. No frameworks.
   ========================================================================= */

/* ── Reset & Base ─────────────────────────────────────────────────────── */

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

:root {
  --bg: #0d0d0f;
  --surface: #15151a;
  --surface-2: #1c1c24;
  --border: #2a2a36;
  --border-2: #3a3a4a;
  --text: #e8e8f0;
  --text-dim: #6b6b80;
  --text-muted: #4a4a58;
  --accent: #7c5cfc;
  --accent-dim: #4a3599;
  --accent-glow: #7c5cfc33;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 10px;
  --radius-sm: 6px;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --max-width: 860px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ───────────────────────────────────────────────────────── */

h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  padding-top: 1.25rem;
}

p {
  color: var(--text-dim);
  font-size: 0.925rem;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 600px;
  margin-bottom: 2rem;
}

.section-note {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.dim {
  color: var(--text-dim);
}

/* ── Layout ───────────────────────────────────────────────────────────── */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  font-size: 1.3rem;
  color: var(--accent);
}

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

nav {
  display: flex;
  gap: 0.25rem;
}

nav a {
  text-decoration: none;
  color: var(--text-dim);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition:
    color 0.15s,
    background 0.15s;
}

nav a:hover {
  color: var(--text);
  background: var(--surface);
}

nav a.active {
  color: var(--text);
  background: var(--surface-2);
}

main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

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

/* ── Section cards ────────────────────────────────────────────────────── */

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

section#upload-section {
  background: transparent;
  border: none;
  padding: 0;
}

/* ── Hero features (landing page) ─────────────────────────────────────── */

.hero-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.feature-card h2 {
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.875rem;
  line-height: 1.55;
}

.feature-card a {
  color: var(--accent);
  text-decoration: none;
}

.feature-card a:hover {
  text-decoration: underline;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.cta-wrap {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Drop zone ────────────────────────────────────────────────────────── */

#drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
  outline: none;
}

#drop-zone:hover,
#drop-zone:focus {
  border-color: var(--accent);
  background: var(--accent-glow);
}

#drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.drop-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}
.drop-primary {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.drop-secondary {
  font-size: 0.875rem;
  color: var(--text-dim);
}

/* ── Preview ──────────────────────────────────────────────────────────── */

#preview-section {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

#preview-wrap {
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

#preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#file-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.5rem;
}

#file-name {
  font-size: 0.95rem;
  word-break: break-all;
}
#file-size,
#file-type {
  font-size: 0.825rem;
}

/* ── Hash display ─────────────────────────────────────────────────────── */

.hash-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-top: 0.75rem;
  word-break: break-all;
}

#hash-value {
  flex: 1;
  font-size: 0.8rem;
  color: var(--green);
  line-height: 1.5;
}

/* ── Metadata grid ────────────────────────────────────────────────────── */

#metadata-grid,
.metadata-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 0.75rem;
}

.meta-row {
  display: grid;
  grid-template-columns: minmax(160px, 30%) 1fr;
  background: var(--surface-2);
  gap: 0;
}

.meta-key {
  padding: 0.55rem 0.875rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--surface);
  border-right: 1px solid var(--border);
  word-break: break-word;
}

.meta-value {
  padding: 0.55rem 0.875rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text);
  word-break: break-word;
}

/* ── Detail grid (for tx results) ─────────────────────────────────────── */

.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 1rem;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

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

.detail-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  min-width: 140px;
  flex-shrink: 0;
}

.detail-value {
  flex: 1;
  font-size: 0.85rem;
  word-break: break-all;
}

.hash-break {
  word-break: break-all;
  line-height: 1.6;
}

/* ── Status bar ───────────────────────────────────────────────────────── */

.status-bar {
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.status-loading {
  background: rgba(124, 92, 252, 0.1);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
}

.status-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.status-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.status-info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.1s;
  text-decoration: none;
}

.primary-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  text-decoration: none;
}

.secondary-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-2);
}

/* ── Transaction actions row ─────────────────────────────────────────── */

.tx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ── Verify page ──────────────────────────────────────────────────────── */

.verify-input-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.verify-input-row input {
  flex: 1;
  min-width: 250px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.15s;
}

.verify-input-row input:focus {
  border-color: var(--accent);
}

.verify-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

/* ── Recent submissions ───────────────────────────────────────────────── */

#recent-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 0.75rem;
}

.recent-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.825rem;
}

.recent-card:last-child {
  border-bottom: none;
}

.recent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.recent-ts {
  color: var(--text);
}
.recent-file {
  font-size: 0.775rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-hash {
  font-family: var(--font-mono);
  color: var(--green);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.recent-seq {
  font-size: 0.775rem;
  flex-shrink: 0;
}

/* ── Small drop zone (verify page hash check) ────────────────────────── */

.drop-zone-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-dim);
  transition:
    border-color 0.2s,
    background 0.2s;
  text-align: center;
  outline: none;
  margin-top: 0.75rem;
}

.drop-zone-sm:hover,
.drop-zone-sm:focus,
.drop-zone-sm.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text);
}

/* ── Privacy toggle ───────────────────────────────────────────────────── */

.privacy-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border-2);
  border-radius: 24px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}

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

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ── Device key banner ────────────────────────────────────────────────── */

.proof-key-banner {
  background: rgba(124, 92, 252, 0.08);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1rem;
}

.proof-key-banner h3 {
  padding-top: 0;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.proof-key-box {
  margin-top: 0.5rem;
}

.proof-key-box .mono {
  flex: 1;
  font-size: 0.85rem;
  color: var(--yellow);
  word-break: break-all;
  line-height: 1.5;
}

/* ── Device key indicator ────────────────────────────────────────────── */

.dk-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}

.dk-indicator span {
  color: var(--green);
  font-size: 0.85rem;
  flex: 1;
}

/* ── Encrypted notice (verify page) ──────────────────────────────────── */

.encrypted-notice {
  background: rgba(124, 92, 252, 0.08);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 0.75rem;
}

.encrypted-notice h3 {
  padding-top: 0;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

/* ── Scrollbar ────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  header {
    padding: 0.75rem 1rem;
  }
  main {
    padding: 1.5rem 1rem 3rem;
  }
  section {
    padding: 1.25rem;
  }
  h1 {
    font-size: 1.5rem;
  }
  .detail-label {
    min-width: 110px;
  }

  #preview-section {
    flex-direction: column;
  }
  #preview-wrap {
    width: 100%;
    height: 200px;
  }
}
