/* ========================================
   Pizza Builder Frontend Styles
   ======================================== */

   .pizza-builder-container {
    /* Theme variables — overridden inline per the admin settings (color & font) */
    --pb-primary: var(--pb-primary-color, #c0392b);
    --pb-primary-dark: var(--pb-primary-color-dark, #a93226);
    --pb-primary-light: var(--pb-primary-color-light, #e74c3c);
    --pb-primary-rgb: var(--pb-primary-color-rgb, 192, 57, 43);

    font-family: var(--pb-font-family, 'Vazir', 'Tahoma', Arial, sans-serif);
    max-width: 1100px;
    margin: 30px auto;
    padding: 20px;
    direction: rtl;
    box-sizing: border-box;
}

.pizza-builder-container,
.pizza-builder-container *,
.pizza-builder-container *::before,
.pizza-builder-container *::after {
    box-sizing: border-box;
}

.pb-main-title {
    text-align: center;
    margin-bottom: 18px;
}

/* افکت نور مینیمال دور عنوان — بدون شلوغ‌کاری، فقط یه درخشش ملایم */
.pb-glow-title span {
    display: inline-block;
    font-size: 24px;
    font-weight: 800;
    color: var(--pb-primary);
    letter-spacing: 0.3px;
    text-shadow:
        0 0 8px rgba(var(--pb-primary-rgb), 0.35),
        0 0 18px rgba(var(--pb-primary-rgb), 0.18);
    animation: pbTitleGlow 3.5s ease-in-out infinite;
}

@keyframes pbTitleGlow {
    0%, 100% {
        text-shadow:
            0 0 8px rgba(var(--pb-primary-rgb), 0.3),
            0 0 16px rgba(var(--pb-primary-rgb), 0.15);
    }
    50% {
        text-shadow:
            0 0 14px rgba(var(--pb-primary-rgb), 0.55),
            0 0 26px rgba(var(--pb-primary-rgb), 0.3);
    }
}

/* تکون خوردن پیتزا هر بار که یه انتخاب جدید می‌زنه — حس زنده بودن */
@keyframes pbPizzaPulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.06) rotate(-1.5deg); }
    60%  { transform: scale(0.98) rotate(1deg); }
    100% { transform: scale(1) rotate(0); }
}

.pb-pizza-preview-wrap.pb-pulse {
    animation: pbPizzaPulse 0.5s ease;
}

/* عناصر مخصوص حالت تمام‌صفحه‌ی موبایل — فقط توی ریسپانسیو دیده می‌شن (تعریف کامل در بخش ریسپانسیو) */
.pb-mobile-topbar,
.pb-sheet-header {
    display: none;
}

/* ---- Layout ---- */
.pb-app-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    align-items: start;
}

/* Layout responsiveness handled in the Responsive section near the end of this file */

/* ---- Preview Column ---- */
.pb-preview-column {
    position: sticky;
    top: 20px;
}

.pb-pizza-preview-wrap {
    background: #fff9f0;
    border: 3px dashed #f39c12;
    border-radius: 50%;
    width: 320px;
    height: 320px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.pb-pizza-layers {
    position: relative;
    width: 300px;
    height: 300px;
}

.pb-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

.pb-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pb-layer-overlay {
    border-radius: 50%;
    overflow: hidden;
}

.pb-layer-overlay img {
    opacity: 0.85;
}

/* ---- Price Box (مینیمال، حس فاکتور، زیر لیست انتخاب‌ها) ---- */
.pb-price-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1.5px dashed rgba(var(--pb-primary-rgb), 0.35);
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 10px;
}

.pb-price-label {
    font-size: 12.5px;
    color: #8a8f98;
    font-weight: 700;
}

.pb-price-amount-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pb-price-amount {
    display: flex;
    align-items: baseline;
    gap: 4px;
    direction: ltr;
}

.pb-price-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--pb-primary);
    direction: ltr;
    display: inline-block;
}

.pb-price-currency {
    font-size: 12px;
    color: var(--pb-primary);
    font-weight: 700;
}

/* ---- Summary ---- */
.pb-summary-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
}

.pb-summary-box h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.pb-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pb-summary-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 8px 0;
}

/* ---- Summary Card (compact: thumbnail + text + price) ---- */
.pb-summary-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9f9fa;
    border: 1px solid #eef0f2;
    border-radius: 10px;
    padding: 5px 8px;
}

.pb-summary-card-img {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pb-summary-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb-summary-card-noimg {
    font-size: 15px;
}

.pb-summary-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.pb-summary-card-step {
    font-size: 10px;
    color: #8a8f98;
}

.pb-summary-card-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #2c3339;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-summary-card-price {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--pb-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Pizza Name Field ---- */
.pb-pizza-name-field {
    margin: 4px 0 18px;
    padding: 12px;
    background: #f9f9fa;
    border: 1.5px dashed #e0e2e6;
    border-radius: 12px;
}

.pb-pizza-name-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #555;
    margin-bottom: 6px;
}

.pb-pizza-name-field label span {
    font-weight: 400;
    color: #999;
}

.pb-pizza-name-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e2e6;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.pb-pizza-name-field input:focus {
    outline: none;
    border-color: var(--pb-primary);
    box-shadow: 0 0 0 3px rgba(var(--pb-primary-rgb), 0.12);
}

