/* ==========================================================================
   Maka Beverage POS — styles-v2.css
   Design: Stitch Premium Kiosk System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens
   -------------------------------------------------------------------------- */
:root {
  --primary:             #a33900;
  --primary-light:       #FB923C;
  --primary-dark:        #C2410C;
  --primary-cta:         #EA580C;
  --primary-bg-tint:     rgba(234, 88, 12, 0.08);
  --header-gradient-end: #F97316;

  --background:                #FFF7ED;
  --card-bg:                   #FFFFFF;
  --surface:                   #faf8ff;
  --surface-container:         #eaedff;
  --surface-container-high:    #e2e7ff;
  --surface-container-highest: #dae2fd;
  --surface-container-low:     #f2f3ff;

  --on-surface:     #131b2e;
  --on-background:  #131b2e;
  --on-primary:     #ffffff;
  --text-secondary: #5C4F3D;
  --text-muted:     #A88F76;

  --outline:         #8e7166;
  --outline-variant: #e2bfb2;

  --success: #16A34A;
  --danger:  #DC2626;
  --warning: #D97706;

  --header-height:      68px;
  --sidebar-width:      340px;
  --screen-margin:      24px;
  --gutter:             16px;
  --radius-card:        24px;
  --radius-xl:          16px;
  --radius-lg:          12px;
  --radius-md:          8px;
  --radius-full:        9999px;

  --font-family: 'Sarabun', sans-serif;

  --shadow-card:        0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-card-active: 0 10px 30px rgba(234, 88, 12, 0.28);
  --shadow-header:      0 4px 16px rgba(234, 88, 12, 0.30);
  --shadow-pay-btn:     0 4px 16px rgba(234, 88, 12, 0.35);
  --shadow-sidebar:     -4px 0 16px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: fixed;
}

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--on-background);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
button  { outline: none; }

/* --------------------------------------------------------------------------
   3. App Container
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--header-height);
  background: linear-gradient(to right, var(--primary), var(--header-gradient-end));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--screen-margin);
  box-shadow: var(--shadow-header);
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--on-primary);
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.app-title-icon { display: none; }

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

.network-status {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.20);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-md);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.network-status.offline .status-dot { background: var(--danger); }

#sync-status { display: none; }

.btn-sync {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.20);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-md);
  color: var(--on-primary);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.btn-sync:hover  { background: rgba(255,255,255,0.30); }
.btn-sync:active { transform: scale(0.95); }

/* --------------------------------------------------------------------------
   5. Main Layout
   -------------------------------------------------------------------------- */
.app-main {
  display: flex;
  height: 100vh;
  padding-top: var(--header-height);
}

/* --------------------------------------------------------------------------
   6. Products Section
   -------------------------------------------------------------------------- */
.products-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.section-header {
  padding: 32px var(--screen-margin) 12px;
}

.section-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--on-surface);
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.products-grid {
  flex: 1;
  overflow-y: auto;
  /* Reserve the fixed bottom-cart's height (up to 65vh expanded) so the last row of cards
     always scrolls clear of the cart and stays tappable. A fixed 200px was too short on taller
     screens → cards hid behind the cart. scroll-padding keeps a selected card off the top edge
     (its 2px orange border was clipped by the scroll container otherwise). */
  padding: 0 var(--screen-margin) calc(65vh + 24px);
  scroll-padding-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gutter);
  align-content: start;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.products-grid::-webkit-scrollbar { display: none; }

/* --------------------------------------------------------------------------
   7. Product Card
   -------------------------------------------------------------------------- */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  -webkit-user-select: none;
  user-select: none;
}

