/* ==========================================================================
   1. الأنماط الأساسية والمتغيرات (Reset & Design Tokens)
   ========================================================================== */
.wsc-cart-container {
    --wsc-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wsc-font-arabic: 'Cairo', 'Segoe UI', Tahoma, sans-serif;

    /* 📐 مقياس الانحناءات — أكبر وأنعم من التصميم القديم لشكل أكثر حداثة */
    --wsc-radius-sm: 10px;
    --wsc-radius-md: 16px;
    --wsc-radius-lg: 26px;
    --wsc-radius-pill: 999px;

    /* 🌥️ ظلال ناعمة متدرجة */
    --wsc-shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
    --wsc-shadow-elevated: 0 16px 40px rgba(15, 23, 42, 0.16);

    box-sizing: border-box;
}

.wsc-cart-container *,
.wsc-cart-container *::before,
.wsc-cart-container *::after {
    box-sizing: inherit;
}

/* 🎨 الثيم المضيء (Light Theme) */
.wsc-light-theme {
    --wsc-bg: #ffffff;
    --wsc-header-bg: #fbfbfc;
    --wsc-card-bg: #f8fafc;
    --wsc-text: #16181d;
    --wsc-sub-text: #70757e;
    --wsc-border: #eef0f3;
    --wsc-input-bg: #ffffff;
    --wsc-alert-error-bg: #fef2f2;
    --wsc-alert-error-text: #b91c1c;
    --wsc-alert-success-bg: #f0fdf4;
    --wsc-alert-success-text: #16a34a;
    --wsc-upsell-bg: #f8fafc;
}

/* 🌙 الثيم المظلم (Dark Theme) */
.wsc-dark-theme {
    --wsc-bg: #17181c;
    --wsc-header-bg: #101114;
    --wsc-card-bg: #26282f;
    --wsc-text: #f5f6f7;
    --wsc-sub-text: #9a9ea6;
    --wsc-border: #34363d;
    --wsc-input-bg: #1d1e23;
    --wsc-alert-error-bg: #3a1414;
    --wsc-alert-error-text: #fca5a5;
    --wsc-alert-success-bg: #0f2a18;
    --wsc-alert-success-text: #86efac;
    --wsc-upsell-bg: #26282f;
}

/* 🌍 التوجيه والخطوط حسب اللغة تلقائياً */
.wsc-rtl { direction: rtl; font-family: var(--wsc-font-arabic); }
.wsc-ltr { direction: ltr; font-family: var(--wsc-font-sans); }

.wsc-cart-container button,
.wsc-cart-container input,
.wsc-cart-container a {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
}

/* ==========================================================================
   2. زرار التشغيل الخارجي (Floating Action Button)
   ========================================================================== */