/* ---- Size Step: computed price per size (بستگی به مجموع مراحل قبل داره) ---- */
.pb-size-computed-price {
    direction: ltr;
}

/* ---- Sheet Header Price (فقط موبایل — جای عنوان قبلی) ---- */
.pb-sheet-header-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--pb-primary);
    background: rgba(var(--pb-primary-rgb), 0.08);
    padding: 6px 12px;
    border-radius: 20px;
    direction: ltr;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pb-sheet-header-price small {
    font-size: 10.5px;
    font-weight: 700;
}

/* ---- Mini Size Badge (کنار قیمت‌ها؛ نشون‌دهنده‌ی سایز فعلی + کلیک‌پذیر برای تغییرش) ---- */
.pb-size-mini-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: none;
    background: rgba(var(--pb-primary-rgb), 0.14);
    color: var(--pb-primary);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    direction: rtl;
    transition: background 0.15s ease;
}

.pb-size-mini-badge:hover {
    background: rgba(var(--pb-primary-rgb), 0.22);
}

.pb-price-box .pb-size-mini-badge {
    font-size: 11px;
}

.pb-step-nav-price .pb-size-mini-badge {
    font-size: 9.5px;
    padding: 2px 7px;
}

/* موبایل: پاپ‌آپ سایز که فقط برای تغییر سایز (نه تکمیل سفارش) باز می‌شه، فیلد اسم نداره */
.pb-modal-overlay.pb-size-only-mode #pb-modal-name-field {
    display: none;
}
.pb-steps-column {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ---- Progress ---- */
.pb-steps-progress {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    overflow-x: auto;
    padding: 0;
}

.pb-progress-step {
    flex: 1;
    min-width: 80px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    border-bottom: 3px solid transparent;
}

.pb-progress-step:hover {
    background: #fff;
}

.pb-progress-step.active {
    background: #fff;
    border-bottom-color: var(--pb-primary);
}

.pb-progress-step.done {
    border-bottom-color: #27ae60;
}

.pb-progress-num {
    display: block;
    width: 28px;
    height: 28px;
    background: #dee2e6;
    border-radius: 50%;
    line-height: 28px;
    margin: 0 auto 5px;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s;
}

.pb-progress-step.active .pb-progress-num {
    background: var(--pb-primary);
    color: #fff;
}

.pb-progress-step.done .pb-progress-num {
    background: #27ae60;
    color: #fff;
}

.pb-progress-step.done .pb-progress-num::after {
    content: '✓';
}

/* ---- Locked Step ---- */
.pb-progress-step.locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.pb-progress-step.locked:hover {
    background: #f8f9fa;
}

@keyframes pbShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.pb-shake {
    animation: pbShake 0.4s;
}

/* ---- Disabled Next/Add-to-cart Button ---- */
.pb-btn-next.disabled,
.pb-btn-add-to-cart.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

.pb-progress-label {
    display: block;
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    margin: 0 auto;
}

.pb-progress-step.active .pb-progress-label {
    color: var(--pb-primary);
    font-weight: bold;
}

/* ---- Step Panel ---- */
.pb-step-panel {
    display: none;
    padding: 25px;
    animation: pbFadeIn 0.3s ease;
}

.pb-step-panel.active {
    display: block;
}

@keyframes pbFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pb-step-panel-title {
    font-size: 20px;
    color: #2c3e50;
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pb-step-optional-tag {
    font-size: 11px;
    font-weight: 700;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    padding: 3px 10px;
    border-radius: 20px;
}

.pb-step-num {
    background: var(--pb-primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

/* ---- Options Grid ---- */
.pb-step-options {
    display: grid;
    /* حداکثرِ عرضِ هر کارت رو هم محدود می‌کنیم (نه فقط حداقلش)؛ وگرنه وقتی یه مرحله
       فقط ۱-۲ آیتم داره (مثل پنیر)، کارت‌ها کش میان و کل عرضِ خالی رو پر می‌کنن که
       بدشکل می‌شه. الان با تعداد کم هم آیتم‌ها اندازه‌ی طبیعیِ خودشون رو حفظ می‌کنن. */
    grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
    gap: 14px;
    margin-bottom: 25px;
}

/* ---- Radio/Checkbox Option — کارت افقی: عکس یک طرف، اسم و قیمت طرف دیگه (کم‌ارتفاع‌تر) ---- */
.pb-option-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(6px, 6cqw, 14px);
    background: #fff;
    border: 2px solid #eceff1;
    border-radius: 14px;
    /* پدینگ هم مثل عکس با همون container query کوچیک/بزرگ می‌شه؛ این‌طوری هر ۴ طرفِ
       عکس نسبت به بوردر کارت، در هر سایزی، هارمونی یکسانی داره */
    padding: clamp(6px, 5cqw, 10px) clamp(8px, 7cqw, 14px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-align: right;
    position: relative;
    box-shadow: 0 1px 3px rgba(20, 20, 20, 0.06);
    min-width: 0;
    container-type: inline-size;
}

.pb-option-label:hover {
    border-color: var(--pb-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(var(--pb-primary-rgb), 0.14);
}

.pb-option-label.selected {
    border-color: var(--pb-primary);
    background: linear-gradient(180deg, rgba(var(--pb-primary-rgb), 0.06) 0%, rgba(var(--pb-primary-rgb), 0.02) 100%);
    box-shadow: 0 0 0 3px rgba(var(--pb-primary-rgb), 0.15), 0 8px 18px rgba(var(--pb-primary-rgb), 0.12);
}

.pb-option-label input[type="radio"],
.pb-option-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* Checkmark badge — appears in the corner once an option is selected */
.pb-option-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--pb-primary);
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(var(--pb-primary-rgb), 0.4);
    z-index: 2;
}

.pb-option-label.selected .pb-option-check {
    opacity: 1;
    transform: scale(1);
}

/* The "box inside the box": image sits in its own inset frame — سایزش با خودِ عرض کارت
   هماهنگه (container query)، یعنی هرچقدر کارت کوچیک‌تر بشه، عکس هم به همون نسبت
   کوچیک می‌شه و فاصله‌ش از بوردر (پدینگِ ثابتِ کارت) از هر چهار طرف یکسان می‌مونه */
.pb-option-img-wrap {
    width: clamp(38px, 24cqw, 58px);
    height: clamp(38px, 24cqw, 58px);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f5f7;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.pb-option-label.selected .pb-option-img-wrap {
    box-shadow: inset 0 0 0 1px rgba(var(--pb-primary-rgb), 0.25);
}

.pb-option-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb-option-no-img {
    background: #f0f0f0;
}

.pb-no-img-icon {
    font-size: 24px;
}

.pb-option-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    width: 100%;
    flex: 1;
}

.pb-option-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #263238;
    line-height: 1.35;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* قیمت به‌صورت pill — حتی توی کوچیک‌ترین حالت هم هرگز از باکس بیرون نمی‌زنه،
   فقط با ellipsis کوتاه می‌شه (خودِ لیست آیتم‌ها اسکرول می‌خوره، نه تک‌تک باکس‌ها) */
.pb-option-price {
    font-size: 11.5px;
    color: var(--pb-primary);
    font-weight: 700;
    background: rgba(var(--pb-primary-rgb), 0.08);
    padding: 3px 10px;
    border-radius: 20px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    display: inline-block;
}

/* ---- Radio with Amount ---- */
.pb-option-with-amount {
    background: #fff;
    border: 2px solid #eceff1;
    border-radius: 16px;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(20, 20, 20, 0.06);
    position: relative;
    container-type: inline-size;
}

.pb-option-with-amount:hover {
    border-color: var(--pb-primary-light);
    box-shadow: 0 6px 16px rgba(var(--pb-primary-rgb), 0.12);
}

.pb-option-with-amount.selected {
    border-color: var(--pb-primary);
    background: linear-gradient(180deg, rgba(var(--pb-primary-rgb), 0.05) 0%, rgba(var(--pb-primary-rgb), 0.01) 100%);
    box-shadow: 0 0 0 3px rgba(var(--pb-primary-rgb), 0.15);
}

.pb-option-with-amount .pb-option-check {
    top: 10px;
    left: 10px;
}

.pb-option-with-amount .pb-option-label {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 12px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: right;
    gap: 12px;
    box-shadow: none;
}

.pb-option-with-amount .pb-option-label:hover {
    transform: none;
    box-shadow: none;
    background: transparent;
    border: none;
}

.pb-option-with-amount .pb-option-label input {
    position: static;
}

.pb-option-with-amount .pb-option-img-wrap {
    width: clamp(36px, 16cqw, 52px);
    height: clamp(36px, 16cqw, 52px);
    border-radius: 12px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.pb-amounts-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed #e0e0e0;
}

.pb-amount-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 15px;
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: bold;
    color: #555;
}

.pb-amount-btn:hover {
    border-color: var(--pb-primary);
    color: var(--pb-primary);
}

.pb-amount-btn.selected {
    background: var(--pb-primary);
    border-color: var(--pb-primary);
    color: #fff;
}

.pb-amount-btn input {
    display: none;
}

.pb-amount-price-badge {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 3px;
    font-weight: normal;
}

/* ---- Navigation ---- */
.pb-step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    gap: 10px;
}

/* قیمت کل، بین دکمه‌ی مرحله قبل و بعد (دسکتاپ/تبلت) — تا وقتی انتخاب‌ها
   زیاد شد و لیست بلند شد، کاربر همون‌جا پایین همیشه قیمت رو ببینه */
.pb-step-nav-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
    white-space: nowrap;
}