.product-card:hover  { box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.product-card:active { transform: scale(0.98); }

.product-card.selected {
  border-color: var(--primary-cta);
  background: linear-gradient(160deg, #FFF5EE 0%, #FFFAF7 100%);
  /* No translateY: lifting the card pushed its top border under the scroll container's top
     edge (.products-grid overflow-y:auto), clipping the orange border on the first row. Convey
     selection with shadow only — a stable interaction state that never shifts layout bounds. */
  box-shadow: var(--shadow-card-active);
}

.product-icon-container {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  background: linear-gradient(135deg, #EA580C 0%, #FFF7ED 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  flex-shrink: 0;
}

.product-card img {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  object-fit: cover;
}

.product-name        { font-size: 16px; font-weight: 700; color: var(--on-surface); line-height: 1.3; }
.product-description { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.product-price       { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.product-unavailable { font-size: 14px; font-weight: 700; color: #9ca3af; }

/* --------------------------------------------------------------------------
   8. Bottom Cart (Mobile / Tablet)
   -------------------------------------------------------------------------- */
.bottom-cart {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  background: var(--surface-container);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  max-height: 55vh;
  transition: max-height 0.3s ease;
}

.bottom-cart.expanded { max-height: 65vh; }

.cart-handle {
  padding: 12px;
  display: flex;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.cart-handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--outline-variant);
}

.cart-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
}

.cart-content::-webkit-scrollbar { display: none; }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--card-bg);
  border: 2px dashed var(--outline-variant);
  border-radius: var(--radius-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.cart-empty-icon { font-size: 32px; opacity: 0.5; }

.cart-selected {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 2px solid var(--primary-bg-tint);
}

.cart-product-icon {
  font-size: 32px;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, #EA580C 0%, #FFF7ED 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cart-product-image {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-product-details { flex: 1; min-width: 0; }

.cart-product-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-product-price {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.volume-selection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

/* FIXED-price packages get their own grid: fewer, wider columns so the 3-line buttons breathe
   instead of being squeezed into 3 narrow cells. Applied when the container holds FIXED buttons. */
.volume-selection.is-fixed-price {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.volume-btn {
  height: 48px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--outline-variant);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
  user-select: none;
}

.volume-btn:hover  { background: var(--primary-bg-tint); }
.volume-btn:active { transform: scale(0.97); }

.volume-btn.selected {
  background: var(--primary-cta);
  color: var(--on-primary);
  border-color: var(--primary-cta);
}

/* FIXED price package button — taller card-like button: label / volume / price stacked.
   Roomier than the plain volume button so the three lines don't feel cramped. */
.fixed-price-btn {
  height: auto;
  min-height: 88px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 12px;
  border-radius: var(--radius-lg, 16px);
}

.fixed-price-btn .fpb-label {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--on-surface);
}

.fixed-price-btn .fpb-volume {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.65;
  line-height: 1.1;
}

.fixed-price-btn .fpb-price {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--primary-cta);
}

/* When selected the whole button turns orange — flip text colors so they stay readable. */
.fixed-price-btn.selected .fpb-label,
.fixed-price-btn.selected .fpb-price { color: var(--on-primary); }
.fixed-price-btn.selected .fpb-volume { opacity: 0.85; }

.cart-actions {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--outline-variant);
  flex-shrink: 0;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-total-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-cta);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-total-amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.btn-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-reset:hover { background: var(--primary-bg-tint); }

.btn-pay {
  width: 100%;
  height: 56px;
  background: var(--primary-cta);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-xl);
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-pay-btn);
  transition: background 0.15s, transform 0.1s;
  -webkit-user-select: none;
  user-select: none;
}

.btn-pay:hover:not(:disabled)  { background: var(--primary-dark); }
.btn-pay:active:not(:disabled) { transform: scale(0.98); }
.btn-pay:disabled { background: #D4B896; box-shadow: none; cursor: not-allowed; }
.btn-pay-icon     { font-size: 20px; }

/* --------------------------------------------------------------------------
   9. Tablet 768–1023px
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    /* The bottom cart is a fixed overlay up to 65vh tall (when expanded). A fixed 200px bottom
       padding left the last row of cards hidden behind it on tablet, so they couldn't be tapped.
       Reserve the cart's full height + breathing room so every card scrolls clear of the cart. */
    padding-bottom: calc(65vh + 24px);
  }
  .bottom-cart           { max-height: 55vh; }
  .bottom-cart.expanded  { max-height: 65vh; }
}

/* --------------------------------------------------------------------------
   10. Desktop ≥1024px — Sidebar Cart
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .products-section {
    margin-right: var(--sidebar-width);
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: var(--screen-margin);
  }

  .bottom-cart {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: auto;
    width: var(--sidebar-width);
    max-height: none;
    height: calc(100vh - var(--header-height));
    border-radius: 0;
    box-shadow: var(--shadow-sidebar);
    background: var(--surface-container);
  }

  .cart-handle { display: none; }

  .cart-content {
    padding: 24px 20px 8px;
    gap: 16px;
  }

  .cart-actions {
    padding: 16px 20px 24px;
  }

  .btn-pay          { height: 64px; }
  .volume-btn:not(.fixed-price-btn) { height: 56px; }
  .cart-total-amount { font-size: 28px; }

  .volume-selection {
    grid-template-columns: repeat(3, 1fr);
  }
  /* FIXED-only packages: 2 wide columns in the sidebar so each 3-line button has room to breathe
     (3 columns made them cramped). Overrides the 3-col rule above. */
  .volume-selection.is-fixed-price {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* --------------------------------------------------------------------------
   11. Progress / Dispensing Screen
   -------------------------------------------------------------------------- */
.progress-section {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--background);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.progress-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-height) + 24px) var(--screen-margin) 100px;
  gap: 24px;
  text-align: center;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* Old emoji icon not used in Stitch design */
.progress-icon { display: none; }

.progress-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--on-surface);
  letter-spacing: -0.03em;
}

.progress-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

