/* الحاوية الرئيسية */
.ws-cod {
   direction: rtl;
    max-width: 900px;
    margin: 28px auto;
    padding: 20px 24px 24px 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 5px 9px rgb(0 0 0 / 10%);
    color: #000000;
    font-family: "Tajawal", Tahoma, Arial, sans-serif;
    border-top: 6px solid var(--eco-primary);
}

.ws-cod * {
    box-sizing: border-box;
}

/* العنوان */
.ws-cod-heading {
    text-align: center;
    margin-bottom: 30px;
}

.ws-cod-heading p {
    margin: 0;
    color: #64748b;
}


/* قسم العروض */
.ws-cod-section {
    margin: 18px 0;
}

.ws-cod-section h3 {
    font-size: 19px;
    margin: 0 0 12px;
}

.ws-cod-offers {
    display: block;
}

.submit-quantity {
    display: flex;
    align-items: center;
    margin-top: 35px;
    gap: 12px;
}

/* بطاقة العرض */
.ws-cod-offer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    cursor: pointer;
    transition: .2s;
    background: #fff;
    margin-bottom: 10px;
}

.ws-cod-offer input {
    accent-color: var(--eco-primary);
    flex-shrink: 0;
}

.ws-cod-offer img,
.ws-cod-offer-placeholder {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #f1f5f9;
}

.ws-cod-offer-placeholder {
    display: grid;
    place-items: center;
    color: #000000;
}

.ws-cod-offer-content {
   display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
}
span.ws-cod-offer-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.ws-cod-offer-main strong {
    display: block;
}
span.ws-cod-offer-prices {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    direction: rtl;
}
.ws-cod-offer-prices del {
    margin: 0;
}

.ws-cod-offer-prices b {
    margin: 0;
}

.ws-cod-offer-main small {
    display: block;
}

.ws-cod-offer-content strong {
    font-size: 16px;
}

.ws-cod-offer-content small {
    color: #64748b;
}

.ws-cod-offer-content b {
    color: var(--eco-primary);
    font-size: 18px;
}

.ws-cod-offer-content del {
    color: #ff000099;
    font-size: 13px;
}

.ws-cod-offer-content em {
    font-style: inherit;
    background: #dcfce7;
    color: #15803d;
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 14px;
    font-weight: bold;
}

.ws-cod-offer:has(input[type="radio"]:checked) {
    border: 2px solid var(--eco-primary);
}

/* الحقول */
.ws-cod-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.ws-cod-fields label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}
.ws-cod-qty-control input[type="number"]::-webkit-inner-spin-button, .ws-cod-qty-control input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ws-cod-fields input {
    width: 100%;
    min-height: 45px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 12px 12px;
    background: #fff;
    font-size: 17px;
}

.ws-cod-fields input:focus {
    outline: none;
    border-color: #1769d2;
    box-shadow: 0 0 0 3px rgba(23, 105, 210, .1);
}

/* التحكم في الكمية */
.ws-cod-quantity {
    max-width: 115px;
}

.ws-cod-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #00000026;
    padding: 5px;
    border-radius: 8px;
}

.ws-cod-qty-control button {
    width: 40px;
    height: 38px;
    padding: 0;
    border: 1px solid #e9e6ed;
    background: #e7e7e7;
    cursor: pointer;
    border-radius: 4px;
    color: #000;
    margin: 0;
}

.ws-cod-qty-control input {
    width: 34px;
    text-align: center;
    padding: 5px;
    border: 0;
    border-radius: 4px;
}

.ws-cod-qty-control button:first-child {
    border-radius: 8px;
}

.ws-cod-qty-control button:last-child {
    border-radius: 8px;
}

/* ملخص الطلب */
.ws-cod-summary {
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: none;
}

.ws-cod-summary div {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 7px 0;
}

.ws-cod-summary span {
    color: #64748b;
}

.ws-cod-summary .ws-cod-total {
    font-size: 22px;
    color: #1769d2;
}

.ws-cod-summary small {
    display: block;
    margin-top: 8px;
    color: #64748b;
}

/* زر الطلب */
.ws-cod-submit {
    display: block;
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--eco-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}

.ws-cod-submit:hover {
    background: #00000078;
}

.ws-cod-submit:disabled {
    opacity: .65;
    cursor: wait;
}