.pb-step-nav-price-label {
    font-size: 11px;
    color: #8a8f98;
    font-weight: 700;
}

.pb-step-nav-price-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--pb-primary);
    direction: ltr;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pb-btn-prev,
.pb-btn-next,
.pb-btn-add-to-cart {
    padding: 12px 25px !important;
    font-size: var(--pb-text-size-desktop, 15px) !important;
    border-radius: 8px !important;
    font-weight: var(--pb-text-weight, 700) !important;
    transition: all 0.2s !important;
}

.pb-btn-next,
.pb-btn-add-to-cart {
    background: var(--pb-primary) !important;
    border-color: var(--pb-primary) !important;
    color: #fff !important;
    margin-right: auto !important;
}

.pb-btn-next:hover,
.pb-btn-add-to-cart:hover {
    background: var(--pb-primary-dark) !important;
    border-color: var(--pb-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--pb-primary-rgb), 0.35) !important;
}

.pb-btn-prev {
    background: #95a5a6 !important;
    border-color: #95a5a6 !important;
    color: #fff !important;
}

/* ---- Success Message ---- */
.pb-success-message {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    animation: pbFadeIn 0.5s ease;
}

.pb-success-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    text-align: center;
    padding: 40px 24px 16px;
}

/* دکمه‌ی پرداخت همیشه پایینِ همین کادر چسبیده و پیداست، حتی اگه ارتفاع کم باشه
   و محتوای بالا مجبور بشه اسکرول بخوره */
