/* Customer page: bold brand gradient behind white cards */
body {
  background:
    radial-gradient(700px 420px at 85% -5%, rgba(255, 214, 102, .55), transparent 60%),
    radial-gradient(600px 500px at -10% 30%, rgba(255, 120, 80, .45), transparent 60%),
    linear-gradient(170deg, #e8392b 0%, #f0582c 30%, #f58a2b 60%, #f9b233 100%);
  background-attachment: fixed;
}

.stage {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  display: grid; gap: 18px;
}

.brand { display: grid; justify-items: center; gap: 8px; padding-top: 2vh; }
.hero-logo { width: min(230px, 60vw); aspect-ratio: 1.34; }
.tagline {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  text-shadow: 0 2px 10px rgba(120, 20, 0, .35);
}

.card { padding: 26px 22px 22px; background: var(--card-2); animation: pop .7s cubic-bezier(.2, .9, .3, 1.1) both; }
.card-head h2 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 28px; color: var(--navy); }
.card-head p { margin: 0 0 20px; color: var(--text-2); line-height: 1.7; }

#form { display: grid; gap: 18px; }

/* ---- 3D capture button ---- */
.capture {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  border-radius: 20px;
  cursor: pointer;
  background:
    linear-gradient(#fff7ee, #fff7ee) padding-box,
    linear-gradient(135deg, #e8392b, #f7862a 50%, #f9bd33) border-box;
  border: 2px dashed transparent;
  box-shadow: 0 7px 0 #f1c9a4, 0 18px 30px -16px rgba(200, 70, 20, .55);
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.capture:hover { transform: translateY(-2px); }
.capture:active { transform: translateY(5px); box-shadow: 0 2px 0 #f1c9a4, 0 8px 16px -10px rgba(200, 70, 20, .55); }
.capture:focus-visible { outline: 3px solid var(--navy-2); outline-offset: 3px; }
.capture.invalid { box-shadow: 0 7px 0 #f1c9a4, 0 0 0 3px rgba(211, 38, 58, .45); }
.capture-3d {
  flex: none;
  display: grid; place-items: center;
  width: 68px; height: 68px;
  border-radius: 20px;
  background: linear-gradient(145deg, #f25a38, #e8392b 55%, #c62a1c);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), inset 0 -6px 10px rgba(120, 20, 0, .35), 0 10px 18px -6px rgba(232, 57, 43, .7);
  animation: floaty 4s ease-in-out infinite;
}
.capture-text { display: grid; gap: 4px; }
.capture-text strong { font-size: 17px; color: var(--navy); }
.capture-text small { color: var(--text-2); line-height: 1.5; }

.preview {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 20px 34px -18px rgba(120, 40, 10, .6);
  transform: perspective(900px) rotateX(6deg);
  transform-origin: bottom;
  animation: rise .4s ease both;
}
.preview img { display: block; width: 100%; max-height: 280px; object-fit: cover; object-position: top; }
.preview::after {
  content: '✓ تم التقاط الصورة';
  position: absolute; top: 10px; inset-inline-start: 10px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--ok); color: #fff; font-size: 12px; font-weight: 800;
}
.preview .btn { position: absolute; bottom: 10px; inset-inline-end: 10px; }

.submit { width: 100%; padding: 17px; font-size: 18px; margin-top: 4px; }
.fine { margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---- scanning ---- */
.scanning { text-align: center; }
.scan-stage { perspective: 900px; padding: 8px 0 18px; }
.scan-paper {
  position: relative;
  width: min(220px, 68%);
  aspect-ratio: 3 / 4.2;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transform: rotateX(22deg) rotateZ(-3deg);
  box-shadow: 0 40px 50px -24px rgba(120, 30, 0, .6), 0 0 0 1px var(--line);
  animation: hover3d 3s ease-in-out infinite;
}
.scan-paper img { width: 100%; height: 100%; object-fit: cover; }
.scan-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(247, 134, 42, .14) 1px, transparent 1px), linear-gradient(90deg, rgba(247, 134, 42, .14) 1px, transparent 1px);
  background-size: 18px 18px;
}
.scan-beam {
  position: absolute; inset-inline: -10%; height: 70px; top: -70px;
  background: linear-gradient(180deg, transparent, rgba(247, 134, 42, .25) 70%, rgba(232, 57, 43, .9) 96%, transparent);
  box-shadow: 0 0 26px 6px rgba(247, 134, 42, .45);
  animation: beam 1.8s cubic-bezier(.45, 0, .55, 1) infinite;
  z-index: 2;
}
.scan-title { font-family: var(--font-display); font-weight: 800; color: var(--navy); margin: 6px 0 12px; }
.scan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: start; }
.scan-steps li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--cream);
  color: var(--text-3);
  font-weight: 700;
  transition: color .3s, background .3s;
}
.scan-steps li::before {
  content: ''; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; opacity: .5;
}
.scan-steps li.active { color: var(--navy); background: var(--cream-2); }
.scan-steps li.active::before { border-color: rgba(247, 134, 42, .25); border-top-color: var(--orange); animation: spin .8s linear infinite; opacity: 1; }
.scan-steps li.done { color: var(--ok); }
.scan-steps li.done::before { content: '✓'; border: 0; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 900; opacity: 1; }

/* ---- result ---- */
.result { text-align: center; }
.result-badge { display: grid; place-items: center; margin-top: -60px; }
.result-badge svg { filter: drop-shadow(0 14px 20px rgba(200, 60, 20, .45)); animation: badge .9s cubic-bezier(.2, 1.4, .4, 1) both; }
.result h2 { font-family: var(--font-display); font-weight: 800; color: var(--navy); margin: 10px 0 4px; font-size: 26px; }
.result-sub { margin: 0 0 18px; color: var(--text-2); line-height: 1.7; }

.visit-meter {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px; margin-bottom: 16px;
  border-radius: 18px;
  text-align: start;
  background: var(--brand-grad-soft);
  box-shadow: inset 0 0 0 1px rgba(232, 57, 43, .15);
}
.visit-count {
  flex: none; display: grid; place-items: center;
  width: 70px; height: 70px; border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(232, 57, 43, .6), inset 0 -4px 8px rgba(120, 20, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.visit-count span { font-size: 26px; font-weight: 900; line-height: 1; }
.visit-count small { font-size: 11px; font-weight: 800; margin-top: -8px; }
.visit-copy { display: grid; gap: 4px; }
.visit-copy strong { color: var(--navy); }
.visit-copy small { color: var(--text-2); }

.receipt {
  position: relative;
  margin: 0 0 20px;
  padding: 18px 18px 24px;
  border-radius: 14px;
  background: #fffdf8;
  color: var(--text);
  text-align: start;
  box-shadow: 0 0 0 1px var(--line), 0 20px 30px -20px rgba(120, 40, 10, .5);
  transform: perspective(900px) rotateX(4deg);
  -webkit-mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 50% 100% / 18px 100% repeat-x;
          mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 50% 100% / 18px 100% repeat-x;
}
.receipt-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 15px; }
.receipt-row span { color: var(--text-3); }
.receipt-items { list-style: none; margin: 8px 0; padding: 10px 0; border-block: 1.5px dashed #e3d6c6; display: grid; gap: 6px; }
.receipt-items li { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.receipt-items li .qty { color: var(--red); font-weight: 800; }
.receipt-total { display: flex; justify-content: space-between; font-size: 19px; font-weight: 900; padding-top: 4px; color: var(--navy); }
#again { width: 100%; }

@keyframes beam { 0% { top: -70px; } 100% { top: 100%; } }
@keyframes hover3d { 50% { transform: rotateX(18deg) rotateZ(-1deg) translateY(-6px); } }
@keyframes badge { from { transform: scale(0) rotate(-40deg); } }
