/* ============================================================
   Phone Wrapper
============================================================ */
/* Hide frame on mobile */
@media (max-width: 768px) {
  #phone-frame {
    border: none;
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  #phone-screen {
    position: relative;
    overflow-y: auto;
    width: 100%;
    height: 100%;
  }
}

/* Desktop "iPhone" mockup */
@media (min-width: 769px) {
  body {
    background: #eaeaea;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
  }

  #phone-frame {
    width: 390px; /* iPhone 14 Pro width */
    height: 844px; /* iPhone 14 Pro height */
    background: #000;
    border-radius: 40px;
    border: 12px solid black;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    position: relative;
  }

  #phone-screen {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    background: white;
  }
}

/* ============================================================
   GLOBAL RESET
============================================================ */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fafafa;
  margin: 0;
  padding: 0; /* removed global padding for fixed header layout */
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
  padding: 0px;
}
.screen.active {
  display: block;
}

.screen .content {
  padding: 90px 20px 30px 20px; /* only screens with fixed header */
}

/* FADE IN ANIMATION */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   FIXED HEADER
============================================================ */
.fixed-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 20px;
  background: #fafafa;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  transition: all 0.25s ease;
}

.fixed-header.shrink {
  padding: 6px 20px;
  background: #ffffffee;
  backdrop-filter: blur(6px);
}

.fixed-header h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

/* BACK BUTTON */
.back {
  width: auto;
  background: #e5e8ec;
  color: #3a3f47;
  box-shadow: none;
  padding: 6px 14px;
  border-radius: 14px;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

/* ============================================================
   FLOATING CART ICON
============================================================ */
#cart-floating {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 70px;
  height: 70px;
  background: white;
  border-radius: 24px;
  box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 999;
}

#cart-floating img {
  width: 40px;
  height: auto;
}

#cart-floating #cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff4f9a;
  color: white;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 50%;
  font-weight: bold;
}

/* ============================
   HOME LAYOUT (STACKED)
============================ */
/* HOME fills the screen */
#screen-home {
  overflow: hidden !important;
  height: 100%;
}

#screen-home.active {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  text-align: center;
}

/* STACK that contains EVERYTHING */
.home-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px; /* space between cog → buttons → banner */
}

/* ROTATING COG */
.top-cog {
  width: 100%;
  height: 180px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.cog-img {
  width: 380px;
  height: 380px;
  animation: slowspin 28s linear infinite;
  object-fit: contain;
  object-position: bottom center;
}

@keyframes slowspin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* BUTTON STACK */
.home-buttons {
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* BOTTOM BANNER */
.home-hero-img {
  width: 100%;
}

.hero-banner {
  width: 100%;
  height: auto;
  display: block;
}

/* BIG CARD BUTTONS */
.big-card {
  width: 100%;
  padding: 18px 20px;
  font-size: 18px;
  font-weight: 600;
  background: #f0f0f0; /* grey background */
  border: 3px solid #000000; /* black outline */
  color: #3a3f47; /* dark text */
  border-radius: 24px;
  text-align: left;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* ============================================================
   DONUT BUILDER PREVIEW
============================================================ */
.donut-preview-wrapper {
  margin-top: 10px;
  margin-bottom: 20px;
}

.donut-preview-container {
  width: 300px;
  height: 300px;
  margin: 0 auto;
  background: white;
  border-radius: 32px;
  box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 75px; /* directly under header */
  overflow: hidden;
  transition: transform 0.2s ease;
}

/* donut zoom on scroll */
.donut-preview-container.zoom {
  transform: scale(0.6);
}

/* donut layering */
#donut-preview-base {
  width: 270px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#donut-preview-base,
#donut-icing-layer img,
#donut-toppings-layer img {
  width: 270px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* FIXED PREVIEW ZONE */
.donut-fixed-zone {
  position: sticky;
  top: 60px; /* header height */
  z-index: 100;
  background: #fafafa;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

/* Ensure donut preview never overlaps content below */
.donut-preview-container {
  z-index: 150;
  background: #fafafa;
}

/* OPTIONS SCROLL AREA */
.options-scroll {
  margin-top: 10px;
  padding-bottom: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 360px);
  /* 
    Explanation:
    full height 
    minus header 
    minus fixed donut preview 
    ensures perfect scrolling 
  */
}

/* ============================================================
   TOPPING SELECTORS
============================================================ */
.randomize-btn {
  width: 100%;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffd93d, #ff4f9a);
  color: white;
  font-weight: 600;
  border: none;
  margin-top: 10px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}

.randomize-btn:active {
  transform: scale(0.96);
}

h3 {
  margin-top: 30px;
}

select {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid #e5e8ec;
  background: white;
  font-size: 16px;
  margin-bottom: 20px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

details {
  background: white;
  padding: 16px;
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e8ec;
}

details summary {
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
}

details label {
  display: block;
  padding: 10px 0;
  font-size: 16px;
  color: #3a3f47;
  line-height: 1.4;
}

/* ============================================================
   TOAST POPUP
============================================================ */
#toast {
  position: absolute;
  bottom: -80px; /* hidden initially */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 14px 22px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  opacity: 0;
  z-index: 9999;

  transition: all 0.45s ease;
}

/* when showing */
#toast.show {
  bottom: 40px;
  opacity: 1;
}

/* ============================================================
   SIDE SWIPE PANEL
============================================================ */
#side-swipe {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-100%, -50%);
  background: linear-gradient(135deg, #3aa0ff, #55efb4);
  color: white;
  padding: 14px 22px;
  border-radius: 0 16px 16px 0;
  box-shadow: 0px 6px 14px rgba(0, 0, 0, 0.15);
  font-weight: bold;
  cursor: pointer;
  z-index: 900;
  transition: transform 0.35s ease;
}

#side-swipe.show {
  transform: translate(0, -50%);
}

/* ============================================================
   SPECIAL ITEMS
============================================================ */
.special-item {
  background: white;
  padding: 20px;
  border-radius: 24px;
  margin-bottom: 18px;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.08);
}