.pb-checkout-btn-full {
    flex-shrink: 0;
}

.pb-success-icon {
    width: 84px;
    height: 84px;
    line-height: 84px;
    margin: 0 auto 18px;
    font-size: 40px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 10px 24px rgba(39, 174, 96, 0.35);
    animation: pbSuccessPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pbSuccessPop {
    0%   { transform: scale(0.4); opacity: 0; }
    70%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

.pb-success-message h3 {
    font-size: 22px;
    color: #1f2d24;
    margin-bottom: 10px;
    font-weight: 800;
}

.pb-success-ready-msg {
    font-size: 13.5px;
    font-weight: 700;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 20px;
    margin-bottom: 28px;
}

.pb-success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 380px;
    margin: 0 auto;
}

.pb-success-actions .button {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px !important;
    font-size: var(--pb-text-size-mobile, 12.5px) !important;
    font-weight: var(--pb-text-weight, 700) !important;
    border-radius: 10px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.pb-success-actions .button-primary {
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-dark)) !important;
    border-color: var(--pb-primary) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(var(--pb-primary-rgb), 0.35);
}

.pb-success-actions .button-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.pb-success-actions .button:not(.button-primary) {
    background: #fff !important;
    border: 1.5px solid #e4e6ea !important;
    color: #444 !important;
}

.pb-success-actions .button:not(.button-primary):hover {
    border-color: var(--pb-primary) !important;
    color: var(--pb-primary) !important;
    transform: translateY(-2px);
}

/* دکمه‌ی پرداخت، جدا و تمام‌عرض زیر دو دکمه‌ی بالا — پررنگ‌ترین اکشن این صفحه */
.pb-checkout-btn-full {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 380px;
    margin: 12px auto 0;
    padding: 15px 20px !important;
    font-size: var(--pb-text-size-desktop, 15px) !important;
    font-weight: var(--pb-text-weight, 800) !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-dark)) !important;
    border-color: var(--pb-primary) !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(var(--pb-primary-rgb), 0.35);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.pb-checkout-btn-full:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    color: #fff !important;
}

/* خلاصه‌ی فشرده و افقی‌اسکرول‌شونده‌ی سفارش — کوچیک، فقط برای یادآوری این‌که چی
   انتخاب شده بود، بدون این‌که فضای زیادی از صفحه‌ی موفقیت بگیره */
.pb-order-summary-compact {
    max-width: 420px;
    margin: 0 auto 22px;
}

.pb-order-summary-compact-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    margin: 0;
    scrollbar-width: thin;
}

/* هر مرحله یه گروهِ جدا با پس‌زمینه‌ی خودش (برای تفکیک بصری) و یه برچسبِ ریز
   بالاش (مثلاً «مواد اصلی») — مراحلِ اختیاری که چیزی انتخاب نشده اصلاً نمایش
   داده نمی‌شن (توی جاوااسکریپت فیلتر می‌شن) */
.pb-order-summary-group {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px 10px;
    border-radius: 12px;
    background: #f4f5f7;
}

.pb-order-summary-group:nth-child(5n+1) { background: rgba(231, 76, 60, 0.09); }
.pb-order-summary-group:nth-child(5n+2) { background: rgba(46, 204, 113, 0.10); }
.pb-order-summary-group:nth-child(5n+3) { background: rgba(241, 196, 15, 0.14); }
.pb-order-summary-group:nth-child(5n+4) { background: rgba(52, 152, 219, 0.10); }
.pb-order-summary-group:nth-child(5n+5) { background: rgba(155, 89, 182, 0.10); }

.pb-order-summary-group-label {
    font-size: 9.5px;
    font-weight: 800;
    color: #6b6b6b;
    white-space: nowrap;
}

.pb-order-summary-group-items {
    display: flex;
    gap: 6px;
}

.pb-order-summary-compact-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 56px;
    text-align: center;
}

