/* ===== شکل‌های شناور پس‌زمینه ===== */
.float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.float-item {
  position: absolute;
  bottom: -60px;
  opacity: 0;
  animation: floatUp linear infinite;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .15));
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: .35; }
  90%  { opacity: .35; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

.site-header, .builder, .mobile-top { position: relative; z-index: 2; }

/* ===== چیدمان اصلی ===== */
.builder {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 10px auto 0;
  padding: 0 20px 110px;
  align-items: start;
}

/* ===== سایدبار لپ‌تاپ ===== */
.sidebar {
  position: sticky;
  top: 16px;
  background: var(--coconut-shell);
  color: var(--almond-cream);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 215, 219, .12);
}
.side-label {
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 10px;
}
[dir="rtl"] .side-label { letter-spacing: 0; text-transform: none; }

/* انتخاب سایز */
.size-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.size-tab {
  background: rgba(255, 255, 255, .06);
  color: var(--almond-cream);
  border-radius: 14px;
  padding: 10px 4px;
  text-align: center;
  line-height: 1.2;
  transition: background .35s var(--ease), color .35s var(--ease), transform .35s var(--ease);
}
.size-tab b { display: block; font-size: 1.15rem; font-weight: 800; }
.size-tab small { font-size: .62rem; opacity: .75; }
.size-tab:active { transform: scale(.94); }
.size-tab.active { background: var(--blush-petal); color: var(--coconut-shell); transform: scale(1.04); }

.side-row {
  display: flex;
  justify-content: space-between;
  margin: 18px 0 10px;
  font-size: .8rem;
  opacity: .8;
}

/* اسلات‌های باکس */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.slot {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px dashed rgba(255, 215, 219, .35);
  display: grid;
  place-items: center;
  font-size: .8rem;
  color: rgba(255, 215, 219, .5);
  position: relative;
  overflow: hidden;
  transition: border-color .4s var(--ease), background .4s var(--ease);
}
.slot.filled { border: 2px solid var(--blush-petal); background: rgba(255, 215, 219, .12); }
.slot .dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  overflow: hidden;
  animation: slotPop .55s cubic-bezier(.34, 1.56, .64, 1);
}
.slot .dot img { width: 100%; height: 100%; object-fit: cover; }
@keyframes slotPop {
  0%   { transform: scale(0) rotate(-40deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ردیف‌های انتخاب‌شده */
.lines { margin-top: 16px; display: grid; gap: 8px; }
.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: .85rem;
  animation: lineIn .4s var(--ease);
}
@keyframes lineIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .line { animation-name: lineInRtl; }
@keyframes lineInRtl { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.line-name { flex: 1; font-weight: 600; }

.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: inherit;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  transition: transform .25s var(--ease), background .25s var(--ease);
}
.qty button:hover { background: var(--blush-petal); color: var(--coconut-shell); }
.qty button:active { transform: scale(.82); }
.qty button:disabled { opacity: .3; pointer-events: none; }
.qty span { min-width: 18px; text-align: center; font-weight: 800; display: inline-block; }
.qty span.bump { animation: bump .35s var(--ease); }
@keyframes bump { 50% { transform: scale(1.5); } }

.empty-btn {
  background: none;
  color: var(--blush-petal);
  text-decoration: underline;
  font-size: .75rem;
  margin-top: 10px;
  opacity: .8;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 215, 219, .15);
}
.total-row strong { font-size: 1.5rem; font-weight: 800; color: var(--blush-petal); }
.total-row strong.bump { animation: bump .4s var(--ease); }

.checkout-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--blush-petal);
  color: var(--coconut-shell);
  font-weight: 800;
  padding: 15px;
  border-radius: 999px;
  transition: transform .3s var(--ease), background .3s var(--ease), opacity .3s;
}
.checkout-btn:hover { transform: translateY(-2px); background: #fff; }
.checkout-btn:active { transform: scale(.97); }
.checkout-btn:disabled { opacity: .35; pointer-events: none; }
.checkout-btn.ready { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 219, .5); }
  50%      { box-shadow: 0 0 0 12px rgba(255, 215, 219, 0); }
}

/* ===== کارت‌های کوکی ===== */
.cookie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.cookie-card {
  background: #fffaf7;
  color: var(--coconut-shell);
  border-radius: var(--radius);
  padding: 12px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(26px) scale(.97);
  animation: cardIn .7s var(--ease) forwards;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
  cursor: pointer;
}
@keyframes cardIn { to { opacity: 1; transform: none; } }
.cookie-card:hover { transform: translateY(-6px); box-shadow: 0 22px 44px rgba(0, 0, 0, .3); }
.cookie-card.selected { border-color: var(--coconut-shell); }