.special-item img {
  width: 220px;
  display: block;
  margin: 0 auto 20px auto;
}

.special-item p {
  text-align: center;
  line-height: 1.4;
}

/* ============================================================
   COUNTERS
============================================================ */
.counter {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.counter button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #e5e8ec;
  color: #3a3f47;
  font-size: 22px;
  box-shadow: none;
}

/* ============================================================
   DRINK LIST
============================================================ */
#drink-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drink-item {
  background: white;
  padding: 18px;
  border-radius: 22px;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.08);
}

.drink-label {
  font-size: 17px;
  font-weight: 600;
  color: #3a3f47;
}

.drink-img-wrapper {
  text-align: center;
  margin: 10px 0 6px 0;
}

.drink-img {
  width: 120px; /* adjust size if you want */
  height: auto;
  border-radius: 12px;
}

/* ============================================================
   CART
============================================================ */
#cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-line {
  display: flex;
  align-items: center;
  background: white;
  padding: 14px;
  border-radius: 20px;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.08);
}

.cart-line img {
  width: 60px;
  margin-right: 12px;
  border-radius: 12px;
}

.cart-controls {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ============================================================
   CHECKOUT
============================================================ */
.mode-selector {
  display: flex;
  gap: 10px;
  height: 40px;
  margin-bottom: 20px;
}

.mode-selector button {
  border-radius: 18px;
  flex: 1;
  background: #e5e8ec;
  color: #3a3f47;
}

.mode-selector button.active {
  background: linear-gradient(135deg, #3aa0ff, #55efb4);
  color: white;
}

#time-select {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: white;
  border: 2px solid #e5e8ec;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

/* Disabled checkout button */
#checkout-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(100%);
}

.button-shake {
  animation: shakeAnim 0.4s;
}

@keyframes shakeAnim {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-6px);
  }
  100% {
    transform: translateX(0);
  }
}

/* ============================================================
   UNIVERSAL ACTION BUTTONS (Add to Cart, Checkout, Place Order)
============================================================ */
button:not(.back):not(.big-card):not(.counter button):not(
    .mode-selector button
  ) {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #ff4f9a, #ffd93d);
  color: white;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.12);
  margin-top: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
/* Hover / press */
button:not(.back):not(.big-card):not(.counter button):not(
    .mode-selector button
  ):active {
  transform: scale(0.96);
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   RECEIPT PAGE
============================================================ */

#screen-receipt .content {
  padding-top: 100px;
}

#receipt-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

/* Receipt row layout */
.receipt-line {
  display: grid;
  grid-template-columns: 60px 1fr 70px 40px 70px;
  align-items: center;
  background: white;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.08);
}

.receipt-line img {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.receipt-total {
  text-align: right;
  margin-top: 30px;
  font-size: 20px;
  font-weight: 700;
}

/* ============================================================
   CONFETTI
============================================================ */
#confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 14px;
  opacity: 0.8;
  animation: fall 2.8s linear; // add "infinite" for looping confetti
}

@keyframes fall {
  0% {
    transform: translateY(-50px) rotate(0deg);
  }
  100% {
    transform: translateY(900px) rotate(360deg);
  }
}