.pb-order-summary-compact-img {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.pb-order-summary-compact-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb-order-summary-compact-name {
    font-size: 9.5px;
    color: #6b7280;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ---- Loading ---- */
.pb-btn-add-to-cart.loading {
    opacity: 0.7;
    pointer-events: none;
}

.pb-btn-add-to-cart.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: pbSpin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes pbSpin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Responsive — Tablet & Mobile
   ======================================== */

/* ---- Tablet (<= 992px) ---- */
@media (max-width: 992px) {
    .pizza-builder-container {
        margin: 15px auto;
        padding: 15px;
    }

    .pb-app-layout {
        grid-template-columns: 300px 1fr;
        gap: 20px;
    }

    .pb-pizza-preview-wrap {
        width: 260px;
        height: 260px;
    }

    .pb-pizza-layers {
        width: 240px;
        height: 240px;
    }

    .pb-step-options {
        grid-template-columns: repeat(auto-fill, minmax(200px, 260px));
        gap: 12px;
    }
}

/* ---- Desktop/Tablet (> 768px): ستون فرم انتخاب استیکی و قابل‌اسکرول داخلی می‌شه ----
   تا وقتی صفحه اسکرول می‌شه، پیتزا و فرم هر دو توی دید کاربر بمونن؛ لیست گزینه‌ها
   خودش جدا اسکرول می‌خوره و نوار ناوبری (با قیمت وسطش) همیشه پایین همون کادر پیداست. */
@media (min-width: 769px) {
    .pb-steps-column {
        position: sticky;
        top: 12px;
        /* مهم: height صریح (نه فقط max-height) لازمه، چون بچه‌های flex:1/min-height:0
           داخلش برای محاسبه‌ی ارتفاع خودشون به یه ارتفاعِ قطعی روی والد نیاز دارن؛
           تکیه‌کردن فقط به max-height باعث می‌شد بعضی مرورگرها محتوا رو تقریباً
           صفر ارتفاع حساب کنن (همون باگِ «آیتم‌ها و دکمه‌ها دیده نمی‌شن») */
        height: calc(100vh - 24px);
        max-height: calc(100vh - 24px);
        min-height: 480px;
        display: flex;
        flex-direction: column;
    }

    .pb-sheet-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .pb-steps-progress {
        flex-shrink: 0;
    }

    .pb-steps-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .pb-step-panel {
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .pb-step-panel.active {
        display: flex;
    }

    .pb-step-panel-title,
    .pb-pizza-name-field {
        flex-shrink: 0;
    }

    .pb-step-options {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-left: 4px;
        padding-right: 2px;
        /* مهم: بدون این‌ها، وقتی کانتینر خیلی از محتوا بلندتره، گرید ردیف‌ها رو
           می‌کِشه تا پر بشه و کارت‌های آیتم غول/بدشکل می‌شن. این‌طوری کارت‌ها همیشه
           اندازه‌ی طبیعی خودشون رو نگه می‌دارن و فضای اضافی فقط زیرشون خالی می‌مونه. */
        align-content: start;
        align-items: start;
    }

    .pb-step-nav {
        flex-shrink: 0;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 14px;
    }

    .pb-step-nav .pb-btn-prev {
        grid-column: 1;
        justify-self: start;
        margin: 0 !important;
    }

    .pb-step-nav .pb-btn-next,
    .pb-step-nav .pb-btn-add-to-cart {
        grid-column: 3;
        justify-self: end;
        margin: 0 !important;
    }

    .pb-step-nav-price {
        grid-column: 2;
        justify-self: center;
    }

    /* پیام موفقیت هم داخل همون کادر استیکی جا می‌گیره؛ خودِ اسکرول روی
       .pb-success-scroll داخلیشه (نه این‌جا)، تا دکمه‌ی پرداخت همیشه پایین بمونه */
    .pb-success-message {
        flex: 1;
        min-height: 0;
    }
}

/* ---- Mobile (<= 768px): تبدیل ویجت به یک صفحه‌ی مستقل تمام‌صفحه ---- */
@media (max-width: 768px) {
    /* صفحه‌ی موفقیت رو یه‌کم فشرده‌تر می‌کنیم؛ چون حالا هدر شیت هم مخفیه، فضای
       بیشتری برای محتوا هست، ولی بازم بهتره کمتر نیاز به اسکرول داشته باشه */
    .pb-success-scroll {
        padding: 22px 16px 12px;
    }

    .pb-success-icon {
        width: 60px;
        height: 60px;
        line-height: 60px;
        font-size: 28px;
        margin-bottom: 10px;
    }

    .pb-success-message h3 {
        font-size: 17px;
        margin-bottom: 6px;
    }

    .pb-success-ready-msg {
        font-size: 11.5px;
        padding: 6px 14px;
        margin-bottom: 14px;
    }

    .pb-order-summary-compact {
        margin-bottom: 14px;
    }

    /* کل ویجت یک صفحه‌ی تمام‌صفحه‌ی مستقل می‌شه — بالای هدر/فوتر قالب سایت قرار می‌گیره */
    .pizza-builder-container {
        position: fixed;
        inset: 0;
        z-index: 999999;
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        background: #fff;
        /* موقع کشیدن شیت یا اسکرول لیست گزینه‌ها، مرورگر پول-تو-رفرش (ریلود ناخواسته) نزنه */
        overscroll-behavior-y: contain;
    }

    /* نوار بالای صفحه: عنوان/لوگوی سایت راست، دکمه‌ی برگشت چپ */
    .pb-mobile-topbar {
        display: block;
        position: relative;
        flex-shrink: 0;
        height: 52px;
        border-bottom: 1px solid #eee;
        background: #fff;
        z-index: 30;
    }

    .pb-mobile-back-btn {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: #fff;
        color: #333;
        font-size: 17px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-family: inherit;
        box-shadow: 0 2px 8px rgba(20, 20, 20, 0.1), 0 0 0 1px rgba(20, 20, 20, 0.04);
        transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }

    .pb-mobile-back-btn span {
        transform: translateX(1px);
    }

    .pb-mobile-back-btn:active {
        transform: translateY(-50%) scale(0.9);
        background: #f2f3f5;
        box-shadow: 0 1px 3px rgba(20, 20, 20, 0.12);
    }

    .pb-mobile-site-title {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
        font-weight: 700;
        color: #333;
        display: flex;
        align-items: center;
        max-width: 60%;
    }

    .pb-mobile-site-title img {
        max-height: 30px;
        width: auto;
    }

    /* بدنه‌ی اصلی: کنواس پیتزا + قیمت + خلاصه — قابل اسکرول، پشت شیت */
    .pb-app-layout {
        flex: 1;
        display: block;
        position: relative;
        overflow: hidden;
    }

    .pb-preview-column {
        position: absolute;
        inset: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* پدینگ پایین همیشه با ارتفاع واقعیِ فعلیِ شیت (چه جمع‌شده، چه باز، چه کشیده‌شده با دست)
           هماهنگه، نه یه درصد ثابت — این‌طوری فضای خالیِ اضافه زیر قیمت کل ایجاد نمی‌شه */
        padding: 10px 16px calc(var(--pb-sheet-current-height, calc(var(--pb-sheet-height-percent, 60) * 1vh)) + 16px);
        overscroll-behavior-y: contain;
        text-align: center;
    }

    .pb-main-title {
        margin-bottom: 6px;
    }

    .pb-glow-title span {
        font-size: 19px;
    }

    /* پیتزا رو بزرگ می‌کنیم که وقتی فرم بازه، نصف بالاش بالای شیت دیده بشه */
    .pb-pizza-preview-wrap {
        width: min(82vw, 360px);
        height: min(82vw, 360px);
        margin: 4px auto 16px;
    }

    .pb-pizza-layers {
        width: 92%;
        height: 92%;
    }

    .pb-summary-box,
    .pb-price-box {
        text-align: right;
    }

    /* ---- شیت پایین: فرم انتخاب مراحل، روی کنواس قرار می‌گیره ---- */
    .pb-steps-column {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        /* ارتفاع فعلی شیت: با کشیدن دستگیره توسط کاربر، به‌صورت زنده تغییر می‌کنه
           و روی همون مقدار (px) می‌مونه. مقدار اولیه از درصدِ تنظیمات میاد. */
        height: var(--pb-sheet-current-height, calc(var(--pb-sheet-height-percent, 60) * 1vh));
        max-height: 92vh;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -8px 24px rgba(20, 20, 20, 0.18);
        transition: height 0.3s ease;
        z-index: 20;
        overflow: hidden;
    }

    /* هنگام کشیدن دستی، انیمیشن transition خاموش می‌شه تا کشیدن نرم باشه */
    .pb-steps-column.pb-sheet-dragging {
        transition: none;
    }

    /* حالت جمع‌شده: فقط هدر (دستگیره + قیمت + دکمه) پیداست */
    .pb-steps-column.pb-sheet-collapsed .pb-sheet-body {
        opacity: 0;
        pointer-events: none;
    }

    .pb-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        height: 60px;
        padding: 8px 14px 0;
        position: relative;
        cursor: grab;
        touch-action: none;
        border-bottom: 1px solid #f2f2f2;
        user-select: none;
        background: #fff;
    }

    .pb-sheet-drag-handle {
        display: block;
        position: absolute;
        top: 7px;
        left: 50%;
        transform: translateX(-50%);
        width: 38px;
        height: 4px;
        border-radius: 4px;
        background: #ddd;
    }

    /* بعد از ثبت سفارش، دیگه چیزی برای کشیدن یا تغییر دادن نیست؛ کل هدر (دستگیره +
       قیمت + برچسب سایز + دکمه‌ی جمع/باز) رو مخفی می‌کنیم چون معنی نداره */
    .pb-steps-column.pb-sheet-order-locked .pb-sheet-header {
        display: none;
    }

    .pb-sheet-header-price {
        margin-top: 4px;
    }

    .pb-sheet-toggle-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 4px;
        background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-dark));
        color: #fff;
        border: none;
        border-radius: 22px;
        padding: 9px 16px;
        font-size: var(--pb-text-size-mobile, 12.5px);
        font-weight: var(--pb-text-weight, 700);
        cursor: pointer;
        font-family: inherit;
        white-space: nowrap;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(var(--pb-primary-rgb), 0.35);
        transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    }

    .pb-sheet-toggle-btn:active {
        transform: scale(0.94);
        box-shadow: 0 2px 6px rgba(var(--pb-primary-rgb), 0.3);
        filter: brightness(0.95);
    }

    .pb-sheet-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        display: flex;
        flex-direction: column;
        opacity: 1;
        transition: opacity 0.2s ease;
    }

    /* Progress bar: کوچیک ولی اسم مرحله همچنان زیرش پیداست */
    .pb-steps-progress {
        flex-shrink: 0;
    }

    .pb-progress-step {
        min-width: 60px;
        padding: 8px 5px;
    }

    .pb-progress-num {
        width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 11px;
    }

    .pb-progress-label {
        font-size: 9.5px;
        max-width: 58px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pb-steps-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .pb-step-panel {
        padding: 12px 16px 10px;
        display: none;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .pb-step-panel.active {
        display: flex;
    }

    .pb-step-panel-title {
        font-size: 14.5px;
        flex-shrink: 0;
    }

    /* گزینه‌ها قابل اسکرول، دکمه‌های ناوبری همیشه پایین و پیدا می‌مونن */
    .pb-step-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        flex: 1;
        min-height: 0;
        padding-bottom: 6px;
        align-content: start;
    }

    /* مراحل «رادیو + مقدار» (مثل سس) کارت‌های افقی‌ان (عکس + نام + دکمه‌های مقدار)؛
       توی گرید سه‌ستونه جا نمی‌شن و عکسشون له/ناپدید می‌شه — این‌ها همیشه
       تک‌ستونه و تمام‌عرض می‌مونن، صرف‌نظر از تعداد آیتم‌ها، و در صورت لزوم اسکرول می‌خورن */
    .pb-step-panel[data-step-type="radio_with_amount"] .pb-step-options {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pb-option-label {
        border-radius: 12px;
    }

    /* سایز عکس و پدینگ/گپ رو دیگه اینجا فیکس نمی‌کنیم؛ clamp() تو قانون پایه با
       container query خودش با عرض واقعی کارت (که تو موبایل دو ستونه‌س) هماهنگ می‌شه
       و هارمونی فاصله‌ها از هر ۴ طرف حفظ می‌مونه */

    .pb-option-check {
        width: 18px;
        height: 18px;
        font-size: 10px;
        top: 5px;
        left: 5px;
    }

    .pb-option-name {
        font-size: 10.5px;
        -webkit-line-clamp: 2;
    }

    .pb-option-price {
        font-size: 10px;
        padding: 2px 7px;
    }

    .pb-pizza-name-field {
        flex-shrink: 0;
        margin: 8px 0;
        padding: 10px;
    }

    /* قیمت وسط ناوبری فقط دسکتاپه؛ توی موبایل قیمت بالای شیت (هدر شیت) همیشه پیداست */
    .pb-step-nav-price {
        display: none;
    }

    /* دکمه‌های ناوبری همیشه پایینِ شیت پیدا و در دسترسن (بدون نیاز به اسکرول اضافه) */
    .pb-step-nav {
        flex-wrap: wrap;
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px 0 4px;
        margin-top: 6px;
        box-shadow: 0 -6px 10px -6px rgba(20, 20, 20, 0.12);
    }

    .pb-btn-prev,
    .pb-btn-next,
    .pb-btn-add-to-cart {
        flex: 1 1 auto;
        min-width: 120px;
        padding: 13px 18px !important;
        min-height: 46px; /* comfortable touch target */
        font-size: var(--pb-text-size-mobile, 13px) !important;
    }

    .pb-amount-btn {
        padding: 10px 14px;
        min-height: 44px;
    }
}

/* ---- Small phones (<= 480px) ---- */
@media (max-width: 480px) {
    .pb-preview-column {
        padding: 10px 12px calc(var(--pb-sheet-current-height, calc(var(--pb-sheet-height-percent, 60) * 1vh)) + 16px);
    }

    .pb-step-options {
        gap: 6px;
    }

    .pb-glow-title span {
        font-size: 17px;
    }

    .pb-progress-label {
        font-size: 9px;
        max-width: 46px;
    }

    .pb-progress-step {
        min-width: 48px;
        padding: 8px 3px;
    }

    .pb-option-name {
        font-size: 10px;
    }

    .pb-option-price {
        font-size: 9.5px;
        padding: 2px 5px;
    }

    .pb-btn-prev,
    .pb-btn-next,
    .pb-btn-add-to-cart {
        width: 100%;
        min-width: 0;
    }

    .pb-success-actions .button {
        width: 100%;
    }
}

/* Larger touch targets everywhere on touch devices, regardless of screen width */
@media (hover: none) and (pointer: coarse) {
    .pb-option-label,
    .pb-option-with-amount,
    .pb-amount-btn,
    .pb-progress-step,
    .pb-btn-prev,
    .pb-btn-next,
    .pb-btn-add-to-cart {
        min-height: 44px;
    }
}
/* ========================================
   Toasts (پیام‌های موفقیت/خطا بالای صفحه)
   ======================================== */
.pb-toast-container {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(92vw, 420px);
    pointer-events: none;
}

.pb-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(20, 20, 20, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-size: var(--pb-text-size-desktop, 14px);
    font-weight: var(--pb-text-weight, 700);
    color: #263238;
    pointer-events: auto;
    animation: pbToastIn 0.25s ease;
    border-right: 4px solid #95a5a6;
}

.pb-toast.pb-toast-success {
    border-right-color: #27ae60;
}

.pb-toast.pb-toast-error {
    border-right-color: #e74c3c;
}

.pb-toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.pb-toast-message {
    flex: 1;
    line-height: 1.5;
}

.pb-toast-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 50%;
    transition: background 0.15s ease, color 0.15s ease;
}

