/* ================================================
   WEBI COD Builder — Jewelle Bijoux Edition
   Matching: jewelle-bijoux.com
   Fonts: Cormorant Garamond + Montserrat
   Colors: White · Warm Gold #B8935A · Dark #1A1A1A
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Montserrat:wght@300;400;500;600&display=swap');

/* ─── Variables (calquées sur Jewelle Bijoux) ─── */
:root {
    --jb-white:        #FFFFFF;
    --jb-off-white:    #FAFAF8;
    --jb-cream:        #F5F2EC;
    --jb-gold:         #B8935A;     /* couleur dorée du site */
    --jb-gold-dark:    #8C6E3F;
    --jb-gold-light:   #D4AF82;
    --jb-dark:         #1A1A1A;
    --jb-gray:         #6B6B6B;
    --jb-border:       #E8E4DC;
    --jb-border-focus: #B8935A;
    --jb-error:        #C0392B;
    --jb-radius:       2px;
    --jb-radius-btn:   50px;        /* boutons pills comme le site */
    --ff-serif:        'Cormorant Garamond', Georgia, serif;
    --ff-sans:         'Montserrat', sans-serif;
    --shadow-card:     0 2px 20px rgba(0,0,0,.06);
    --transition:      .25s ease;
}

/* ─── Wrapper principal ─── */
.webi-cod-form-wrap {
    background: var(--jb-white);
    border: 1px solid var(--jb-border);
    border-radius: var(--jb-radius);
    padding: 40px 36px 36px;
    max-width: 560px;
    margin: 0 auto;
    font-family: var(--ff-sans);
    direction: rtl;
    position: relative;
}

/* Liseré doré en haut */
.webi-cod-form-wrap::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--jb-gold-light) 30%, var(--jb-gold) 50%, var(--jb-gold-light) 70%, transparent 100%);
}

/* ─── Titre ─── */
.webi-cod-title {
    font-family: var(--ff-serif);
    font-size: 26px;
    font-weight: 400;
    font-style: italic;
    color: var(--jb-dark);
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: 0.5px;
    line-height: 1.2;
}
.webi-cod-subtitle {
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--jb-gold);
    margin: 0 0 28px;
}

/* ─── Séparateur section ─── */
.webi-divider {
    display: flex; align-items: center; gap: 16px;
    margin: 24px 0 20px; color: var(--jb-gray);
    font-size: 9px; font-weight: 600;
    letter-spacing: 3px; text-transform: uppercase;
    font-family: var(--ff-sans);
}
.webi-divider::before, .webi-divider::after {
    content: ''; flex: 1; height: 1px;
    background: var(--jb-border);
}

/* ─── Offres ─── */
.webi-offers-section { margin-bottom: 24px; }

.webi-offers-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--jb-gray);
    text-align: center;
    margin: 0 0 16px;
    font-family: var(--ff-sans);
}

.webi-offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.webi-offer-card {
    position: relative;
    border: 1px solid var(--jb-border);
    border-radius: var(--jb-radius);
    padding: 18px 10px 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--jb-white);
    user-select: none;
}
.webi-offer-card:hover {
    border-color: var(--jb-gold-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184,147,90,.15);
}
.webi-offer-card.selected {
    border-color: var(--jb-gold);
    background: #FDFBF7;
    box-shadow: 0 4px 16px rgba(184,147,90,.2);
}

.webi-offer-badge {
    position: absolute; top: -9px; right: 50%; transform: translateX(50%);
    background: var(--jb-dark); color: var(--jb-gold-light);
    font-size: 8px; font-weight: 600; letter-spacing: 1px;
    padding: 3px 10px; border-radius: var(--jb-radius-btn);
    white-space: nowrap; text-transform: uppercase;
    font-family: var(--ff-sans);
}

.webi-offer-qty {
    width: 44px; height: 44px;
    background: var(--jb-cream); border: 1px solid var(--jb-border);
    border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin: 0 auto 10px;
    transition: all var(--transition);
}
.webi-offer-qty span { font-family: var(--ff-serif); font-size: 20px; font-weight: 500; color: var(--jb-dark); line-height: 1; }
.webi-offer-qty small { font-size: 8px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; color: var(--jb-gray); }

.webi-offer-card.selected .webi-offer-qty {
    background: var(--jb-dark); border-color: var(--jb-dark);
}
.webi-offer-card.selected .webi-offer-qty span,
.webi-offer-card.selected .webi-offer-qty small { color: var(--jb-gold-light); }

