/* ============================================================
   Modal COD Form — Premium Checkout Layout
   -----------------------------------------------------------------
   Scoped under #codFormModal so it never affects the rest of the
   site. Colors, typography and button styling are inherited from
   the existing plugin CSS variables (--cod-btn-*, --highlight-color)
   so the store's branding is preserved.
   ============================================================ */

/* === Popup container === */
#codFormModal .cod-modal-content {
    max-width: 560px;
    padding: 24px;
    border: none;
    border-radius: 20px;
    background-color: #f7f8fa;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.16), 0 8px 16px rgba(0, 0, 0, 0.08);
}

#codFormModal .cod-checkout {
    display: block;
    direction: rtl;
    text-align: right;
    font-size: 15px;
    line-height: 1.5;
}

/* === Banners === */
#codFormModal .cod-banner {
    display: block;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* === Header === */
#codFormModal .cod-checkout-header {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 20px;
    color: inherit;
    line-height: 1.3;
}

/* === Close button === */
#codFormModal .cod-modal-close {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: #fff;
    color: #333;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 10;
    transition: transform 0.15s ease, color 0.15s ease;
}

#codFormModal .cod-modal-close:hover,
#codFormModal .cod-modal-close:focus {
    color: #000;
    transform: rotate(90deg);
}

/* === Offer cards === */
#codFormModal .cod-offers-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 12px;
    text-align: right;
}

#codFormModal .cod-offers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

#codFormModal .cod-offer-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
    background-color: #fff;
    border: 2px solid #e8eaed;
    border-radius: 16px;
    padding: 16px 8px 16px;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#codFormModal .cod-offer-card:hover {
    border-color: var(--highlight-color, #1d6740);
    transform: translateY(-2px);
}

#codFormModal .cod-offer-card.is-selected {
    border-color: var(--highlight-color, #1d6740);
    border-width: 2.5px;
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

#codFormModal .cod-offer-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

#codFormModal .cod-offer-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #c9cdd3;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 8px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

#codFormModal .cod-offer-card.is-selected .cod-offer-radio {
    border-color: var(--highlight-color, #1d6740);
    background-color: var(--highlight-color, #1d6740);
    box-shadow: inset 0 0 0 3px #fff;
}

#codFormModal .cod-offer-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 92%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background-color: var(--highlight-color, #1d6740);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#codFormModal .cod-offer-image {
    width: 100%;
    max-width: 110px;
    aspect-ratio: 1 / 1;
    margin: 6px auto 10px;
    overflow: hidden;
    border-radius: 12px;
    background-color: #f2f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

#codFormModal .cod-offer-image img {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    border-radius: 12px;
}

#codFormModal .cod-offer-qty {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
}

#codFormModal .cod-offer-price {
    font-size: 18px;
    font-weight: 800;
    color: inherit;
    line-height: 1.25;
}

#codFormModal .cod-offer-original {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
}

/* === Section cards === */
#codFormModal .cod-section-card {
    background-color: #fff;
    border: 1px solid #eef0f2;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* === Product options === */
#codFormModal .cod-product-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

#codFormModal .cod-product-line + .cod-product-line {
    border-top: 1px dashed #eef0f2;
}

#codFormModal .cod-product-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 10px;
    background-color: #f2f3f5;
}

#codFormModal .cod-product-thumb img {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    border-radius: 10px;
}

#codFormModal .cod-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#codFormModal .cod-product-info strong {
    font-size: 14px;
    font-weight: 600;
}

#codFormModal .cod-variations,
#codFormModal .cod-line-qty {
    font-size: 12px;
    color: #6b7280;
}

#codFormModal .cod-product-total {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

#codFormModal .cod-product-line .remove-product {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: #fef2f2;
    color: #dc2626;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

#codFormModal .cod-product-line .remove-product:hover {
    background-color: #dc2626;
    color: #fff;
}

/* === Order summary === */
#codFormModal .cod-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 15px;
}

#codFormModal .cod-summary-row .amount {
    font-weight: 600;
}

#codFormModal .cod-summary-total .amount {
    font-weight: 800;
}

#codFormModal .cod-summary-total {
    border-top: 1px solid #eef0f2;
    margin-top: 4px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 800;
}

#codFormModal #shipping-methods {
    margin-bottom: 14px;
}

/* === Customer information === */
#codFormModal .cod-customer-card .form-group {
    position: relative;
    margin-bottom: 14px;
}