.pb-toast-close:hover {
    background: #f2f2f2;
    color: #444;
}

.pb-toast.pb-toast-leaving {
    animation: pbToastOut 0.3s ease forwards;
}

@keyframes pbToastIn {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pbToastOut {
    from { opacity: 1; transform: translateY(0); max-height: 100px; margin-bottom: 8px; }
    to   { opacity: 0; transform: translateY(-10px); max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
}

/* لرزش کوتاه هنگام تلاش برای رفتن به مرحله‌ی قفل‌شده */
.pb-shake {
    animation: pbShake 0.4s ease;
}

@keyframes pbShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* ========================================
   پاپ‌آپ نهایی: اسم پیتزا + سایز
   ======================================== */
.pb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.55);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pbFadeIn 0.2s ease;
}

.pb-modal-box {
    background: #fff;
    border-radius: 18px;
    padding: 26px 22px 22px;
    width: 100%;
    max-width: 420px;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: pbModalIn 0.25s ease;
    font-family: var(--pb-font-family, 'Vazir', 'Tahoma', Arial, sans-serif);
}

@keyframes pbModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pb-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f2f3f5;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.pb-modal-close:hover {
    background: #e6e7e9;
}

.pb-modal-title {
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    color: #263238;
    margin: 0 0 20px;
    padding-left: 30px;
}