.cookie-img {
  border-radius: 18px;
  aspect-ratio: 1.15;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.cookie-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.cookie-card:hover .cookie-img img { transform: scale(1.1) rotate(2deg); }
.cookie-emoji { font-size: 3.4rem; transition: transform .6s var(--ease); }
.cookie-card:hover .cookie-emoji { transform: scale(1.2) rotate(8deg); }

.badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--coconut-shell);
  color: var(--blush-petal);
  font-size: .8rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  transform: scale(0);
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
[dir="rtl"] .badge { right: auto; left: 8px; }
.cookie-card.selected .badge { transform: scale(1); }

.cookie-card h3 { margin-top: 12px; font-size: 1.05rem; font-weight: 800; }
.cookie-card p { margin-top: 4px; font-size: .8rem; opacity: .7; line-height: 1.5; flex: 1; }

.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; min-height: 38px; }
.add-btn {
  margin-inline-start: auto;
  background: var(--blush-petal);
  color: var(--coconut-shell);
  font-weight: 800;
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid var(--coconut-shell);
  transition: transform .3s var(--ease), background .3s var(--ease), color .3s var(--ease);
}
.add-btn:hover { background: var(--coconut-shell); color: var(--blush-petal); transform: scale(1.06); }
.add-btn:active { transform: scale(.9); }
.add-btn:disabled { opacity: .35; pointer-events: none; }
.card-foot .qty { margin-inline-start: auto; color: var(--coconut-shell); }
.card-foot .qty button { background: rgba(59, 36, 20, .1); }

.card-foot .qty button:hover { background: var(--coconut-shell); color: var(--blush-petal); }

/* ===== پیام‌های کوچک (Toast) ===== */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  justify-items: center;
  z-index: 30;
  pointer-events: none;
}
.toast {
  background: var(--coconut-shell);
  color: var(--almond-cream);
  font-size: .82rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  animation: toastIn .45s cubic-bezier(.34, 1.56, .64, 1), toastOut .4s ease 2s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.8); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ===== بخش موبایل ===== */
.mobile-top, .bottom-bar { display: none; }

@media (max-width: 860px) {
  .builder { grid-template-columns: 1fr; padding: 0 14px 120px; }
  .sidebar { display: none; }

  .mobile-top {
    display: block;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--blush-petal);
    color: var(--coconut-shell);
    padding: 10px 14px 12px;
    border-radius: 0 0 22px 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  }
  .mobile-top .size-tab { background: rgba(59, 36, 20, .08); color: var(--coconut-shell); }
  .mobile-top .size-tab.active { background: var(--coconut-shell); color: var(--blush-petal); }

  .mini-slots { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
  .mini-slots .slot {
    flex: 0 0 34px;
    height: 34px;
    border-color: rgba(59, 36, 20, .3);
    color: rgba(59, 36, 20, .5);
    font-size: .7rem;
  }
  .mini-slots .slot.filled { border-color: var(--coconut-shell); background: transparent; }

  .cookie-grid { grid-template-columns: 1fr; gap: 12px; }
  .cookie-card { flex-direction: row; gap: 12px; padding: 10px; align-items: stretch; }
  .cookie-img { width: 104px; flex: 0 0 104px; aspect-ratio: 1; }
  .cookie-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
  .cookie-card h3 { margin-top: 0; font-size: .98rem; }
  .cookie-card p { font-size: .75rem; }
  .qty button { width: 36px; height: 36px; }
  .add-btn { padding: 11px 24px; }

  .bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 25;
    background: var(--coconut-shell);
    color: var(--almond-cream);
    padding: 12px 12px 12px 18px;
    border-radius: 999px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    animation: barIn .6s var(--ease);
  }
  @keyframes barIn { from { transform: translateY(100px); opacity: 0; } }
  .bb-info { flex: 1; font-size: .85rem; }
  .bb-progress { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); margin-top: 7px; overflow: hidden; }
  .bb-progress i { display: block; height: 100%; width: 0; background: var(--blush-petal); transition: width .5s var(--ease); }
  .bb-btn {
    background: var(--blush-petal);
    color: var(--coconut-shell);
    font-weight: 800;
    padding: 13px 20px;
    border-radius: 999px;
    transition: transform .3s var(--ease), opacity .3s;
  }
  .bb-btn:active { transform: scale(.92); }
  .bb-btn:disabled { opacity: .35; }
  .toasts { bottom: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .float-layer { display: none; }
}