.wsc-toggle-btn {
    position: fixed;
    background: linear-gradient(135deg, var(--wsc-primary, #111111), var(--wsc-gradient-end, var(--wsc-primary, #111111)));
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 99999;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- شكل الدائرة العائمة: أيقونة بس + شارة عدد منفصلة (نمط تطبيقات حديثة) ---- */
.wsc-btn-floating-circle {
    width: 62px;
    height: 62px;
    border-radius: var(--wsc-radius-pill);
    position: fixed;
    overflow: visible;
    /* 🎨 خلفية متدرجة (لو التدرج متفعّلش، اللون التاني بيبقى نفس الأول فيطلع صافي) */
    background: linear-gradient(135deg, var(--wsc-primary, #111111), var(--wsc-gradient-end, var(--wsc-primary, #111111)));
    box-shadow:
        0 10px 30px -6px rgba(var(--wsc-primary-rgb, 17, 17, 17), 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

/* 📍 الأماكن الستة القابلة للاختيار من لوحة التحكم */
.wsc-pos-bottom-right { bottom: 28px; right: 28px; left: auto; top: auto; }
.wsc-pos-bottom-left  { bottom: 28px; left: 28px; right: auto; top: auto; }
.wsc-pos-top-right    { top: 32px; right: 28px; left: auto; bottom: auto; }
.wsc-pos-top-left     { top: 32px; left: 28px; right: auto; bottom: auto; }
.wsc-pos-top-center   { top: 32px; left: 50%; transform: translateX(-50%); bottom: auto; right: auto; }
.wsc-pos-bottom-center{ bottom: 28px; left: 50%; transform: translateX(-50%); top: auto; right: auto; }

.wsc-pos-top-center:hover,
.wsc-pos-bottom-center:hover {
    transform: translateX(-50%) translateY(-3px) scale(1.04);
}

/* ✨ توهج نابض خلف الزرار — لمسة عصرية 2026 */
.wsc-toggle-glow {
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--wsc-primary, #111111), var(--wsc-gradient-end, var(--wsc-primary, #111111)));
    opacity: 0.35;
    filter: blur(14px);
    z-index: -1;
    animation: wscGlowPulse 2.6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes wscGlowPulse {
    0%, 100% { opacity: 0.28; transform: scale(0.94); }
    50% { opacity: 0.5; transform: scale(1.08); }
}

.wsc-toggle-icon {
    font-size: 24px;
    line-height: 1;
    position: relative;
}

.wsc-toggle-badge {
    position: absolute;
    top: -4px;
    background: #ef4444;
    color: #ffffff;
    min-width: 22px;
    height: 22px;
    border-radius: var(--wsc-radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    padding: 0 5px;
    border: 2px solid var(--wsc-bg, #fff);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}
.wsc-rtl .wsc-toggle-badge { left: -4px; right: auto; }
.wsc-ltr .wsc-toggle-badge { right: -4px; left: auto; }

/* ---- شكل الشريط السفلي اللاصق: أيقونة + نص + عدد ---- */
.wsc-btn-sticky-bar {
    bottom: 0;
    left: 0;
    width: 100vw;
    padding: 16px;
    font-size: 15px;
    gap: 10px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    border-radius: var(--wsc-radius-md) var(--wsc-radius-md) 0 0;
}

.wsc-btn-sticky-bar .wsc-toggle-badge {
    position: static;
    border: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.25);
}

.wsc-toggle-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.wsc-btn-floating-circle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 14px 36px -6px rgba(var(--wsc-primary-rgb, 17, 17, 17), 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

.wsc-btn-floating-circle:active {
    transform: translateY(-1px) scale(0.96);
    transition-duration: 0.1s;
}

.wsc-refresh-icon {
    display: inline-block;
    font-size: 12px;
    opacity: 0.7;
    margin-inline-start: 6px;
    animation: wscSpin 1.2s linear infinite;
}

/* ==========================================================================
   3. الـ Overlay والـ Drawer الأساسي
   ========================================================================== */
.wsc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 17, 21, 0.5);
    z-index: 100000;
    backdrop-filter: blur(3px);
    animation: wscFadeIn 0.25s ease-out forwards;
}

.wsc-drawer {
    position: fixed;
    top: 0;
    width: 430px;
    max-width: 88vw;
    height: 100vh;
    background: var(--wsc-bg);
    z-index: 100011;
    display: flex;
    flex-direction: column;
}

/* ---- أنيميشن Slide (الافتراضي) ---- */
.wsc-rtl .wsc-drawer:not(.wsc-anim-fade) {
    left: 0; right: auto;
    border-radius: 0 var(--wsc-radius-lg) var(--wsc-radius-lg) 0;
    box-shadow: var(--wsc-shadow-elevated);
    animation: wscSlideLeft 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.wsc-ltr .wsc-drawer:not(.wsc-anim-fade) {
    right: 0; left: auto;
    border-radius: var(--wsc-radius-lg) 0 0 var(--wsc-radius-lg);
    box-shadow: var(--wsc-shadow-elevated);
    animation: wscSlideRight 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ---- أنيميشن Fade (اختياري من لوحة التحكم) ---- */
.wsc-drawer.wsc-anim-fade {
    right: 0; left: auto;
    border-radius: var(--wsc-radius-lg) 0 0 var(--wsc-radius-lg);
    box-shadow: var(--wsc-shadow-elevated);
    animation: wscFadeInScale 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.wsc-rtl .wsc-drawer.wsc-anim-fade {
    right: auto; left: 0;
    border-radius: 0 var(--wsc-radius-lg) var(--wsc-radius-lg) 0;
}

/* ==========================================================================
   4. مكونات الـ Drawer الداخلية (Header, Alerts, Progress Bars)
   ========================================================================== */
.wsc-drawer-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--wsc-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: var(--wsc-header-bg);
}

.wsc-drawer-title {
    margin: 0;
    color: var(--wsc-text);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.3px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 💱 محول العملات المخصص (Dropdown فخم بدل الـ select الافتراضي) */
.wsc-currency-dropdown {
    position: relative;
    flex-shrink: 0;
}

.wsc-currency-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--wsc-card-bg) !important;
    color: var(--wsc-text) !important;
    border: 1px solid var(--wsc-border) !important;
    border-radius: var(--wsc-radius-pill);
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none !important;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.wsc-currency-trigger:hover {
    border-color: var(--wsc-primary, #111111) !important;
}

.wsc-currency-flag {
    font-size: 14px;
    line-height: 1;
}

.wsc-currency-chevron {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s ease;
    margin-inline-start: 1px;
}
.wsc-currency-chevron-open {
    transform: rotate(180deg);
}

.wsc-currency-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    background: var(--wsc-bg);
    border: 1px solid var(--wsc-border);
    border-radius: var(--wsc-radius-md);
    box-shadow: var(--wsc-shadow-elevated);
    padding: 6px;
    margin: 0;
    list-style: none;
    z-index: 100020;
    animation: wscCurrencyMenuIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 240px;
    overflow-y: auto;
}
.wsc-rtl .wsc-currency-menu {
    right: auto;
    left: 0;
}

@keyframes wscCurrencyMenuIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wsc-currency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--wsc-radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--wsc-text);
    cursor: pointer;
    transition: background 0.12s ease;
}
.wsc-currency-option:hover {
    background: var(--wsc-card-bg);
}
.wsc-currency-option-active {
    background: var(--wsc-card-bg);
    color: var(--wsc-primary, #111111);
}

.wsc-currency-check {
    margin-inline-start: auto;
    font-size: 11px;
    color: var(--wsc-primary, #111111);
}

.wsc-close-btn {
    background: var(--wsc-card-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--wsc-radius-pill);
    font-size: 15px;
    cursor: pointer;
    color: var(--wsc-sub-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wsc-close-btn:hover { background: #fee2e2; color: #ef4444; }

/* ⚠️ الـ Toasts / Alerts */
.wsc-alert {
    margin: 14px 24px 0;
    padding: 11px 16px;
    border-radius: var(--wsc-radius-sm);
    font-size: 13px;
    font-weight: 600;
}
.wsc-alert-error { background: var(--wsc-alert-error-bg); color: var(--wsc-alert-error-text); }
.wsc-alert-success { background: var(--wsc-alert-success-bg); color: var(--wsc-alert-success-text); }

/* 🚚 شريط الشحن المجاني Progress Bar */
.wsc-shipping-wrapper {
    padding: 16px 24px 4px;
    background: var(--wsc-bg);
}

.wsc-shipping-text {
    margin: 0 0 9px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--wsc-text);
}

.wsc-progress-bar-bg {
    width: 100%;
    height: 7px;
    background: var(--wsc-border);
    border-radius: var(--wsc-radius-pill);
    overflow: hidden;
}

.wsc-progress-bar-fill {
    height: 100%;
    border-radius: var(--wsc-radius-pill);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   5. قائمة عناصر السلة — بطاقات مرفوعة بدل قائمة بخطوط فاصلة
   ========================================================================== */
.wsc-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 24px;
    -webkit-overflow-scrolling: touch;
    /* ⚠️ إخفاء شكل الـ scrollbar بصريًا بس، مع إبقاء التمرير شغال عادي بالماوس
       أو اللمس أو لوحة المفاتيح — مفيش أي تأثير على الموبايل أصلاً لأن أغلب
       متصفحات الموبايل بتخفيها تلقائيًا، والتعديل ده بيوحّد الشكل على كل الأجهزة. */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Edge القديم / IE */
}
.wsc-drawer-body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge الحديث */
}

.wsc-loading-text, .wsc-empty-text {
    text-align: center;
    color: var(--wsc-sub-text);
    margin-top: 60px;
    font-size: 14px;
}

.wsc-cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--wsc-card-bg);
    border: 1px solid var(--wsc-border);
    border-radius: var(--wsc-radius-md);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--wsc-shadow-soft);
    transition: opacity 0.2s ease;
}

.wsc-item-img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: var(--wsc-radius-sm);
    flex-shrink: 0;
}

.wsc-item-details { flex: 1; min-width: 0; }

.wsc-item-name {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: var(--wsc-text);
    font-weight: 700;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wsc-quantity-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    background: var(--wsc-bg);
    border-radius: var(--wsc-radius-pill);
    padding: 3px;
    width: fit-content;
}

.wsc-quantity-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--wsc-text);
    cursor: pointer;
    border-radius: var(--wsc-radius-pill);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wsc-quantity-btn:hover:not(:disabled) {
    background: var(--wsc-card-bg);
}

.wsc-quantity-value {
    min-width: 22px;
    text-align: center;
    font-size: 13px;
    color: var(--wsc-text);
    font-weight: 700;
}

.wsc-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.wsc-item-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wsc-save-later-btn {
    background: none;
    border: none;
    color: var(--wsc-sub-text);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    padding: 0;
}
.wsc-save-later-btn:hover { color: #f59e0b; }

.wsc-delete-btn {
    background: none;
    border: none;
    color: var(--wsc-sub-text);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    padding: 0;
}
.wsc-delete-btn:hover { color: #ef4444; }

.wsc-item-price {
    font-weight: 800;
    color: var(--wsc-text);
    font-size: 14px;
}

/* ⭐ محفوظ لاحقاً */
.wsc-saved-later-container {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed var(--wsc-border);
}

.wsc-saved-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* ==========================================================================
   6. مقترحات الـ Upsell التسويقية الذكية
   ========================================================================== */
.wsc-upsell-container {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed var(--wsc-border);
}

.wsc-upsell-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 800;
    color: var(--wsc-text);
}

.wsc-upsell-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wsc-upsell-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--wsc-upsell-bg);
    border: 1px solid var(--wsc-border);
    border-radius: var(--wsc-radius-md);
}

.wsc-upsell-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.wsc-upsell-img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: var(--wsc-radius-sm);
    flex-shrink: 0;
}

.wsc-upsell-name {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--wsc-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wsc-upsell-price {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
}

.wsc-upsell-add-btn {
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--wsc-radius-pill);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.wsc-upsell-add-btn:hover { filter: brightness(1.05); }

/* ==========================================================================
   7. الـ Footer وعناصر الكوبونات والدفع (Checkout & Coupons)
   ========================================================================== */
.wsc-drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--wsc-border);
    background: var(--wsc-header-bg);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.wsc-coupon-section {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--wsc-border);
    padding-bottom: 16px;
}

.wsc-coupon-form {
    display: flex;
    gap: 8px;
}

.wsc-coupon-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--wsc-border) !important;
    /* ⚠️ !important ضروري هنا: تيمات ووردبريس كتير بتحط قواعد عامة على كل
       عناصر <input> بأولوية أعلى (زي background-color: #fff)، وده كان بيخلي
       خانة الكوبون تفضل بيضاء وغير مقروءة في الوضع الداكن رغم إننا محددين
       لونها بمتغيرات الثيم. الـ !important بيضمن إن لوننا هو اللي يتطبق دايمًا. */
    background: var(--wsc-input-bg) !important;
    color: var(--wsc-text) !important;
    border-radius: var(--wsc-radius-sm);
    font-size: 14px;
    min-width: 0;
    box-shadow: none !important;
}
.wsc-coupon-input::placeholder {
    color: var(--wsc-sub-text) !important;
    opacity: 1;
}
.wsc-coupon-input:focus {
    border-color: var(--wsc-primary, #111111) !important;
}

.wsc-coupon-submit-btn {
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--wsc-radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.wsc-coupon-submit-btn:hover { filter: brightness(1.05); }

.wsc-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0369a1;
    padding: 5px 12px;
    border-radius: var(--wsc-radius-pill);
    font-size: 12px;
    font-weight: 700;
    margin-top: 10px;
}

.wsc-coupon-remove-btn {
    background: none;
    border: none;
    color: #0369a1;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    font-weight: 700;
    line-height: 1;
}

.wsc-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.wsc-total-label { color: var(--wsc-sub-text); font-size: 13px; font-weight: 600; }
.wsc-total-value { color: var(--wsc-text); font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }

.wsc-checkout-btn {
    display: block;
    text-decoration: none;
    color: #ffffff;
    text-align: center;
    padding: 16px;
    border-radius: var(--wsc-radius-md);
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.wsc-checkout-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* ==========================================================================
   8. ⏱️ تايمر حجز السلة (Reservation Timer)
   ========================================================================== */
.wsc-reservation-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 11px 24px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
}

.wsc-dark-theme .wsc-reservation-bar {
    background: #3a1d06;
    color: #fdba74;
}

.wsc-reservation-bar.wsc-reservation-urgent {
    background: #fef2f2;
    color: #b91c1c;
    animation: wscPulseUrgent 1s ease-in-out infinite;
}

.wsc-dark-theme .wsc-reservation-bar.wsc-reservation-urgent {
    background: #3a1414;
    color: #fca5a5;
}

.wsc-reservation-time {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 8px;
    border-radius: var(--wsc-radius-sm);
}

@keyframes wscPulseUrgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* ==========================================================================
   9. ⚠️ تنبيه المخزون المنخفض (Low Stock Alert)
   ========================================================================== */
.wsc-low-stock-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 9px;
    background: #fff7ed;
    color: #c2410c;
    border-radius: var(--wsc-radius-pill);
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

.wsc-dark-theme .wsc-low-stock-badge {
    background: #3a1d06;
    color: #fdba74;
}

/* ==========================================================================
   10. 🎁 الهدية المجانية (Free Gift)
   ========================================================================== */
.wsc-gift-wrapper {
    padding: 16px 24px 4px;
    background: var(--wsc-bg);
}

.wsc-gift-text {
    margin: 0 0 9px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--wsc-text);
}

.wsc-gift-item {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), var(--wsc-card-bg));
}