.webi-offer-price {
    font-family: var(--ff-serif); font-size: 20px; font-weight: 500; color: var(--jb-dark);
    line-height: 1;
}
.webi-offer-price sup { font-size: 11px; font-family: var(--ff-sans); font-weight: 400; color: var(--jb-gray); }
.webi-offer-unit { font-size: 10px; color: var(--jb-gray); margin-top: 3px; font-family: var(--ff-sans); }
.webi-offer-label {
    font-size: 9px; color: var(--jb-gold-dark); font-weight: 600;
    letter-spacing: 1px; text-transform: uppercase; margin-top: 6px;
    font-family: var(--ff-sans);
}

.webi-offer-check {
    position: absolute; top: 8px; left: 8px;
    width: 16px; height: 16px;
    background: var(--jb-gold); color: var(--jb-white);
    border-radius: 50%; font-size: 9px;
    display: none; align-items: center; justify-content: center;
    font-weight: 700;
}
.webi-offer-card.selected .webi-offer-check { display: flex; }

/* ─── Grille 2 colonnes ─── */
.webi-cod-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ─── Champs ─── */
.webi-cod-field { margin-bottom: 18px; }

.webi-cod-field label {
    display: block;
    font-size: 9px; font-weight: 600;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--jb-gray); margin-bottom: 7px;
    font-family: var(--ff-sans);
}
.webi-cod-field .req { color: var(--jb-gold); margin-right: 2px; }