/* رسائل النجاح والخطأ */
.ws-cod-message {
    margin-top: 12px;
}

.ws-cod-message:empty {
    display: none;
}

.ws-cod-message.success,
.ws-cod-message.error {
    padding: 12px;
    border-radius: 8px;
}

.ws-cod-message.success {
    background: #dcfce7;
    color: #166534;
}

.ws-cod-message.error {
    background: #fee2e2;
    color: #991b1b;
}

/* الهاتف */
@media (max-width: 640px) {

    .ws-cod {
        padding: 16px;
        margin: 18px 10px;
    }

    .ws-cod-offers,
    .ws-cod-fields {
        grid-template-columns: 1fr;
    }

    .ws-cod-heading h2 {
        font-size: 22px;
    }

    .ws-cod-offer img,
    .ws-cod-offer-placeholder {
        width: 64px;
        height: 64px;
    }

    .ws-cod-summary div {
        font-size: 14px;
    }
}


/* ========================================
   COD - Color Variations
======================================== */

.ws-cod-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 12px 0 20px;
    direction: rtl;
}

.ws-cod-color-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ws-cod-color-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ws-cod-color-circle {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #ddd;
    box-shadow: inset 0 0 0 2px #fff;
    transition: .2s ease;
}

.ws-cod-color-option input:checked + .ws-cod-color-circle {
    outline: 2px solid #222;
    outline-offset: 2px;
    transform: scale(1.05);
}

.ws-cod-color-option input:focus-visible + .ws-cod-color-circle {
    outline: 2px solid #006bc0;
    outline-offset: 4px;
}

.ws-cod-color-option:hover .ws-cod-color-circle {
    transform: scale(1.08);
}

.ws-cod-color-name {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 50%;
    transform: translateX(50%);
    padding: 4px 8px;
    border-radius: 4px;
    background: #222;
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 10;
}

.ws-cod-color-option:hover .ws-cod-color-name {
    opacity: 1;
    visibility: visible;
}


/* حالات الاختيار الواضحة للعروض والخصائص */
.ws-cod-offer {
    position: relative;
    cursor: pointer;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.ws-cod-offer.is-selected {
    border-color: var(--eco-primary, #16845b);
    box-shadow: 0 0 0 2px var(--eco-primary, #16845b);
    background: #f5fbf8;
}

.ws-cod-attribute-option.is-selected,
.ws-cod-color-option.is-selected {
    border-color: var(--eco-primary, #16845b);
}

.ws-cod-offer input[type="radio"] {
    flex: 0 0 auto;
}

.ws-cod-offer:focus-within {
    outline: 2px solid var(--eco-primary, #16845b);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .ws-cod {
        padding: 16px 14px;
        margin: 18px auto;
        border-radius: 12px;
    }
    .single-product .ws-cod-submit {
    font-size: 15px;
}

   

}

/* Product page COD form — cohesive storefront styling */
.single-product .ws-cod {
    --ws-cod-ink: #17221c;
    max-width: 100%;
    margin: 26px 0 0;
    padding: clamp(16px, 2.5vw, 28px);
    border: 1px solid #e2e9e1;
    border-top: 4px solid var(--eco-primary, #246b45);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 30px rgb(25 43 32 / 5%);
    color: var(--ws-cod-ink);
}
.single-product .ws-cod-heading h2 { margin: 0 0 7px; color: #17221c; font-size: clamp(22px, 2.4vw, 28px); font-weight: 900; line-height: 1.4; }
.single-product .ws-cod-heading p { color: #6b776e; font-size: 14px; line-height: 1.8; }
.single-product .ws-cod-section { margin: 24px 0; }
.single-product .ws-cod-section h3 { margin-bottom: 13px; color: #202d24; font-size: 17px; font-weight: 800; }
.single-product .ws-cod-offer {
    position: relative;
    gap: 13px;
    margin: 0 0 11px;
    padding: 13px;
    border: 1px solid #e0e8df;
    border-radius: 14px;
    background: #fff;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.single-product .ws-cod-offer:hover { border-color: #a8c8ad; }
.single-product .ws-cod-offer:has(input[type="radio"]:checked) {
    border: 2px solid #202820;
    padding: 12px;
    background: #f8fbf7;
    box-shadow: 0 0 0 3px rgb(32 40 32 / 5%);
}