.pb-modal-field {
    margin-bottom: 18px;
}

.pb-modal-label {
    display: block;
    font-size: var(--pb-text-size-desktop, 14px);
    font-weight: var(--pb-text-weight, 700);
    color: #37474f;
    margin-bottom: 10px;
}

.pb-modal-label span {
    font-weight: 400;
    color: #9aa0a6;
    font-size: 12px;
}

.pb-modal-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
}

.pb-modal-input:focus {
    outline: none;
    border-color: var(--pb-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--pb-primary-rgb), 0.12);
}

.pb-modal-size-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pb-modal-size-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #eceff1;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.pb-modal-size-option:hover {
    border-color: var(--pb-primary-light);
}

.pb-modal-size-option.selected {
    border-color: var(--pb-primary);
    background: rgba(var(--pb-primary-rgb), 0.06);
}

.pb-modal-size-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.pb-modal-size-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.pb-modal-size-name {
    font-weight: 700;
    color: #263238;
}

.pb-modal-size-explain {
    font-size: 11px;
    color: #9aa0a6;
    line-height: 1.4;
}

.pb-modal-size-price {
    font-weight: 700;
    color: var(--pb-primary);
    direction: ltr;
    font-size: 13px;
    flex-shrink: 0;
}

.pb-modal-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(var(--pb-primary-rgb), 0.06);
    border: 1.5px dashed rgba(var(--pb-primary-rgb), 0.35);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.pb-modal-total-label {
    font-size: 13px;
    color: #8a8f98;
    font-weight: 700;
}

