/* ============================
   Toko Roti Antapani — Kiosk
   Fully animated playful UI
   ============================ */

/* ---------- Variables ---------- */
:root {
  --cream: #FEFCF6;
  --warm: #FFF7ED;
  --amber: #F59E0B;
  --amber-dark: #D97706;
  --amber-light: #FDE68A;
  --emerald: #10B981;
  --emerald-dark: #059669;
  --emerald-light: #A7F3D0;
  --text: #1F2937;
  --text-soft: #4B5563;
  --text-muted: #9CA3AF;
  --card: #FFFFFF;
  --card-shadow: 0 8px 32px rgba(0,0,0,0.06);
  --radius: 24px;
  --radius-sm: 14px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
}

/* ---------- Screen System ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--smooth), transform 0.5s var(--smooth);
  transform: scale(0.94);
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  z-index: 1;
}

/* ============ FLOATING PASTRIES ============ */
.pastries {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.fp {
  position: absolute;
  opacity: 0.65;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
  transition: opacity 0.6s ease;
}
.fp svg { width: 100%; height: 100%; display: block; }

.fp1  { top: 6%; left: 3%; width: 62px; height: 48px; animation: floatA 14s ease-in-out infinite; }
.fp2  { top: 12%; right: 5%; width: 52px; height: 44px; animation: floatB 12s ease-in-out infinite 0.8s; }
.fp3  { top: 30%; left: 2%; width: 44px; height: 52px; animation: floatC 16s ease-in-out infinite 0.3s; }
.fp4  { bottom: 20%; right: 3%; width: 60px; height: 50px; animation: floatA 15s ease-in-out infinite 1.2s; }
.fp5  { top: 50%; right: 8%; width: 55px; height: 48px; animation: floatB 13s ease-in-out infinite 0.6s; }
.fp6  { top: 36%; right: 2%; width: 32px; height: 58px; animation: floatC 11s ease-in-out infinite 1.8s; }
.fp7  { top: 1%; left: 38%; width: 44px; height: 38px; animation: floatA 13s ease-in-out infinite 0.1s; }
.fp8  { top: 46%; left: 1%; width: 50px; height: 36px; animation: floatB 14s ease-in-out infinite 0.9s; }
.fp9  { top: 24%; right: 1%; width: 30px; height: 52px; animation: floatC 10s ease-in-out infinite 1.5s; }
.fp10 { bottom: 5%; right: 14%; width: 42px; height: 40px; animation: floatA 12s ease-in-out infinite 0.4s; }
.fp11 { top: 3%; right: 22%; width: 38px; height: 36px; animation: floatB 11s ease-in-out infinite 1.1s; }
.fp12 { bottom: 33%; left: 12%; width: 30px; height: 52px; animation: floatC 15s ease-in-out infinite 0.7s; }

#screen-order.active ~ .pastries .fp,
#screen-payment.active ~ .pastries .fp,
#screen-confirmation.active ~ .pastries .fp {
  opacity: 0.18;
}

@keyframes floatA {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(15px, -18px) rotate(5deg); }
  50% { transform: translate(-8px, -30px) rotate(-3deg); }
  75% { transform: translate(12px, -12px) rotate(4deg); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-20px, -15px) rotate(-6deg); }
  66% { transform: translate(10px, -25px) rotate(3deg); }
}
@keyframes floatC {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(18px, -22px) scale(1.1); }
}
/* ================================
   HOME
   ================================ */
#screen-home {
  flex-direction: column;
  background-color: rgba(255, 251, 252, 0.88);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='6' fill='%23FFD6E0' fill-opacity='0.55'/%3E%3C/svg%3E");
  gap: 12px;
}

