/* ==========================================================
   BIG SAVE ENTERPRISE DIGITAL STAMP & LOYALTY CARD
   Supermarket & Wholesale Aesthetic: Royal Blue, Vivid Gold, White
   ========================================================== */

:root {
  --bg-dark: #061124;
  --card-bg: #0b1a36;
  --card-border: rgba(0, 102, 204, 0.4);
  --meat-red: #0052cc;
  --meat-darkred: #003399;
  --gold: #fdb813;
  --gold-glow: rgba(253, 184, 19, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  touch-action: manipulation;
  display: flex;
  justify-content: center;
}

/* Touch & Confetti Canvases */
#touchCanvas, #confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

.app-container {
  width: 100%;
  max-width: 480px;
  padding: 16px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

/* ── HEADER ── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

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

.bigsave-logo-text {
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 51, 153, 0.8);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.pill-action-btn:hover {
  background: rgba(200, 16, 46, 0.2);
  border-color: var(--meat-red);
}

.backoffice-pill {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--gold);
}

/* ── 10-SLOT LOYALTY CARD ── */
.card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loyalty-card {
  position: relative;
  background: radial-gradient(circle at 85% 15%, #251218 0%, #131826 65%, #0e121d 100%);
  border: 1.5px solid var(--card-border);
  border-radius: 24px;
  padding: 22px 20px 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.loyalty-card.active-touch {
  transform: scale(0.985);
  border-color: var(--gold);
}

.card-grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: radial-gradient(#fff 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.brand-tagline {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--meat-red);
  margin-bottom: 4px;
}

.brand-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.promo-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

.branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(200, 16, 46, 0.12);
  border: 1px solid rgba(200, 16, 46, 0.35);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-top: 8px;
  cursor: pointer;
}

.card-counter-badge {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 14px;
  text-align: right;
}

.counter-num {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
}

.counter-total {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* 10-SLOT GRID (2 rows of 5) */
.stamp-grid-10 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stamp-slot {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.25s ease;
}

.slot-number {
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.25);
  position: absolute;
  top: 4px;
  left: 6px;
}

.stamp-imprint {
  width: 82%;
  height: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--meat-red);
}

.stamp-slot.stamped {
  border: 1.5px solid rgba(200, 16, 46, 0.6);
  background: rgba(200, 16, 46, 0.08);
}

.stamp-slot.stamped .stamp-imprint {
  opacity: 1;
  transform: scale(1) rotate(var(--stamp-rot, 0deg));
}

/* Slot 10 (Fuel Reward Slot) */
.stamp-slot.fuel-reward-slot {
  border: 2px dashed var(--gold);
  background: rgba(245, 158, 11, 0.06);
}

.stamp-slot.fuel-reward-slot .slot-number {
  color: var(--gold);
  font-size: 7.5px;
  font-weight: 900;
}

.stamp-slot.fuel-reward-slot.stamped {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 16px var(--gold-glow);
}

.stamp-slot.fuel-reward-slot.stamped .stamp-imprint {
  color: var(--gold);
}

/* Card Footer & Progress */
.card-footer {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.reward-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

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

.reward-info strong {
  font-size: 12px;
  color: var(--gold);
  font-weight: 800;
}

.progress-bar-container {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--meat-red), var(--gold));
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Stamp Sensor Hint */
.stamp-sensor-prompt {
  margin-top: 14px;
  background: rgba(200, 16, 46, 0.08);
  border: 1px solid rgba(200, 16, 46, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #fff;
  font-weight: 600;
}

.sensor-rings {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--meat-red);
  position: relative;
}

.sensor-rings::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  animation: pulseRings 1.8s infinite;
}

@keyframes pulseRings {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── ACTION DOCK ── */
.action-dock {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 10px;
}

.dock-btn {
  padding: 14px 16px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s, background 0.2s;
  text-align: left;
}

.dock-btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--meat-red), #990c22);
  color: #fff;
  box-shadow: 0 8px 20px rgba(200, 16, 46, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-icon {
  font-size: 24px;
}

.btn-label-group strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.btn-label-group small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

/* Status Dock */
.status-dock {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-indicator-dot.touching {
  background: var(--meat-red);
  box-shadow: 0 0 10px var(--meat-red);
}

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: #131926;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.modal-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Scanner Viewport */
.scanner-viewport {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}

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

.scan-laser {
  position: absolute;
  top: 15%;
  left: 5%;
  right: 5%;
  height: 2px;
  background: var(--meat-red);
  box-shadow: 0 0 12px var(--meat-red);
  animation: scanSweep 2s ease-in-out infinite alternate;
}

@keyframes scanSweep {
  from { top: 15%; }
  to { top: 85%; }
}

.verification-hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.hud-item.passed {
  color: #10b981;
}

.hud-item.failed {
  color: #ef4444;
}

.scanner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-scan-action {
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.btn-gold {
  background: var(--gold);
  color: #111;
}

.btn-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
}

/* ── ELIGIBILITY MODAL ── */
.modal-eligible {
  border: 2px solid #10b981;
  background: radial-gradient(circle at center, #0f2d1e 0%, #131926 70%);
}

.eligible-badge {
  font-size: 46px;
  margin-bottom: 6px;
}

.eligible-title {
  font-size: 21px;
  font-weight: 900;
  color: #10b981;
  margin-bottom: 6px;
}

.eligible-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.eligible-details-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.gold-text {
  color: var(--gold);
}

.hand-phone-instruction {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px dashed var(--gold);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
}

.instruction-arrow {
  font-size: 24px;
  animation: bounceDown 1.2s infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.hand-phone-instruction strong {
  display: block;
  font-size: 14px;
  color: #fff;
  margin-top: 4px;
}

.hand-phone-instruction p {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-full {
  width: 100%;
}

/* ── FORM ELEMENTS ── */
.form-group {
  margin-bottom: 14px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.form-input:focus {
  border-color: var(--meat-red);
}

.error-msg {
  color: #ef4444;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

/* ── STORES MODAL ── */
.stores-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.store-item.active {
  border-color: var(--meat-red);
  background: rgba(200, 16, 46, 0.12);
}

.store-item-info h4 {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}

.store-item-info p {
  font-size: 11.5px;
  color: var(--text-muted);
}

.store-item-info small {
  font-size: 10.5px;
  color: var(--gold);
}

.select-store-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
}

/* ── FUEL VOUCHERS MODAL ── */
.voucher-card {
  background: linear-gradient(135deg, #1b263b, #0d1b2a);
  border: 1.5px solid var(--gold);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.18);
}

.voucher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.voucher-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}

.voucher-status {
  background: #10b981;
  color: #111;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
}

.voucher-code-display {
  font-family: monospace;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 8px;
}

.voucher-date, .voucher-hint {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Physical Stamp Visual FX */
.physical-stamp-fx {
  position: fixed;
  width: 90px;
  height: 90px;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%) scale(2.2);
  opacity: 0;
  transition: none;
}

.physical-stamp-fx.stamping {
  animation: stampImpact 0.28s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes stampImpact {
  0% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
  45% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
  75% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.stamp-face-icon {
  width: 100%;
  height: 100%;
  color: var(--meat-red);
}

.app-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 8px 12px;
}

/* ── NATIONWIDE LOYALTY & GPS ENHANCEMENTS ── */
.nationwide-loyalty-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 6px 0 8px 0;
}

.nationwide-loyalty-badge .badge-globe {
  font-size: 13px;
}

.branch-pill-wrapper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.gps-distance-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gps-auto-detect-box {
  margin-bottom: 12px;
}

.btn-gps-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(0, 51, 153, 0.35) 0%, rgba(253, 184, 19, 0.2) 100%);
  border: 1px solid rgba(253, 184, 19, 0.45);
  border-radius: 14px;
  padding: 12px 14px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.btn-gps-trigger:hover {
  background: linear-gradient(135deg, rgba(0, 51, 153, 0.5) 0%, rgba(253, 184, 19, 0.3) 100%);
  transform: translateY(-1px);
}

.gps-icon-animated {
  font-size: 24px;
  animation: pulseRadar 2s infinite ease-in-out;
}

@keyframes pulseRadar {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.gps-btn-text strong {
  display: block;
  font-size: 13px;
  color: #fdb813;
}

.gps-btn-text small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.store-filter-wrap {
  margin-bottom: 10px;
}

.store-search-field {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 12.5px;
}

.store-search-field:focus {
  outline: none;
  border-color: #fdb813;
}

.store-desc-text {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.store-distance-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}

.store-distance-tag.nearby {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.store-distance-tag.far {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.store-item.closest-store {
  border-color: rgba(253, 184, 19, 0.6);
  background: rgba(253, 184, 19, 0.08);
}

/* GPS Toast Banner */
.gps-toast-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  width: 380px;
  background: #1e293b;
  border: 1px solid #10b981;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  animation: slideDownToast 0.3s ease-out;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #f1f5f9;
}

.toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

@keyframes slideDownToast {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