#codFormModal .cod-customer-card .form-group label {
    display: block !important;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    line-height: 1.4;
}

#codFormModal .cod-customer-card .form-control,
#codFormModal .cod-customer-card input,
#codFormModal .cod-customer-card select,
#codFormModal .cod-customer-card textarea {
    width: 100% !important;
    height: 52px !important;
    margin: 0 !important;
    padding: 0 42px 0 14px !important;
    border: 1px solid #e2e5e9 !important;
    border-radius: 12px !important;
    background-color: #fff !important;
    background-image: none !important;
    color: inherit !important;
    font-size: 15px !important;
    font-weight: 400;
    text-align: right !important;
    box-sizing: border-box !important;
    outline: none;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#codFormModal .cod-customer-card .form-control:focus,
#codFormModal .cod-customer-card input:focus,
#codFormModal .cod-customer-card select:focus,
#codFormModal .cod-customer-card textarea:focus {
    border-color: var(--highlight-color, #1d6740) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

#codFormModal .cod-customer-card textarea.form-control,
#codFormModal .cod-customer-card textarea {
    height: auto !important;
    min-height: 88px;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    resize: vertical;
}

#codFormModal .cod-customer-card select.form-control {
    appearance: auto;
    -webkit-appearance: auto;
}

/* Emoji icons inside inputs (existing plugin behavior, right side in RTL) */
#codFormModal .cod-customer-card .form-group::after {
    position: absolute !important;
    right: 16px !important;
    left: auto !important;
    top: calc(50% + 10px) !important;
    transform: translateY(-50%);
    font-size: 17px;
    line-height: 1;
    pointer-events: none;
}

#codFormModal .cod-customer-card .form-group:has(#first_name)::after { content: "👤" !important; }
#codFormModal .cod-customer-card .form-group:has(#phone)::after { content: "📞" !important; }
#codFormModal .cod-customer-card .form-group:has(#address)::after,
#codFormModal .cod-customer-card .form-group:has(#city)::after { content: "📍" !important; }

/* Terms checkbox */
#codFormModal .cod-customer-card .cod_terms {
    margin-top: 6px;
}

#codFormModal .cod-customer-card .cod_terms label {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    font-size: 13px;
    font-weight: 400;
}

#codFormModal .cod-customer-card .cod_terms input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    padding: 0 !important;
    margin: 0 !important;
    accent-color: var(--highlight-color, #1d6740);
}

/* === Sticky footer / confirm button === */
#codFormModal .cod-sticky-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: 4px;
    padding: 12px;
    border-radius: 16px;
    background-color: #fff;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
}

#codFormModal .cod-confirm-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100% !important;
    height: 56px !important;
    padding: 0 20px !important;
    border: none !important;
    border-radius: 14px !important;
    background-color: var(--cod-btn-bg, #000) !important;
    color: var(--cod-btn-color, #fff) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.1s ease, filter 0.15s ease;
}

#codFormModal .cod-confirm-button:hover {
    filter: brightness(1.08);
}

#codFormModal .cod-confirm-button:active {
    transform: scale(0.99);
}

#codFormModal .cod-confirm-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

#codFormModal .cod-confirm-text {
    white-space: nowrap;
}

#codFormModal .cod-confirm-sep {
    opacity: 0.7;
}

#codFormModal .cod-confirm-price {
    font-weight: 800;
}

/* === Responsive === */
@media (max-width: 480px) {
    #codFormModal .cod-modal-content {
        padding: 18px;
        border-radius: 16px;
    }

    #codFormModal .cod-checkout-header {
        font-size: 20px;
        margin-bottom: 16px;
    }

    #codFormModal .cod-offers-grid {
        gap: 8px;
    }

    #codFormModal .cod-offer-card {
        padding: 14px 6px 14px;
        border-radius: 14px;
    }

    #codFormModal .cod-offer-image {
        max-width: 84px;
    }

    #codFormModal .cod-offer-price {
        font-size: 16px;
    }

    #codFormModal .cod-section-card {
        padding: 14px;
    }
}

@media (max-width: 360px) {
    #codFormModal .cod-offer-price {
        font-size: 15px;
    }

    #codFormModal .cod-offer-qty {
        font-size: 12px;
    }

    #codFormModal .cod-modal-close {
        top: 12px;
        inset-inline-end: 12px;
    }
}
