/* ==========================================================================
   SHAMOSH SHTIBLE POS — v2.39 additions
   Site loader, card charge status, camera barcode scanner and text receipts.
   ========================================================================== */

/* ---- Shared spinner ------------------------------------------------------ */
.pos-spinner { --size: 44px; --ring: 4px; position: relative; display: inline-block; width: var(--size); height: var(--size); flex: 0 0 auto; }
.pos-spinner::before, .pos-spinner::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: var(--ring) solid transparent; }
.pos-spinner::before { border-color: color-mix(in srgb, var(--brand) 14%, transparent); }
.pos-spinner::after { border-top-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 55%, transparent); animation: pos-spin .85s cubic-bezier(.55,.15,.45,.85) infinite; }
.pos-spinner.small { --size: 18px; --ring: 2.5px; }
.pos-spinner.on-dark::before { border-color: rgba(255,255,255,.18); }
.pos-spinner.on-dark::after { border-top-color: #fff; border-right-color: rgba(255,255,255,.55); }
@keyframes pos-spin { to { transform: rotate(360deg); } }

/* The existing sign-in spinner matches the new look. */
.auth-spinner { width: 40px; height: 40px; border: 4px solid color-mix(in srgb, var(--brand) 14%, transparent); border-top-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 55%, transparent); animation: pos-spin .85s cubic-bezier(.55,.15,.45,.85) infinite; }