.wsc-gift-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0fdf4;
    color: #15803d;
    padding: 3px 9px;
    border-radius: var(--wsc-radius-pill);
    font-size: 10.5px;
    font-weight: 700;
    margin-top: 5px;
    width: fit-content;
}

.wsc-dark-theme .wsc-gift-tag {
    background: #0f2a18;
    color: #86efac;
}

.wsc-gift-price {
    font-weight: 800;
    color: #16a34a;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   11.5 ⚡ الشراء السريع (Express Checkout)
   ========================================================================== */
.wsc-express-section {
    margin-bottom: 12px;
}

.wsc-express-toggle-btn {
    display: block;
    width: 100%;
    background: var(--wsc-card-bg);
    color: var(--wsc-text);
    border: 1.5px dashed var(--wsc-border);
    padding: 13px;
    border-radius: var(--wsc-radius-md);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
}
.wsc-express-toggle-btn:hover {
    border-color: var(--wsc-primary, #111111);
}

.wsc-express-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--wsc-card-bg);
    border: 1px solid var(--wsc-border);
    border-radius: var(--wsc-radius-md);
    padding: 14px;
}

.wsc-express-input {
    padding: 10px 12px;
    border: 1.5px solid var(--wsc-border) !important;
    background: var(--wsc-input-bg) !important;
    color: var(--wsc-text) !important;
    border-radius: var(--wsc-radius-sm);
    font-size: 13.5px;
    width: 100%;
    box-shadow: none !important;
}
.wsc-express-input::placeholder {
    color: var(--wsc-sub-text) !important;
    opacity: 1;
}
.wsc-express-input:focus {
    border-color: var(--wsc-primary, #111111) !important;
}

.wsc-express-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.wsc-express-cancel-btn {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--wsc-sub-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 10px;
}

.wsc-express-submit-btn {
    flex: 1;
    color: #ffffff;
    border: none;
    padding: 11px;
    border-radius: var(--wsc-radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 13.5px;
}
.wsc-express-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.wsc-express-or-text {
    text-align: center;
    color: var(--wsc-sub-text);
    font-size: 11px;
    font-weight: 600;
    margin: 8px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   11. الأنيميشن
   ========================================================================== */
@keyframes wscSlideLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes wscSlideRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes wscFadeInScale {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes wscFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ==========================================================================
   12. التجاوب مع الموبايل والتابلت (Responsive)
   ========================================================================== */

/* 📱 تابلت */
@media (max-width: 900px) {
    .wsc-drawer {
        width: 380px;
    }
}

/* 📱 موبايل كبير / تابلت صغير */
@media (max-width: 600px) {
    .wsc-drawer {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0 !important;
    }
    .wsc-drawer-header {
        padding: 18px 18px;
        padding-top: max(18px, env(safe-area-inset-top));
    }
    .wsc-drawer-body {
        padding: 14px 18px;
    }
    .wsc-drawer-footer {
        padding: 16px 18px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    /* ⚠️ الأقسام دي (تنبيهات، شريط الشحن، الهدية، تايمر الحجز) كانت لسه
       بتاخد الـ padding الأصلي 24px حتى بعد ما باقي الدرج قلّ لـ 18px على
       الموبايل، فكانت شكلها بتبان مزّاحة/أعرض من باقي المحتوى. */
    .wsc-alert {
        margin-left: 18px;
        margin-right: 18px;
    }
    .wsc-shipping-wrapper,
    .wsc-gift-wrapper {
        padding-left: 18px;
        padding-right: 18px;
    }
    .wsc-reservation-bar {
        padding-left: 18px;
        padding-right: 18px;
    }
    .wsc-item-img {
        width: 54px;
        height: 54px;
    }
    /* أزرار أكبر للمس على الموبايل */
    .wsc-quantity-btn {
        width: 30px;
        height: 30px;
    }
    .wsc-close-btn {
        width: 36px;
        height: 36px;
    }
    /* ⚠️ عنوان الدرج ممكن ياخد مساحة كبيرة على شاشة صغيرة جنب محول العملات
       وزرار الإغلاق، فبنمنعه يكسر السطر أو يدفع العناصر التانية بره الشاشة */
    .wsc-currency-trigger {
        font-size: 11px;
        padding: 6px 9px;
    }

    /* 📍 على الموبايل، الزرار العائم بيفضل تحت دايمًا مهما كان اختيار الأدمن
       (فوق/تحت)، ونحافظ بس على المحاذاة الأفقية (يمين/شمال/وسط) اللي هو
       اختارها. كمان بنراعي المساحة الآمنة (Safe Area) لشاشات الموبايل
       الحديثة اللي فيها خط سفلي (Home Indicator). */
    .wsc-pos-top-right,
    .wsc-pos-bottom-right {
        top: auto;
        bottom: max(20px, env(safe-area-inset-bottom));
        right: 18px;
        left: auto;
    }
    .wsc-pos-top-left,
    .wsc-pos-bottom-left {
        top: auto;
        bottom: max(20px, env(safe-area-inset-bottom));
        left: 18px;
        right: auto;
    }
    .wsc-pos-top-center,
    .wsc-pos-bottom-center {
        top: auto;
        bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* 📱 موبايل صغير */
@media (max-width: 380px) {
    .wsc-btn-floating-circle {
        width: 56px;
        height: 56px;
    }
    .wsc-pos-bottom-right,
    .wsc-pos-top-right { right: 14px; }
    .wsc-pos-bottom-left,
    .wsc-pos-top-left { left: 14px; }

    .wsc-cart-item {
        gap: 10px;
        padding: 10px;
    }
    .wsc-upsell-name {
        max-width: 110px;
    }
    .wsc-reservation-bar {
        font-size: 11.5px;
        padding: 10px 14px;
    }
    .wsc-drawer-title {
        font-size: 17px;
    }
}

/* 🖥️ حماية إضافية لشاشات قصيرة (لاندسكيب على الموبايل) */
@media (max-height: 500px) {
    .wsc-drawer-header {
        padding: 12px 20px;
    }
    .wsc-loading-text, .wsc-empty-text {
        margin-top: 24px;
    }
}
