:root {
  --text: #111;
  --muted: #666;
  --border: #e5e5e5;
  --bg: #ffffff;
  --accent: #123a5f;
  --highlight: #00d4ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50px 50px;
  background-attachment: fixed;
}

.container { max-width: 960px; padding: 0 24px; margin: 0 auto; }

/* Navigation & Logo */
.nav { display: flex; align-items: center; height: 100px; gap: 12px; }
.brand { text-decoration: none; display: flex; align-items: center; gap: 12px; color: var(--accent); }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 32px; font-weight: 700; line-height: 1; }
.brand-subtitle { font-size: 0.85rem; color: var(--muted); }
.logo-scanner { width: 48px; height: 48px; color: var(--accent); }

.scanner-pixel { fill: var(--highlight); animation: blink 1.5s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Hero */
.hero { padding: 60px 0; text-align: center; }
.subtitle { color: var(--muted); font-size: 1.1rem; max-width: 600px; margin: 10px auto; }

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 40px;
  overflow: hidden;
}

.card-header { padding: 32px; border-bottom: 1px solid var(--border); }
.input-group { padding: 32px 32px 10px; }
textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; height: 80px; resize: none; font-family: inherit; }

/* Update the upload zone to be a full flex container */
/* 1. The Container: Dead-center everything inside */
.upload-zone { 
  margin: 20px 32px 32px; 
  height: 220px; 
  border: 2px dashed var(--border); 
  border-radius: 12px; 
  display: flex;             /* The centering engine */
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  position: relative;        /* Keep this relative */
  background: #fcfcfc;
}
.upload-zone.drag-over {
  border-color: var(--highlight);
  background: rgba(0, 212, 255, 0.05);
  transition: all 0.2s ease; /* Makes the color change smooth */
}

/* 2. The Text: Forces itself to the center */
.centered-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 3. The Image Wrapper: Hidden by default, NO ABSOLUTE POSITION */
.preview-wrapper, .scanner-wrapper {
  display: none;             /* COMPLETELY REMOVED from the view until needed */
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

/* 4. The helper to show image */
.is-visible {
  display: flex !important;
}

/* Scanner and Previews */

.preview-wrapper, .scanner-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;       /* CHANGE THIS from 'flex' to 'none' */
  align-items: center;
  justify-content: center;
  background: #fcfcfc;
  z-index: 10;
}

/* Add this new helper class to show them when needed */
.preview-wrapper.active, .scanner-wrapper.active {
  display: flex !important;
}

#image-preview, #verify-image-preview {
  max-height: 100%;
  max-width: 100%;
  border-radius: 4px;
}

.scan-bar { 
  position: absolute; width: 100%; height: 2px; 
  background: var(--highlight); box-shadow: 0 0 10px var(--highlight); 
  top: 0; display: none; 
}
.scanning .scan-bar { display: block; animation: scan 2s linear infinite; }
@keyframes scan { from { top: 0; } to { top: 100%; } }

.card-footer { padding: 24px 32px; background: #f9f9fb; display: flex; justify-content: space-between; align-items: center; }
.status-box { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 10px; height: 10px; background: #10b981; border-radius: 50%; }
.button.primary { background: var(--accent); color: white; padding: 12px 24px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; }
.badge { padding: 6px 14px; background: #ecfdf5; color: #10b981; border: 1px solid #10b981; border-radius: 20px; font-size: 0.85rem; font-weight: 700; }

.footer { text-align: center; padding: 40px; color: var(--muted); font-size: 0.9rem; }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: rgba(255,255,255,1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.result-box {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
  font-size: 14px;
  line-height: 1.35;
}
/* --- Never let preview images disappear --- */
.preview-wrapper img,
.scanner-wrapper img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.preview-wrapper,
.scanner-wrapper {
  min-height: 220px;
}
/* --- Verification Output Box --- */
.result-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.result-header {
  margin-bottom: 8px;
  font-size: 0.95rem;
  opacity: 0.85;
}

.result-raw {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  line-height: 1.4;
  max-height: 220px;
  overflow: auto;
} 
.sig-placeholder {
  color: #8a8a8a;
  font-style: italic;
}
.preview-note {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
}
.seal-flash {
  animation: sealFlash 0.7s ease;
}

@keyframes sealFlash {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(1.6); }
  60%  { filter: brightness(1.2); }
  100% { filter: brightness(1); }
}
.button.secondary {
  background: white;
  color: var(--accent);
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.sample-actions {
  padding: 0 32px 12px;
}

.button.secondary:hover {
  background: rgba(18, 58, 95, 0.06);
}

/* --- iPhone: make Protect footer behave like Verify (status -> 2 buttons -> signature) --- */
@media (max-width: 600px) {

  .card-footer {
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  /* 1) Status line full width */
  .card-footer .status-box {
    order: 1;
    flex: 1 1 100%;
    min-width: 0;
  }

  /* 2) First row: two buttons */
  #sign-btn,
  #protect-reset-btn {
    order: 2;
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 12px 14px;
  }

  /* 3) Second row: sample button full width */
  #protect-sample-btn {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
    padding: 12px 14px;
    margin-top: 4px;
  }

  /* 4) Seal text block below */
  .card-footer .sig-box-container {
    order: 4;
    flex: 1 1 100%;
    margin-left: 0;
    text-align: left;
  }

  .card-footer .sig-box {
    font-size: 0.95rem;
    line-height: 1.25;
  }
}
#verify-status {
  align-items: flex-start;
}

#verify-status .status-dot {
  margin-top: 6px;
  flex: 0 0 auto;
}

#verify-text {
  line-height: 1.25;
}

.verify-sep {
  color: #888;
  margin: 0 6px;
}
.file-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.file-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb; /* blue for Unverified */
}

.file-line.authentic .file-dot {
  background: #10b981; /* green for Authentic */
}
.verify-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.verify-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.verify-pill-authentic {
  background: #ecfdf5;
  color: #10b981;
  border: 1px solid #10b981;
}

.verify-pill-unverified {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #2563eb;
}

.verify-desc {
  color: #222;
}

.file-line,
.seal-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.file-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb; /* default for Unverified */
  flex: 0 0 auto;
}

.file-line.authentic .file-dot {
  background: #10b981;
}


.verify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  padding: 20px 32px 8px;
  justify-content: flex-start;
  align-items: center;
}

.verify-actions .button {
  min-height: 48px;
}
#verify-output {
  margin: 16px 32px 24px;
}
.status-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 40px;
}

  