.pb-modal-total-value {
    font-size: 19px;
    font-weight: 800;
    color: var(--pb-primary);
    direction: ltr;
}

.pb-modal-actions {
    display: flex;
    gap: 10px;
}

.pb-modal-actions .button {
    padding: 12px !important;
    border-radius: 10px !important;
    font-weight: var(--pb-text-weight, 700) !important;
    font-size: var(--pb-text-size-desktop, 14px) !important;
    text-align: center;
    justify-content: center;
}

#pb-modal-confirm-btn {
    flex: 2;
    background: var(--pb-primary) !important;
    border-color: var(--pb-primary) !important;
    color: #fff !important;
}

#pb-modal-cancel-btn {
    flex: 1;
    background: #f2f3f5 !important;
    border-color: #f2f3f5 !important;
    color: #555 !important;
}

/* ---- موبایل: پاپ‌آپ نهایی هم عین شیتِ انتخابِ مراحل، از پایین صفحه با همون استایل باز می‌شه ----
   (نه یهو وسط صفحه) — همون حس بصری، همون گردی گوشه‌ها و دستگیره‌ی بالا */
@media (max-width: 768px) {
    .pb-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .pb-modal-box {
        width: 100%;
        max-width: none;
        max-height: 88vh;
        border-radius: 22px 22px 0 0;
        padding: 22px 16px 16px;
        display: flex;
        flex-direction: column;
        animation: pbModalSlideUp 0.3s ease;
    }

    /* دستگیره‌ی بالای شیت، هم‌استایل با شیتِ انتخاب مراحل */
    .pb-modal-box::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 38px;
        height: 4px;
        border-radius: 4px;
        background: #ddd;
    }

    .pb-modal-title {
        margin-top: 8px;
    }

    /* دکمه‌های افزودن به سبد / انصراف همیشه پایینِ پاپ‌آپ چسبیده و پیدا می‌مونن */
    .pb-modal-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        margin: auto -16px -16px;
        padding: 10px 16px 16px;
        box-shadow: 0 -6px 10px -6px rgba(20, 20, 20, 0.12);
    }
}

@keyframes pbModalSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@media (max-width: 480px) {
    .pb-toast-container {
        top: 10px;
        width: 94vw;
    }

    .pb-modal-box {
        padding: 22px 16px 18px;
    }
}