.progress-circle {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}

.progress-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 4px 16px rgba(234, 88, 12, 0.20));
}

.progress-circle-bg {
  fill: none;
  stroke: var(--surface-container-high);
  stroke-width: 8;
}

/* JS sets stroke-dashoffset directly — no CSS transition per DOM contract */
.progress-circle-fill {
  fill: none;
  stroke: var(--primary-cta);
  stroke-width: 8;
  stroke-linecap: round;
}

.progress-circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.progress-percent {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.03em;
  line-height: 1;
}

.progress-volume {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Pulsing status pill */
.progress-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--primary-bg-tint);
  border-radius: var(--radius-full);
  color: var(--primary-cta);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: ping 1.5s ease-in-out infinite;
}

@keyframes ping {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.6; }
}

.progress-info-card {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-info-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.btn-cancel-progress {
  position: fixed;
  bottom: var(--screen-margin);
  left: var(--screen-margin);
  right: var(--screen-margin);
  max-width: 520px;
  margin: 0 auto;
  height: 56px;
  background: rgba(220, 38, 38, 0.08);
  border: 2px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-xl);
  color: var(--danger);
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
}

.btn-cancel-progress:hover  { background: rgba(220, 38, 38, 0.14); }
.btn-cancel-progress:active { transform: scale(0.98); }

/* --------------------------------------------------------------------------
   12. Success Screen
   -------------------------------------------------------------------------- */
.success-screen {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: var(--background);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--screen-margin);
  gap: 16px;
  text-align: center;
}

.success-icon    { font-size: 64px; line-height: 1; }
.success-title   { font-size: 30px; font-weight: 800; color: var(--on-surface); letter-spacing: -0.02em; }
.success-message { font-size: 16px; font-weight: 500; color: var(--text-secondary); }

.success-details {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
  margin-top: 8px;
}

.success-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}

.success-detail-label { color: var(--text-secondary); font-weight: 400; }
.success-detail-value { font-weight: 700; color: var(--on-surface); }

.btn-new-order {
  width: 100%;
  max-width: 400px;
  height: 56px;
  background: var(--primary-cta);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-xl);
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-pay-btn);
  transition: background 0.15s, transform 0.1s;
  margin-top: 8px;
}

.btn-new-order:hover  { background: var(--primary-dark); }
.btn-new-order:active { transform: scale(0.98); }

/* --------------------------------------------------------------------------
   13. QR Payment Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--screen-margin);
}

.modal-overlay.active {
  display: flex;
}

.qr-modal {
  background: var(--card-bg);
  width: 100%;
  max-width: 480px;
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.20);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: none;
}

.qr-modal::-webkit-scrollbar { display: none; }

.qr-modal-header {
  padding: 24px 24px 12px;
  text-align: center;
  position: relative;
}

.qr-modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--on-surface);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.qr-modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.qr-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: var(--surface-container-low);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.qr-modal-close:hover { background: var(--surface-container); }

.qr-modal-body {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Orange gradient border around QR */
.qr-code-container {
  background: linear-gradient(135deg, var(--primary-cta) 0%, var(--header-gradient-end) 100%);
  padding: 3px;
  border-radius: 24px;
  box-shadow: 0 6px 24px rgba(234, 88, 12, 0.22);
}

.qr-code-inner {
  background: var(--card-bg);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-code-image {
  display: block;
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.qr-payment-summary {
  width: 100%;
  background: rgba(234, 88, 12, 0.04);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.qr-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 15px;
}

.qr-summary-row + .qr-summary-row { border-top: 1px solid var(--outline-variant); }
.qr-summary-label { color: var(--text-secondary); font-weight: 400; }
.qr-summary-value { font-weight: 700; color: var(--on-surface); }

.qr-summary-row.total .qr-summary-label { color: var(--primary-cta); font-weight: 600; }
.qr-summary-row.total .qr-summary-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.qr-instruction {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.qr-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.qr-countdown-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

#qr-countdown-time {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

#qr-countdown-time.warning {
  color: var(--danger);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

#qr-status-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.qr-cancel-btn {
  width: 100%;
  height: 52px;
  background: transparent;
  border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}

.qr-cancel-btn:hover  { background: var(--surface-container-low); color: var(--on-surface); }
.qr-cancel-btn:active { transform: scale(0.98); }

/* --------------------------------------------------------------------------
   14. Loading Overlay
   -------------------------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(255, 247, 237, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--outline-variant);
  border-top-color: var(--primary-cta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text { font-size: 16px; font-weight: 500; color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   15. Toast
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--on-surface);
  box-shadow: 0 4px 16px rgba(0,0,0,0.20);
  pointer-events: all;
  animation: toast-in 0.25s ease;
  white-space: nowrap;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   16. Utility
   -------------------------------------------------------------------------- */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
