:root {
    --bco-gold: #ab8646;
    --bco-gold-dark: #8e6b36;
    --bco-success: #16a34a;
    --bco-error: #ef4444;
}

/* ─── Hide WooCommerce & Theme Default Elements when BCO is Active ─── */
.bco-standalone~.single_add_to_cart_button,
.bco-standalone~.wc-buy-now-button,
.bco-standalone~.quantity,
.bco-standalone~.product_meta,
.bco-standalone~.native-buy-now,
.bco-standalone~#floating-atc-bar,
.single-product .product:has(.bco-standalone) .single_add_to_cart_button,
.single-product .product:has(.bco-standalone) .wc-buy-now-button,
.single-product .product:has(.bco-standalone) .quantity,
.single-product .product:has(.bco-standalone) .native-buy-now,
.single-product .product:has(.bco-standalone) .floating-buy-now,
.single-product .product:has(.bco-standalone) #floating-atc-bar,
.single-product .product:has(.bco-standalone) .floating-mobile-bar,
.single-product .product:has(.bco-standalone) .buy-now-container,
.single-product .product:has(.bco-standalone) form.cart {
    display: none !important;
}

/* ─── Offers Section ─── */
.cod-offers-section {
    margin: 1.5rem 0 0;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

.cod-offers-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.cod-offers-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--bco-gold) 0%, var(--bco-gold-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 18px -6px rgba(171, 134, 70, 0.55);
}

.cod-offers-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: #1d1d1d;
    margin: 0 0 2px;
}

.cod-offers-subtitle {
    font-size: 0.75rem;
    color: #888;
    margin: 0;
}

/* ─── Premium Urgency Elements ─── */
.cod-urgency-banner {
    background: #fef2f2;
    border: 1px dashed #ef4444;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cod-urgency-text {
    color: #991b1b;
    font-size: 0.85rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cod-stock-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cod-stock-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #7f1d1d;
}

.cod-stock-bar-bg {
    height: 8px;
    background: #fee2e2;
    border-radius: 99px;
    overflow: hidden;
}

.cod-stock-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
    border-radius: 99px;
    width: 35%;
    /* Fixed for demo or JS dynamic */
    animation: bcoPulse 2s infinite;
}

.cod-countdown-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #111827;
    color: #fff;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
}

.cod-countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cod-countdown-num {
    font-size: 15px;
    font-weight: 900;
    color: #fbbf24;
}

@keyframes bcoPulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* ─── Offer Cards ─── */
.cod-offers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cod-offer-card {
    display: block;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.22s ease;
    background: #fff;
    position: relative;
    overflow: visible;
}

.cod-offer-card:hover {
    border-color: var(--bco-gold);
    box-shadow: 0 6px 24px -6px rgba(171, 134, 70, 0.18);
}

.cod-offer-card.is-selected {
    border-color: var(--bco-gold);
    background: #fcf8f2;
    box-shadow: 0 8px 28px -8px rgba(171, 134, 70, 0.3);
}

.cod-offer-inner {
    padding: 14px 16px 12px;
}

.cod-offer-badge {
    position: absolute;
    top: -11px;
    right: 14px;
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    box-shadow: 0 3px 10px -3px rgba(220, 38, 38, 0.4);
    white-space: nowrap;
}

.cod-offer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cod-offer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.cod-offer-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    color: transparent;
}

.cod-offer-card.is-selected .cod-offer-check {
    background: var(--bco-gold);
    border-color: var(--bco-gold);
    color: #fff;
}

.cod-offer-label-wrap {
    display: flex;
    flex-direction: column;
}

.cod-offer-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1d1d1d;
}

.cod-offer-note {
    font-size: 0.7rem;
    color: #059669;
    font-weight: 600;
    margin-top: 1px;
}

.cod-offer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cod-offer-price {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--bco-gold);
    white-space: nowrap;
}

.cod-offer-old-price {
    font-size: 0.78rem;
    color: #9ca3af;
    text-decoration: line-through;
    white-space: nowrap;
}

.cod-offer-save-badge {
    background: #dcfce7;
    color: #166534;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 99px;
    margin-top: 2px;
}

/* ─── Checkout Section ─── */
.cod-checkout-section {
    margin-top: 1.25rem;
    direction: rtl;
}

.cod-checkout-card {
    border: 2px dashed #d1d5db;
    border-radius: 20px;
    padding: 20px;
    background: #fafafa;
}

.cod-checkout-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
}

.cod-checkout-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ab8646 0%, #8e6b36 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.cod-checkout-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1d1d1d;
    margin: 0;
}

/* ─── Form Grid ─── */
.cod-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.cod-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cod-span-2 {
    grid-column: span 2;
}

.cod-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.cod-input-icon {
    position: absolute;
    right: 14px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
    flex-shrink: 0;
}

.cod-input {
    width: 100%;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 11px 42px 11px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #1d1d1d;
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: rtl;
    outline: none;
}

.cod-input:focus {
    border-color: var(--bco-gold);
    box-shadow: 0 0 0 3px rgba(171, 134, 70, 0.15);
}

.cod-select {
    appearance: none;
    cursor: pointer;
    padding-left: 32px;
}

.cod-textarea {
    resize: vertical;
    padding-top: 11px;
    min-height: 72px;
}

/* ─── Dynamic Order Summary ─── */
.cod-order-summary {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.cod-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #92400e;
    font-weight: 600;
}

.cod-summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #fcd34d;
    font-size: 16px;
    font-weight: 900;
    color: #c2410c;
}

#bco-summary-total {
    font-size: 20px;
}

/* ─── Submit Button ─── */
.cod-submit-btn {
    width: 100%;
    height: 54px;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 28px -8px rgba(22, 163, 74, 0.5);
    position: relative;
    overflow: hidden;
}

.cod-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-2px);
    box-shadow: 0 16px 35px -10px rgba(22, 163, 74, 0.55);
}

.cod-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.cod-msg {
    margin-top: 15px;
    font-weight: 700;
    text-align: center;
}

.cod-msg .success {
    color: var(--bco-success);
}

.cod-msg .error {
    color: var(--bco-error);
}

@media (max-width: 480px) {
    .cod-form-grid {
        grid-template-columns: 1fr;
    }

    .cod-span-2 {
        grid-column: span 1;
    }
}