.webi-cod-field input[type="text"],
.webi-cod-field input[type="tel"],
.webi-cod-field textarea,
.webi-cod-field select {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--jb-border);
    border-radius: var(--jb-radius);
    font-family: var(--ff-sans); font-size: 13px;
    color: var(--jb-dark); background: var(--jb-white);
    transition: border-color var(--transition), box-shadow var(--transition);
    box-sizing: border-box; direction: rtl;
    outline: none; appearance: auto;
}
.webi-cod-field input::placeholder,
.webi-cod-field textarea::placeholder { color: #C0B8AC; font-size: 12px; }

.webi-cod-field input:focus,
.webi-cod-field textarea:focus,
.webi-cod-field select:focus {
    border-color: var(--jb-gold);
    box-shadow: 0 0 0 3px rgba(184,147,90,.10);
}
.webi-cod-field input.error,
.webi-cod-field textarea.error,
.webi-cod-field select.error {
    border-color: var(--jb-error);
    box-shadow: 0 0 0 3px rgba(192,57,43,.08);
}
.webi-cod-field select:disabled { opacity: .45; cursor: not-allowed; background: var(--jb-cream); }

/* Loading spinner communes */
.webi-commune-loading {
    font-size: 11px; color: var(--jb-gray); margin-top: 7px;
    display: flex; align-items: center; gap: 8px;
    font-family: var(--ff-sans); letter-spacing: 0.5px;
}
.webi-commune-loading::before {
    content: ''; width: 12px; height: 12px; flex-shrink: 0;
    border: 1.5px solid var(--jb-border); border-top-color: var(--jb-gold);
    border-radius: 50%; animation: webi-spin .8s linear infinite;
}
@keyframes webi-spin { to { transform: rotate(360deg); } }

/* ─── الأسعار دائماً من اليسار لليمين ─── */
[dir="ltr"],
.webi-offer-price,
.webi-offer-unit,
.webi-summary-product-price,
.webi-summary-shipping-price,
.webi-summary-price,
.webi-shipping-rate-label {
    direction: ltr !important;
    unicode-bidi: embed;
}

/* ─── Options livraison ─── */
.webi-shipping-options { display: flex; gap: 10px; }

.webi-shipping-option {
    flex: 1; border: 1px solid var(--jb-border); border-radius: var(--jb-radius);
    padding: 14px 12px; cursor: pointer; text-align: center;
    transition: all var(--transition); display: flex; flex-direction: column;
    align-items: center; gap: 4px; user-select: none; background: var(--jb-white);
}
.webi-shipping-option input[type="radio"] { display: none; }
.webi-shipping-icon { font-size: 18px; line-height: 1; }
.webi-shipping-label {
    font-size: 9px; font-weight: 600; letter-spacing: 2px;
    text-transform: uppercase; color: var(--jb-gray);
    font-family: var(--ff-sans);
}
/* سعر طريقة الشحن يظهر على البطاقة */
.webi-shipping-rate-label {
    font-size: 13px; font-weight: 600;
    color: var(--jb-dark); font-family: var(--ff-sans);
    min-height: 18px; direction: ltr;
}
.webi-shipping-rate-label.free-rate { color: #4a9e6b; }
.webi-shipping-option:hover { border-color: var(--jb-gold-light); }
.webi-shipping-option.selected { border-color: var(--jb-gold); background: #FDFBF7; }
.webi-shipping-option.selected .webi-shipping-label { color: var(--jb-gold-dark); }

/* ─── Récapitulatif ─── */
.webi-order-summary {
    border-top: 1px solid var(--jb-border);
    padding-top: 16px; margin-bottom: 20px;
}
.webi-summary-lines { display: flex; flex-direction: column; gap: 8px; }

.webi-summary-line {
    display: flex; justify-content: space-between; align-items: center;
}
.webi-summary-label {
    font-size: 9px; font-weight: 600; letter-spacing: 2px;
    text-transform: uppercase; color: var(--jb-gray);
    font-family: var(--ff-sans);
}
.webi-summary-product-price,
.webi-summary-shipping-price {
    font-size: 13px; font-weight: 500; color: var(--jb-dark);
    font-family: var(--ff-sans);
}

.webi-total-line {
    border-top: 1px solid var(--jb-border);
    padding-top: 10px; margin-top: 4px;
}
.webi-summary-label-total {
    font-size: 10px; font-weight: 600; letter-spacing: 2px;
    text-transform: uppercase; color: var(--jb-gray);
    font-family: var(--ff-sans);
}
.webi-summary-price {
    font-family: var(--ff-sans); font-size: 16px; font-weight: 600; color: var(--jb-dark);
    letter-spacing: 0.3px;
}

/* ─── Bouton — pill style comme Jewelle ─── */
.webi-cod-btn {
    width: 100%; padding: 16px 32px;
    background: var(--jb-dark); color: var(--jb-white);
    border: 1px solid var(--jb-dark);
    border-radius: var(--jb-radius-btn);
    font-family: var(--ff-sans); font-size: 10px; font-weight: 600;
    letter-spacing: 3px; text-transform: uppercase; cursor: pointer;
    transition: all var(--transition);
    position: relative; overflow: hidden;
}
.webi-cod-btn:hover {
    background: var(--jb-gold-dark); border-color: var(--jb-gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(184,147,90,.3);
}
.webi-cod-btn:active { transform: translateY(0); }
.webi-cod-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── Messages ─── */
.webi-cod-message {
    padding: 14px 18px; border-radius: var(--jb-radius);
    font-size: 13px; font-weight: 400; text-align: center; margin-bottom: 20px;
    font-family: var(--ff-sans); letter-spacing: 0.3px;
}
.webi-cod-success {
    background: #F7F3EC; color: var(--jb-gold-dark);
    border: 1px solid var(--jb-gold-light);
    font-family: var(--ff-serif); font-style: italic; font-size: 16px;
}
.webi-cod-error {
    background: #FDF5F5; color: var(--jb-error);
    border: 1px solid #F0C0C0;
}

/* ─── حالات الشحن — Loading / Error ─── */
.webi-rate-loading-state {
    opacity: .5;
    pointer-events: none;
}
.webi-rate-loading {
    color: var(--jb-gray);
    font-style: italic;
    font-size: 11px;
    animation: webi-fade .8s ease-in-out infinite alternate;
}
@keyframes webi-fade { from { opacity:.4; } to { opacity:1; } }

.webi-no-zone-msg {
    color: #c0392b;
    font-size: 11px;
    font-style: italic;
}
.webi-error-pulse {
    animation: webi-pulse .4s ease-in-out 3;
}
@keyframes webi-pulse {
    0%,100% { opacity:1; }
    50%      { opacity:.3; }
}


@media (max-width: 540px) {
    .webi-cod-form-wrap { padding: 28px 18px 24px; }
    .webi-cod-row { grid-template-columns: 1fr; }
    .webi-offers-grid { grid-template-columns: repeat(2, 1fr); }
    .webi-cod-title { font-size: 22px; }
    .webi-shipping-options { flex-direction: column; }
    .webi-order-summary .webi-summary-price { font-size: 15px; }
}


/* ── Stop Desk visibility control ────────────────────────── */
.webi-stopdesk-option.webi-hidden        { display: none !important; }
.webi-stopdesk-option:not(.webi-hidden)  { display: flex !important; }

/* ── Quantity Control ─────────────────────────────────────── */
.webi-qty-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 14px 0 4px;
    padding: 10px 16px;
    background: var(--jb-bg, #faf9f7);
    border: 1px solid var(--jb-border, #E8E4DC);
    border-radius: 8px;
}
.webi-qty-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--jb-gray, #6B6B6B);
}
.webi-qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--jb-border, #E8E4DC);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.webi-qty-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--jb-dark, #1A1A1A);
    transition: background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.webi-qty-btn:hover  { background: var(--jb-border, #E8E4DC); }
.webi-qty-btn:active { background: #d8d3cb; }
.webi-qty-btn:disabled,
.webi-qty-btn[disabled] {
    opacity: .3;
    cursor: default;
}
.webi-qty-display {
    min-width: 38px;
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--jb-dark, #1A1A1A);
    border-left: 1px solid var(--jb-border, #E8E4DC);
    border-right: 1px solid var(--jb-border, #E8E4DC);
    padding: 0 6px;
    line-height: 36px;
}

/* ✅ قسم الكمية فوق العنوان */
.webi-qty-above-title {
    margin: 0 0 18px 0;
    padding: 12px 18px;
    background: var(--jb-cream, #F5F2EC);
    border: 1px solid var(--jb-gold-light, #D4AF82);
    border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   STICKY "Commander maintenant" — يظهر فقط في صفحات الفورم
   ═══════════════════════════════════════════════════════════════ */
.webi-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 99999;

    /* نفس عرض الفورم */
    width: calc(100% - 32px);
    max-width: 560px;

    /* نفس خلفية الفورم: كريم دافئ + حدود ذهبية */
    background: var(--jb-cream, #F5F2EC);
    border: 1px solid var(--jb-gold-light, #D4AF82);
    border-bottom: none;

    /* حواف مستديرة في الأعلى فقط */
    border-radius: 20px 20px 0 0;

    padding: 16px 20px 20px;
    box-shadow: 0 -8px 32px rgba(184, 147, 90, 0.12), 0 -2px 8px rgba(0,0,0,0.06);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;

    transition: transform 0.4s cubic-bezier(.4,0,.2,1), opacity 0.35s ease;
    opacity: 1;
}

/* الخط الذهبي المتدرج في الأعلى — نفس .webi-cod-form-wrap::before */
.webi-sticky-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 20px; right: 20px; height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--jb-gold-light, #D4AF82) 20%,
        var(--jb-gold, #B8935A) 50%,
        var(--jb-gold-light, #D4AF82) 80%,
        transparent 100%
    );
}

/* مقبض بصري صغير فوق الشريط */
.webi-sticky-bar::after {
    content: '';
    position: absolute;
    top: 8px; left: 50%; transform: translateX(-50%);
    width: 32px; height: 3px;
    background: var(--jb-gold-light, #D4AF82);
    border-radius: 2px;
    opacity: 0.6;
}

/* مخفي عندما يكون الزر الأصلي ظاهراً */
.webi-sticky-bar.webi-sticky-hidden {
    transform: translateX(-50%) translateY(110%);
    opacity: 0;
    pointer-events: none;
}

/* الزر — نفس .webi-cod-btn تماماً */
.webi-sticky-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    width: 100%;
    max-width: 420px;
    padding: 16px 32px;
    margin-top: 14px;

    /* نفس الفورم: خلفية داكنة + نص أبيض */
    background: var(--jb-dark, #1A1A1A);
    color: var(--jb-white, #fff);
    border: 1px solid var(--jb-dark, #1A1A1A);
    border-radius: var(--jb-radius-btn, 50px);

    font-family: var(--ff-sans, 'Montserrat', sans-serif);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;

    transition: background 0.25s ease, border-color 0.25s ease,
                transform 0.2s ease, box-shadow 0.25s ease;
}

.webi-sticky-cta:hover {
    background: var(--jb-gold-dark, #8C6E3F);
    border-color: var(--jb-gold-dark, #8C6E3F);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(184, 147, 90, 0.30);
}

.webi-sticky-cta:active {
    transform: translateY(0);
    box-shadow: none;
}

.webi-sticky-cta svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 480px) {
    .webi-sticky-bar {
        width: calc(100% - 16px);
        padding: 14px 16px 16px;
        border-radius: 16px 16px 0 0;
    }
    .webi-sticky-cta {
        padding: 14px 24px;
        letter-spacing: 2px;
    }
}