/* Bread illustration */
.bread-float {
  animation: floatY 3s var(--smooth) infinite;
}
.bread {
  position: relative;
  width: 120px;
  height: 90px;
  background: linear-gradient(165deg, #FBBF24 0%, #D97706 100%);
  border-radius: 60px 60px 24px 24px;
  box-shadow: 0 8px 24px rgba(245,158,11,0.25);
}
.bread-crust {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(165deg, transparent 40%, rgba(255,255,255,0.15) 100%);
}
.bread-score {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
}
.s1 { top: 28px; left: 24px; width: 28px; transform: rotate(-6deg); }
.s2 { top: 40px; left: 32px; width: 36px; transform: rotate(3deg); }
.s3 { top: 52px; left: 26px; width: 24px; transform: rotate(-4deg); }

/* Steam */
.steam {
  position: absolute;
  width: 8px;
  height: 20px;
  border-radius: 4px;
  background: rgba(255,255,255,0.4);
  filter: blur(3px);
  animation: steamRise 2.5s ease-out infinite;
}
.steam-1 { top: -18px; left: 30px; animation-delay: 0s; }
.steam-2 { top: -22px; left: 50px; width: 10px; height: 26px; animation-delay: 0.6s; }
.steam-3 { top: -16px; left: 72px; width: 6px; height: 18px; animation-delay: 1.2s; }

/* Doodles */
.doodle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}
.doodle-1 {
  width: 180px; height: 180px;
  background: var(--amber);
  top: -40px; right: -40px;
  animation: drift 8s ease-in-out infinite;
}
.doodle-2 {
  width: 120px; height: 120px;
  background: var(--emerald);
  bottom: 20px; left: -30px;
  animation: drift 10s ease-in-out infinite reverse;
}
.doodle-3 {
  width: 80px; height: 80px;
  background: var(--amber-light);
  top: 50%; left: -20px;
  animation: drift 7s ease-in-out infinite 2s;
}

/* Home content */
.home-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.8s var(--spring) 0.2s both;
}
.title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.tagline {
  font-size: 1rem;
  color: var(--text-soft);
  max-width: 260px;
  line-height: 1.4;
}

/* Pulse button */
.btn-pulse {
  position: relative;
  margin-top: 12px;
  padding: 20px 48px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-dark) 100%);
  border: none;
  border-radius: 60px;
  cursor: pointer;
  transition: transform 0.2s var(--spring), box-shadow 0.2s var(--smooth);
  box-shadow: 0 4px 16px rgba(245,158,11,0.35);
}
.btn-pulse:hover { box-shadow: 0 6px 24px rgba(245,158,11,0.45); }
.btn-pulse:active { transform: scale(0.94); }

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s var(--spring);
}
.btn-icon:active { background: rgba(0,0,0,0.05); transform: scale(0.88); }

.btn-ring {
  position: absolute;
  inset: -4px;
  border-radius: 64px;
  border: 2px solid var(--amber);
  opacity: 0;
  animation: ringPulse 2.5s ease-out infinite;
}

