/* ── APP SHELL ───────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 40px;
}

/* ── HEADER ─────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(12px);
  z-index: 100;
  min-height: 60px;
}

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

/* ── LOGO: image (logo.png) ─────────────────────────── */
/* Drop logo.png in the project root — it auto-displays here.
   If logo.png is missing, the text fallback shows instead.   */
.logo-img {
  height: 36px;         /* ← adjust to fit your logo height  */
  width: auto;
  max-width: 160px;     /* ← cap width so it doesn't overflow */
  object-fit: contain;
  display: block;
}

/* ── LOGO: text fallback (shown if logo.png not found) ── */
.logo-fallback {
  display: none;        /* hidden by default — shown via onerror */
  align-items: center;
  gap: 10px;
}

.logo-mark {
  color: var(--accent);
  font-size: 22px;
  animation: spin 8s linear infinite;
}

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

.logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.header-badge {
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ── MAIN ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 0 24px;
}

/* ── VIEWS ──────────────────────────────────────────── */
.view {
  animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ── HOME VIEW ──────────────────────────────────────── */
.view--home { padding-top: 32px; }

.hero { margin-bottom: 40px; }

.hero-visual {
  position: relative;
  margin-bottom: 28px;
  height: 72px;
}

.barcode-art {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
}

.bar {
  flex: 1;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  animation: barPulse 3s ease-in-out infinite;
}
.bar:nth-child(even) { background: var(--accent3); }

@keyframes barPulse {
  0%, 100% { transform: scaleY(1); }
  50%       { transform: scaleY(0.6); }
}

.scan-flash {
  position: absolute;
  top: -4px; left: 0; right: 0;
  height: 2px;
  background: var(--scan-line);
  box-shadow: 0 0 12px var(--accent);
  animation: scanMove 2s ease-in-out infinite;
}

@keyframes scanMove {
  0%   { top: -4px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 64px; opacity: 0; }
}

.hero-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(42px, 12vw, 72px);
  line-height: 0.95;
  letter-spacing: -2px;
  margin-bottom: 16px;
}
.hero-title em { font-style: normal; color: var(--accent); }

.hero-sub { font-size: 13px; line-height: 1.7; color: var(--muted); }

/* ── BUTTONS ────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}
.btn-primary:hover { background: #00e88a; transform: translateY(-2px); box-shadow: var(--glow); }
.btn-primary:active { transform: translateY(0); }
.btn-icon   { font-size: 18px; }
.btn-arrow  { margin-left: auto; font-size: 18px; }

.btn-secondary {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--muted); background: var(--surface); }

.btn-outline {
  flex: 1;
  padding: 14px 20px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-outline:hover { background: rgba(0,255,157,0.08); }

/* ── SUPPORTED FORMATS ──────────────────────────────── */
.supported-formats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}
.sf-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.sf-chip {
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  background: var(--surface);
}

/* ── SCANNING VIEW ──────────────────────────────────── */
.view--scanning { padding-top: 24px; }

.scanner-container {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 4/3;
}

.scanner-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  transition: box-shadow 0.3s ease;
}

/* Flash on successful scan */
.scanner-viewport.flash {
  box-shadow: 0 0 0 4px var(--accent), 0 0 40px var(--accent);
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
}

.scan-frame {
  width: 65%;
  aspect-ratio: 2/1;
  position: relative;
}

.corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--accent);
  border-style: solid;
}
.corner.tl { top: 0; left: 0;  border-width: 3px 0 0 3px; }
.corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; }
.corner.bl { bottom: 0; left: 0;  border-width: 0 0 3px 3px; }
.corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; }

.scan-laser {
  position: absolute;
  left: 4px; right: 4px;
  height: 2px;
  background: var(--scan-line);
  box-shadow: 0 0 8px var(--accent), 0 0 20px var(--accent);
  animation: laserMove 1.8s ease-in-out infinite;
  top: 50%;
}

@keyframes laserMove {
  0%   { top: 10%; opacity: 0.8; }
  50%  { top: 90%; opacity: 1;   }
  100% { top: 10%; opacity: 0.8; }
}

/* ── Confirmation dots (anti-shake indicator) ────────── */
.confirm-bar {
  display: flex;
  gap: 6px;
  align-items: center;
}

.confirm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  transition: all 0.15s ease;
}

.confirm-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  transform: scale(1.2);
}

.scan-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.scanner-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.scan-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.status-dot.pulsing {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0,255,157,0.4); }
  50%       { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(0,255,157,0); }
}

/* ── RESULT VIEW ────────────────────────────────────── */
.view--result { padding-top: 28px; }

.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  animation: resultIn 0.4s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes resultIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.result-icon { font-size: 40px; }
.result-type { font-family: var(--font-head); font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.result-format-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(0,255,157,0.1);
  border: 1px solid rgba(0,255,157,0.3);
  color: var(--accent);
  border-radius: 20px;
  font-family: var(--font-mono);
}

.result-code-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #000;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-family: var(--font-mono);
}
.rcb-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.rcb-value { flex: 1; font-size: 15px; color: var(--accent); word-break: break-all; letter-spacing: 1px; }

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.result-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.rd-title { padding: 12px 20px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--border); }
.rd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  transition: background 0.15s;
}
.rd-row:last-child { border-bottom: none; }
.rd-row:hover { background: rgba(255,255,255,0.02); }
.rd-key { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rd-val { font-size: 13px; font-family: var(--font-mono); color: var(--text); text-align: right; word-break: break-all; }

.result-actions { display: flex; gap: 12px; margin-bottom: 16px; }
.result-actions .btn-primary { flex: 1; }

.scan-timestamp { text-align: center; font-size: 11px; color: var(--muted); }

/* ── ERROR VIEW ─────────────────────────────────────── */
.view--error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 24px;
  gap: 16px;
}
.error-icon { font-size: 48px; color: var(--accent2); animation: shake 0.5s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-8px); }
  75%       { transform: translateX(8px); }
}
.error-title { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--accent2); }
.error-msg { color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ── HISTORY ─────────────────────────────────────────── */
.history-section { margin: 8px 24px 0; border-top: 1px solid var(--border); padding-top: 24px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.history-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.clear-btn { background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; font-family: var(--font-mono); transition: color 0.2s; }
.clear-btn:hover { color: var(--accent2); }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.history-item:hover { border-color: var(--muted); transform: translateX(4px); }
.hi-icon { font-size: 20px; }
.hi-body { flex: 1; min-width: 0; }
.hi-type { font-size: 11px; color: var(--muted); display: block; margin-bottom: 2px; }
.hi-code { font-size: 13px; font-family: var(--font-mono); color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-time { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 380px) {
  .main-content { padding: 0 16px; }
  .history-section { margin: 8px 16px 0; }
}