/* ---- Full-site loader ---------------------------------------------------- */
.pos-loader { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: radial-gradient(circle at 50% 38%, #1d5a4c 0%, #0f2a24 62%, #0a1d19 100%); color: #fff; transition: opacity .45s ease, visibility .45s; }
.pos-loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.pos-loader-inner { display: grid; justify-items: center; gap: 22px; text-align: center; padding: 24px; }
.pos-loader-mark { position: relative; width: 124px; height: 124px; display: grid; place-items: center; }
.pos-loader-mark svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: pos-spin 1.6s linear infinite; }
.pos-loader-mark svg.ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.pos-loader-mark .track { stroke: rgba(255,255,255,.1); }
.pos-loader-mark .arc { stroke: url(#pos-loader-gradient); stroke-dasharray: 120 400; animation: pos-arc 1.6s ease-in-out infinite; }
@keyframes pos-arc { 0% { stroke-dasharray: 20 400; } 50% { stroke-dasharray: 170 400; } 100% { stroke-dasharray: 20 400; } }
.pos-loader-mark .brand-mark { width: 76px; height: 76px; border-radius: 22px; margin: 0; animation: pos-breathe 1.6s ease-in-out infinite; }
.pos-loader-mark .brand-glyph { width: 60px; height: 60px; }
@keyframes pos-breathe { 50% { transform: scale(.94); } }
.pos-loader h1 { margin: 0; font-size: 20px; letter-spacing: .14em; font-weight: 800; }
.pos-loader p { margin: -12px 0 0; color: #b9cec7; font-size: 14px; letter-spacing: .02em; }
.pos-loader-dots { display: inline-flex; gap: 6px; }
.pos-loader-dots i { width: 7px; height: 7px; border-radius: 50%; background: #ffd27a; animation: pos-dot 1.2s ease-in-out infinite; }
.pos-loader-dots i:nth-child(2) { animation-delay: .15s; background: #ef6f7b; }
.pos-loader-dots i:nth-child(3) { animation-delay: .3s; background: #9fe0c4; }
@keyframes pos-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-7px); opacity: 1; } }
.pos-loader small { max-width: 300px; color: #7f9c94; font-size: 13px; line-height: 1.45; opacity: 0; transition: opacity .4s; }
.pos-loader.slow small { opacity: 1; }

/* ---- Card charge status -------------------------------------------------- */
.charge-status { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; background: rgba(10, 20, 17, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in .18s ease; }
.charge-status[hidden] { display: none; }
.charge-card { width: min(100%, 360px); display: grid; justify-items: center; gap: 10px; padding: 34px 28px 28px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; animation: modal-in .22s cubic-bezier(.2,.9,.3,1.2); }
.charge-card h2 { margin: 8px 0 0; font-size: 22px; }
.charge-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.charge-card .charge-amount { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.charge-card .pos-spinner { --size: 84px; --ring: 6px; }
.charge-card .charge-card-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.charge-card .primary-button, .charge-card .secondary-button { margin-top: 10px; min-width: 160px; }
.charge-mark { width: 92px; height: 92px; }
.charge-mark circle { fill: none; stroke-width: 6; stroke-dasharray: 280; stroke-dashoffset: 280; animation: charge-draw .55s cubic-bezier(.65,0,.35,1) forwards; }
.charge-mark path { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 80; stroke-dashoffset: 80; animation: charge-draw .35s .45s cubic-bezier(.65,0,.35,1) forwards; }
.charge-mark .fill { stroke: none; transform-origin: center; transform: scale(0); animation: charge-fill .35s .35s cubic-bezier(.2,.9,.3,1.4) forwards; }
.charge-mark.ok circle:not(.fill) { stroke: var(--ok); }
.charge-mark.ok .fill { fill: var(--ok); }
.charge-mark.fail circle:not(.fill) { stroke: var(--danger); }
.charge-mark.fail .fill { fill: var(--danger); }
.charge-status.ok .charge-card { box-shadow: 0 0 0 10px var(--ok-soft), var(--shadow-lg); }
.charge-status.fail .charge-card { box-shadow: 0 0 0 10px var(--danger-soft), var(--shadow-lg); animation: modal-in .22s cubic-bezier(.2,.9,.3,1.2), charge-shake .45s .55s ease; }
.charge-status.ok h2 { color: var(--ok); }
.charge-status.fail h2 { color: var(--danger); }
@keyframes charge-draw { to { stroke-dashoffset: 0; } }
@keyframes charge-fill { to { transform: scale(1); } }
@keyframes charge-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
/* Stripe M2 / terminal reader screens keep their buttons, so they show an inline spinner instead of the overlay. */
.saved-card-confirm.reader-waiting > span:first-child { font-size: 0; display: grid; place-items: center; }
.saved-card-confirm.reader-waiting > span:first-child::after { content: ""; width: 26px; height: 26px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--brand) 14%, transparent); border-top-color: var(--accent); animation: pos-spin .85s linear infinite; }
button .pos-spinner.small { margin-right: 2px; }
button.is-busy { pointer-events: none; }

/* ---- Camera barcode scanner ---------------------------------------------- */
.camera-scan-button { min-width: 50px; height: 50px; min-height: 50px; padding: 0 14px; }
.camera-scan-button .ic { width: 22px; height: 22px; }
.camera-field-button { width: 46px; min-width: 46px; height: 46px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--brand-text); }
.camera-field-button .ic { width: 20px; height: 20px; }
.camera-field-wrap { display: flex; gap: 8px; align-items: center; }
.camera-field-wrap input { flex: 1; min-width: 0; }

.camera-scanner { position: fixed; inset: 0; z-index: 160; display: flex; flex-direction: column; background: #050b09; color: #fff; animation: fade-in .2s ease; }
.camera-scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-scanner .camera-shade { position: absolute; inset: 0; pointer-events: none; }
.camera-frame { position: absolute; left: 50%; top: 46%; width: min(78vw, 440px); height: min(40vw, 220px); transform: translate(-50%, -50%); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(5, 11, 9, .58); transition: box-shadow .2s; }
.camera-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; }
.camera-frame i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 22px; }
.camera-frame i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 22px; }
.camera-frame i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 22px; }
.camera-frame i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 22px; }
.camera-laser { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; border-radius: 2px; background: #ef6f7b; box-shadow: 0 0 12px 2px rgba(239, 111, 123, .85); animation: camera-laser 1.8s ease-in-out infinite; }
@keyframes camera-laser { 0%, 100% { top: 14%; } 50% { top: 86%; } }
.camera-scanner.hit .camera-frame i { border-color: #6fe0a8; }
.camera-scanner.hit .camera-laser { background: #6fe0a8; box-shadow: 0 0 14px 3px rgba(111, 224, 168, .9); animation-play-state: paused; }
.camera-scanner.miss .camera-frame i { border-color: #ffb36b; }
.camera-top, .camera-bottom { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px; }
.camera-bottom { margin-top: auto; flex-direction: column; padding: 14px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
.camera-title { display: grid; gap: 2px; }
.camera-title strong { font-size: 17px; }
.camera-title small { color: rgba(255,255,255,.7); font-size: 13px; }
.camera-icon-button { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.camera-icon-button .ic { width: 22px; height: 22px; }
.camera-icon-button.on { background: #ffd27a; color: #1b2421; border-color: #ffd27a; }
.camera-icon-button[hidden] { display: none; }
.camera-tools { display: flex; gap: 10px; }
.camera-result { min-height: 52px; max-width: 440px; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: rgba(15, 42, 36, .82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 15px; font-weight: 650; }
.camera-result .dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #9fe0c4; box-shadow: 0 0 0 4px rgba(159,224,196,.25); }
.camera-result.warn .dot { background: #ffb36b; box-shadow: 0 0 0 4px rgba(255,179,107,.25); }
.camera-result.flash { animation: camera-pop .35s cubic-bezier(.2,.9,.3,1.4); }
@keyframes camera-pop { from { transform: scale(.94); } }
.camera-done { width: 100%; max-width: 440px; min-height: 52px; border: 0; border-radius: 14px; background: #fff; color: #0f2a24; font-size: 16px; font-weight: 800; }
.camera-starting { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; align-content: center; gap: 16px; color: rgba(255,255,255,.8); font-size: 15px; text-align: center; padding: 30px; }
.camera-starting[hidden] { display: none; }
.camera-error { max-width: 360px; display: grid; gap: 14px; justify-items: center; }
.camera-error strong { font-size: 18px; color: #fff; }

/* ---- Text receipts ------------------------------------------------------- */
.text-receipt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 18px; align-items: start; }
.text-receipt-preview { position: relative; max-height: 320px; overflow: hidden; border-radius: 14px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.text-receipt-preview img { display: block; width: 100%; height: auto; }
.text-receipt-preview .pos-spinner { margin: 60px auto; display: block; --size: 34px; }
.text-receipt-preview::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: linear-gradient(transparent, var(--sunken)); }
.phone-bubble { display: flex; gap: 10px; align-items: flex-start; margin-top: 4px; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--brand-soft); color: var(--brand-text); font-size: 14px; line-height: 1.4; }
.text-sent { display: grid; justify-items: center; gap: 8px; padding: 12px 0 4px; text-align: center; }
.text-sent h3 { margin: 6px 0 0; font-size: 20px; color: var(--ok); }
.text-sent p { margin: 0; color: var(--muted); }
.twilio-steps { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
@media (max-width: 560px) {
  .text-receipt-layout { grid-template-columns: 1fr; }
  .text-receipt-preview { max-height: 200px; max-width: 200px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .pos-loader-mark svg.ring, .pos-loader-mark .arc, .pos-loader-mark .brand-mark, .pos-loader-dots i, .camera-laser { animation-duration: 3s; }
}
.phone-bubble .ic { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