@keyframes particleBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(0); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.2); }
}
.p1 { background: var(--amber);    animation: particleBurst1 1s var(--smooth) 0.5s forwards; }
.p2 { background: var(--emerald);  animation: particleBurst2 1s var(--smooth) 0.55s forwards; }
.p3 { background: var(--amber-light); animation: particleBurst3 1s var(--smooth) 0.6s forwards; }
.p4 { background: #F472B6; border-radius: 4px; animation: particleBurst4 1s var(--smooth) 0.45s forwards; }
.p5 { background: #60A5FA; border-radius: 3px; animation: particleBurst5 1s var(--smooth) 0.65s forwards; }
.p6 { background: var(--amber);    animation: particleBurst6 1s var(--smooth) 0.5s forwards; }

@keyframes particleBurst1 { 0% { opacity:1; transform:translate(0,0) scale(0); } 40% { opacity:1; } 100% { opacity:0; transform:translate(60px,-60px) scale(1.2); } }
@keyframes particleBurst2 { 0% { opacity:1; transform:translate(0,0) scale(0); } 40% { opacity:1; } 100% { opacity:0; transform:translate(80px,0px) scale(1.2); } }
@keyframes particleBurst3 { 0% { opacity:1; transform:translate(0,0) scale(0); } 40% { opacity:1; } 100% { opacity:0; transform:translate(60px,60px) scale(1.2); } }
@keyframes particleBurst4 { 0% { opacity:1; transform:translate(0,0) scale(0); } 40% { opacity:1; } 100% { opacity:0; transform:translate(-60px,50px) scale(1.2); } }
@keyframes particleBurst5 { 0% { opacity:1; transform:translate(0,0) scale(0); } 40% { opacity:1; } 100% { opacity:0; transform:translate(-80px,-20px) scale(1.2); } }
@keyframes particleBurst6 { 0% { opacity:1; transform:translate(0,0) scale(0); } 40% { opacity:1; } 100% { opacity:0; transform:translate(-40px,-70px) scale(1.2); } }

#screen-order {
  background-color: rgba(248, 255, 254, 0.88);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L28 82 40 82 40 72 52 72 52 60 28 60 28 66ZM0 28L0 44 12 44 12 34 24 34 24 22 0 22 0 28ZM0 72L0 84 12 84 12 72 0 72ZM28 0L28 12 40 12 40 0 28 0ZM56 0L44 0 44 12 56 12 56 0Z' fill='%23B8E8E0' fill-opacity='0.5'/%3E%3C/svg%3E");
}
/* Menu card */
.menu-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--card-shadow);
  animation: cardSlide 0.5s var(--spring) 0.1s both;
}
.menu-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-info { flex: 1; }
.menu-info h3 { font-size: 1.2rem; font-weight: 700; }
.menu-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.menu-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--amber-dark);
  white-space: nowrap;
}

/* Counter */
.counter-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  animation: cardSlide 0.5s var(--spring) 0.15s both;
}
.btn-counter {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--card);
  border-radius: 50%;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  color: var(--text);
  transition: transform 0.2s var(--spring), box-shadow 0.15s;
}
.btn-counter:active {
  transform: scale(0.88);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.qty-display {
  min-width: 72px;
  text-align: center;
}
.qty-num {
  font-size: 3rem;
  font-weight: 800;
  display: inline-block;
  transition: transform 0.2s var(--spring);
  color: var(--text);
}
.qty-num.pop {
  animation: numPop 0.3s var(--spring);
}

/* Total bar */
.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 4px;
  animation: cardSlide 0.5s var(--spring) 0.2s both;
}
.total-label { font-size: 1.1rem; color: var(--text-soft); }
.total-amount {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--amber-dark);
  display: inline-block;
  transition: transform 0.25s var(--spring);
}
.total-amount.flip {
  animation: flipPrice 0.35s var(--spring);
}

/* Primary button */
.btn-primary {
  width: 100%;
  padding: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s var(--spring), box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
  animation: cardSlide 0.5s var(--spring) 0.25s both;
}
.btn-primary:disabled {
  opacity: 0.3;
  cursor: default;
  box-shadow: none;
  background: linear-gradient(135deg, #D1D5DB 0%, #9CA3AF 100%);
}
.btn-primary:not(:disabled):active { transform: scale(0.96); }

#screen-payment {
  background-color: rgba(255, 251, 252, 0.88);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Ccircle cx='25' cy='25' r='20' fill='none' stroke='%23FFD6E0' stroke-width='4' stroke-opacity='0.4'/%3E%3Ccircle cx='35' cy='35' r='20' fill='none' stroke='%23FFD6E0' stroke-width='4' stroke-opacity='0.4'/%3E%3C/svg%3E");
}
/* ================================
   PAYMENT
   ================================ */
.payment-content {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.5s var(--spring) both;
}
.payment-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}
.payment-header h2 { font-size: 1.2rem; }

/* QRIS card */
.qris-card {
  width: 260px;
  height: 290px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  animation: cardSlide 0.5s var(--spring) 0.1s both;
  overflow: hidden;
}
.qris-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: zoomIn 0.5s var(--spring);
}
.qris-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Loading spinner */
.loader-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--amber-light);
  border-top-color: var(--amber);
  animation: spin 0.8s linear infinite;
}
.qris-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pay-amount {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  animation: cardSlide 0.5s var(--spring) 0.15s both;
}
.pay-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 260px;
  line-height: 1.4;
  animation: cardSlide 0.5s var(--spring) 0.2s both;
}

