/* Onboarding */
.view-onboarding {
  justify-content: center;
  min-height: calc(100vh - var(--space-6));
}

.onboarding-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-contrast);
}

.onboarding-hero h1 {
  font-size: 26px;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Home */
.home-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.rate-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.rate-value {
  font-size: 15px;
  font-weight: 700;
}

.rate-label {
  font-size: 11px;
  color: var(--text-muted);
}

.scan-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 20px;
  border-radius: var(--radius-lg);
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(52, 211, 153, 0.25);
}

.scan-cta:active {
  transform: scale(0.98);
}

.scan-cta-icon {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--accent-contrast);
  border-radius: 6px;
  position: relative;
}

.scan-cta-icon::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 3px;
  background: var(--accent-contrast);
}

.savings-teaser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.savings-teaser-label {
  color: var(--text-muted);
  font-size: 12px;
}

.savings-teaser-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

.savings-teaser-sub {
  color: var(--accent);
  font-size: 13px;
  margin-top: 2px;
}

.chevron {
  color: var(--text-muted);
  font-size: 22px;
}

.install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
}

.install-btn:active {
  transform: scale(0.98);
}

.install-btn-icon {
  color: var(--accent);
  font-size: 16px;
}

.install-btn[hidden] {
  display: none;
}

/* Scan / camera */
.scan-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}

.scan-title {
  font-weight: 600;
  font-size: 15px;
}

.scan-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.scan-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  padding: 0 var(--space-3);
}

.viewfinder {
  position: relative;
  flex: 1;
  min-height: 55vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* No brightness/contrast filter here on purpose: a static CSS boost
     helps in a genuinely dark room but actively blows out already-bright
     subjects (a paper receipt/tag under flash or good light — the common
     case), and there's no single fixed value that's right for both. The
     camera's own auto-exposure already does this better than a guess; the
     torch button is the real fix for actually-dark scenes. */
}

/* A centered horizontal crop frame (price tags/receipt totals read as wide
   lines, not tall ones) with a spotlight mask: the huge box-shadow spread
   darkens everything OUTSIDE the frame, leaving the framed area at full
   (already brightness-boosted) video clarity — standard scanner-UI trick. */
.viewfinder-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 84%;
  height: 26%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.scan-pill {
  position: absolute;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(11, 15, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.scan-pill[hidden] {
  display: none;
}

.scan-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pill-pulse 1.2s ease-in-out infinite;
}

@keyframes pill-pulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.capture-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--text);
  border: 4px solid rgba(255, 255, 255, 0.25);
  align-self: center;
  margin-bottom: var(--space-2);
}

.capture-btn:active {
  transform: scale(0.94);
}

/* Confirm */
.confirm-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg);
  flex: 1;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.price-currency {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 15px;
}

.price-input-wrap input {
  flex: 1;
  /* Flex items default to min-width: auto, so a number input's own
     intrinsic minimum width can force this row (and the whole page, once
     autofocus scrolls it into view on a real phone) wider than the
     viewport — min-width: 0 lets it actually shrink to fit. */
  min-width: 0;
  width: 100%;
  background: none;
  border: none;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.price-input-wrap input:focus {
  outline: none;
}

.translation-card {
  background: linear-gradient(160deg, var(--bg-elevated-2), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.translation-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: var(--space-2);
}

.translation-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--accent);
}

/* Savings */
.savings-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.savings-total {
  font-size: 34px;
  font-weight: 800;
}

.savings-total-sub {
  color: var(--text-muted);
  font-size: 14px;
}

.stat-compare {
  display: flex;
  gap: var(--space-3);
}

.stat-compare-item {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
}

.stat-compare-item:active {
  transform: scale(0.98);
}

.stat-compare-item-active {
  border-color: var(--accent);
  background: rgba(52, 211, 153, 0.08);
}

.stat-compare-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.stat-compare-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

.scan-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.scan-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.scan-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elevated-2);
  flex-shrink: 0;
}

.scan-item-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.scan-item-price {
  font-weight: 700;
  font-size: 15px;
}

.scan-item-time {
  color: var(--accent);
  font-size: 13px;
}

.scan-item-date {
  color: var(--text-muted);
  font-size: 12px;
}

.scan-item-delete {
  color: var(--text-muted);
  font-size: 20px;
  padding: var(--space-2);
}

/* Settings */
.privacy-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  padding: 0 var(--space-2);
}

.danger-zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid rgba(229, 72, 77, 0.35);
  border-radius: var(--radius-md);
  background: rgba(229, 72, 77, 0.06);
}

.danger-zone-title {
  color: var(--danger-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.danger-zone-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.app-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-version {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.app-build {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

.app-credit {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  opacity: 0.7;
}