/* Status bar */
.status-bar {
  width: 100%;
  padding: 12px 16px;
  background: var(--warm);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: center;
  animation: cardSlide 0.5s var(--spring) 0.25s both;
  transition: background 0.3s, color 0.3s;
}

/* ================================
   CONFIRMATION
   ================================ */
#screen-confirmation {
  background-color: rgba(248, 255, 254, 0.85);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cpath d='M0 10 Q10 0 20 10 T40 10' fill='none' stroke='%23A8E6CF' stroke-width='3' stroke-opacity='0.55'/%3E%3C/svg%3E");
}
.confirm-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  animation: confirmIn 0.8s var(--spring) 0.3s both;
  position: relative;
  z-index: 1;
}

/* Animated checkmark */
.checkmark-circle {
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
}
.checkmark-svg {
  width: 100%;
  height: 100%;
}
.checkmark-circle-bg {
  stroke: var(--emerald);
  stroke-width: 3;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: circleFill 0.6s var(--smooth) 0.2s forwards;
}
.checkmark-check {
  stroke: var(--emerald);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkDraw 0.4s var(--spring) 0.7s forwards;
}

.confirm-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--emerald-dark);
}
.confirm-desc {
  color: var(--text-soft);
  font-size: 1rem;
}
.confirm-timer {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Particles (burst) */
.confirm-burst {
  position: absolute;
  width: 0;
  height: 0;
  top: 50%;
  left: 50%;
}
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0;
}
.p1 { background: var(--amber);    animation: particleBurst 1s var(--smooth) 0.5s forwards; }
.p2 { background: var(--emerald);  animation: particleBurst 1s var(--smooth) 0.55s forwards; }
.p3 { background: var(--amber-light); animation: particleBurst 1s var(--smooth) 0.6s forwards; }
.p4 { background: #F472B6; border-radius: 4px; animation: particleBurst 1s var(--smooth) 0.45s forwards; }
.p5 { background: #60A5FA; border-radius: 3px; animation: particleBurst 1s var(--smooth) 0.65s forwards; }
.p6 { background: var(--amber);    animation: particleBurst 1s var(--smooth) 0.5s forwards; }

/* ================================
   KEYFRAMES
   ================================ */

/* Home */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes steamRise {
  0% { opacity: 0.4; transform: translateY(0) scale(1); }
  50% { opacity: 0.6; transform: translateY(-14px) scale(1.3); }
  100% { opacity: 0; transform: translateY(-28px) scale(1.6); }
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(10px, -12px) rotate(4deg); }
  66% { transform: translate(-8px, 8px) rotate(-3deg); }
}
@keyframes ringPulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Screen entry */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardSlide {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* Counter */
@keyframes numPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
@keyframes flipPrice {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-6px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Confirmation */
@keyframes circleFill {
  to { stroke-dashoffset: 0; }
}
@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes confirmIn {
  from { opacity: 0; transform: scale(0.7) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes particleBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(0); }
  60% { opacity: 1; }
  100% {
    opacity: 0;
    --x: calc(cos(calc(var(--i, 0) * 60deg)) * 80px);
    --y: calc(sin(calc(var(--i, 0) * 60deg)) * 80px);
    transform: translate(var(--x), var(--y)) scale(1);
  }
}

/* Particle burst — fallback with hardcoded angles */
.p1 { --i: 0; }
.p2 { --i: 1; }
.p3 { --i: 2; }
.p4 { --i: 3; }
.p5 { --i: 4; }
.p6 { --i: 5; }

@keyframes particleBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(0); }
  40% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(cos(var(--angle)) * 90px), calc(sin(var(--angle)) * 90px)) scale(1.2);
  }
}
.p1 { --angle: 0deg; }
.p2 { --angle: 60deg; }
.p3 { --angle: 120deg; }
.p4 { --angle: 180deg; }
.p5 { --angle: 240deg; }
.p6 { --angle: 300deg; }
