/* ============================================================
   COD AJAX — Modern Design (Compact)
   ============================================================ */
:root {
    --cod-green:      #16a34a;
    --cod-green-dark: #15803d;
    --cod-bkash:      #E2136E;
    --cod-bkash-dark: #c01060;
    --cod-text:       #111827;
    --cod-muted:      #6b7280;
    --cod-border:     #e5e7eb;
    --cod-bg:         #f9fafb;
    --cod-white:      #ffffff;
    --cod-r:          12px;
    --cod-rs:         7px;
    --cod-shadow:     0 20px 60px rgba(0, 0, 0, 0.18);
    --cod-ease:       0.18s ease;
}

/* ── Overlay ── */
.cod-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow-y: auto;
}

/* ── Modal ── */
.cod-modal {
    background: var(--cod-white);
    border-radius: var(--cod-r);
    box-shadow: var(--cod-shadow);
    width: 100%;
    max-width: 740px;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: codIn 0.26s cubic-bezier(0.34, 1.5, 0.64, 1);
}

@keyframes codIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

/* ── Header ── */
.cod-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    border-bottom: 1px solid var(--cod-border);
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 55%);
    flex-shrink: 0;
}

.cod-modal-header-info {
    display: flex;
    align-items: center;
    gap: 11px;
}

.cod-modal-header-icon {
    width: 38px;
    height: 38px;
    background: var(--cod-green);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.28);
}

.cod-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--cod-text);
    margin: 0;
    line-height: 1.2;
}

.cod-modal-subtitle {
    font-size: 11.5px;
    color: var(--cod-muted);
    margin: 2px 0 0;
}

.cod-modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--cod-bg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: var(--cod-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--cod-ease);
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.cod-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: rotate(90deg);
}

/* ── Body ── */
.cod-modal-body {
    overflow-y: auto;
    flex: 1;
}

/* ── Loader ── */
.cod-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 20px;
    gap: 14px;
}

.cod-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--cod-border);
    border-top-color: var(--cod-green);
    border-radius: 50%;
    animation: codSpin 0.72s linear infinite;
}

@keyframes codSpin {
    to { transform: rotate(360deg); }
}

.cod-loader p {
    color: var(--cod-muted);
    font-size: 13.5px;
    margin: 0;
}

/* ── Two-column grid ── */
.cod-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.cod-panel {
    padding: 16px 20px;
}

.cod-panel-left {
    border-right: 1px solid var(--cod-border);
}

.cod-panel-right {
    background: var(--cod-bg);
}

/* ── Section labels ── */
.cod-section-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--cod-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 7px;
}

.cod-section-label:not(:first-child) {
    margin-top: 14px;
}

/* ── Form fields ── */
.cod-field {
    margin-bottom: 8px;
}

.cod-field input,
.cod-field select,
#cod_state_wrapper input,
#cod_state_wrapper select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--cod-border);
    border-radius: var(--cod-rs);
    font-size: 13px;
    color: var(--cod-text);
    background: var(--cod-white);
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--cod-ease), box-shadow var(--cod-ease);
    font-family: inherit;
}

.cod-field input:focus,
.cod-field select:focus,
#cod_state_wrapper input:focus,
#cod_state_wrapper select:focus {
    border-color: var(--cod-green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.11);
}

.cod-field input::placeholder,
.cod-coupon input::placeholder {
    color: #9ca3af;
}

.cod-field select,
#cod_state_wrapper select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236b7280' d='M5 7L1 2h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 30px;
    cursor: pointer;
}

.cod-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ── Shipping ── */
.cod-shipping-options {
    margin-bottom: 2px;
}

.cod-shipping-select {
    width: 100%;
    padding: 8px 30px 8px 12px;
    border: 1.5px solid var(--cod-border);
    border-radius: var(--cod-rs);
    font-size: 13px;
    color: var(--cod-text);
    background: var(--cod-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236b7280' d='M5 7L1 2h8z'/%3E%3C/svg%3E") no-repeat right 11px center;
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--cod-ease);
    font-family: inherit;
}

.cod-shipping-select:focus {
    border-color: var(--cod-green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.11);
}

.cod-no-shipping {
    font-size: 12.5px;
    color: var(--cod-muted);
    padding: 6px 0;
    margin: 0;
}

/* ── Coupon input state ── */
.cod-coupon {
    display: flex;
    gap: 7px;
}

.cod-coupon input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--cod-border);
    border-radius: var(--cod-rs);
    font-size: 13px;
    color: var(--cod-text);
    background: var(--cod-white);
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--cod-ease), box-shadow var(--cod-ease);
    font-family: inherit;
}

.cod-coupon input:focus {
    border-color: var(--cod-green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.11);
}

.cod-coupon-btn {
    padding: 8px 14px;
    background: var(--cod-text);
    color: #fff;
    border: none;
    border-radius: var(--cod-rs);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--cod-ease);
    font-family: inherit;
}

.cod-coupon-btn:hover:not(:disabled) {
    background: #1f2937;
}

.cod-coupon-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ── Coupon applied state ── */
.cod-coupon-applied {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 11px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: var(--cod-rs);
}

.cod-coupon-tag {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.cod-coupon-tag-icon {
    width: 17px;
    height: 17px;
    background: var(--cod-green);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.cod-applied-code {
    font-size: 12.5px;
    font-weight: 700;
    color: #15803d;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cod-coupon-saved {
    font-size: 11.5px;
    color: #15803d;
    white-space: nowrap;
    flex-shrink: 0;
}

.cod-coupon-remove {
    padding: 4px 9px;
    background: none;
    border: 1.5px solid #fca5a5;
    border-radius: 5px;
    color: #dc2626;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cod-ease);
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
}

.cod-coupon-remove:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.cod-coupon-remove:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Coupon message ── */
.cod-coupon-msg {
    margin-top: 6px;
    font-size: 12.5px;
    border-radius: 6px;
    padding: 6px 10px;
    display: none;
}

.cod-coupon-msg.success {
    display: block;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.cod-coupon-msg.error {
    display: block;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ── Product items ── */
.cod-products {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.cod-product-item {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--cod-white);
    border: 1px solid var(--cod-border);
    border-radius: var(--cod-rs);
    padding: 8px;
}

.cod-product-img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    background: #e5e7eb;
}

.cod-product-info {
    flex: 1;
    min-width: 0;
}

.cod-product-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cod-text);
    margin: 0 0 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cod-product-price {
    font-size: 12.5px;
    color: var(--cod-green);
    font-weight: 700;
}

/* ── Qty controls ── */
.cod-qty {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--cod-border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--cod-white);
    flex-shrink: 0;
    width: 70px;
}
.cod-qty input.cod-qty-input {
    padding-left: 5px;
    padding-right: 5px;
}
.cod-qty-btn {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--cod-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--cod-ease);
    padding: 0;
    line-height: 1;
}

.cod-qty-btn:hover {
    background: var(--cod-bg);
}

.cod-qty-input {
    width: 28px;
    border: none;
    background: none;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cod-text);
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
    font-family: inherit;
}

.cod-qty-input::-webkit-outer-spin-button,
.cod-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Delete button ── */
.cod-delete-btn {
    width: 23px;
    height: 23px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--cod-ease);
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.cod-delete-btn:hover {
    background: #dc2626;
    color: #fff;
}

/* ── Price summary ── */
.cod-summary {
    background: var(--cod-white);
    border: 1px solid var(--cod-border);
    border-radius: var(--cod-rs);
    overflow: hidden;
    margin-bottom: 10px;
}

.cod-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--cod-border);
}

.cod-summary-row:last-child {
    border-bottom: none;
}

.cod-summary-row .label {
    color: var(--cod-muted);
}

.cod-summary-row .value {
    font-weight: 600;
    color: var(--cod-text);
}

.cod-summary-row.discount-row .label,
.cod-summary-row.discount-row .value {
    color: var(--cod-green);
}

.cod-summary-row.total-row {
    background: var(--cod-bg);
}

.cod-summary-row.total-row .label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--cod-text);
}

.cod-summary-row.total-row .value {
    font-size: 16px;
    font-weight: 800;
    color: var(--cod-text);
}

/* ── Action buttons ── */
.cod-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cod-btn {
    width: 100%;
    padding: 11px 14px;
    border: none;
    border-radius: var(--cod-rs);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--cod-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.cod-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.cod-btn-primary {
    background: var(--cod-green);
    color: #fff;
}

.cod-btn-primary:hover:not(:disabled) {
    background: var(--cod-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.32);
}

.cod-btn-bkash {
    background: var(--cod-bkash);
    color: #fff;
}

.cod-btn-bkash:hover:not(:disabled) {
    background: var(--cod-bkash-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(226, 19, 110, 0.32);
}

/* ── Trust badge ── */
.cod-trust {
    text-align: center;
    font-size: 11.5px;
    color: var(--cod-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--cod-border);
}

/* ── Order Success State ── */
.cod-order-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 44px 28px 36px;
    text-align: center;
    gap: 10px;
}

.cod-success-check {
    width: 62px;
    height: 62px;
    background: var(--cod-green);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
    margin-bottom: 4px;
    animation: codSuccessBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes codSuccessBounce {
    from { transform: scale(0) rotate(-20deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.cod-success-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--cod-text);
    margin: 0;
}

.cod-success-msg {
    font-size: 13.5px;
    color: var(--cod-muted);
    margin: 0;
    max-width: 320px;
    line-height: 1.6;
}

.cod-success-order-num {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--cod-green);
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    padding: 5px 16px;
    letter-spacing: 0.02em;
}

.cod-close-success {
    margin-top: 8px;
    max-width: 200px;
}

/* ── Payment Methods ── */
.cod-payment-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.cod-payment-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 1.5px solid var(--cod-border);
    border-radius: var(--cod-rs);
    cursor: pointer;
    transition: border-color var(--cod-ease), background var(--cod-ease);
    background: var(--cod-white);
    user-select: none;
}

.cod-payment-option:hover {
    border-color: #86efac;
    background: #f7fdf8;
}

.cod-payment-option.is-selected {
    border-color: var(--cod-green);
    background: #f0fdf4;
}

.cod-payment-radio {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: var(--cod-green);
    cursor: pointer;
    margin: 0;
}

.cod-payment-option-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.cod-payment-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
}

.cod-payment-icon img {
    max-height: 20px;
    max-width: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

.cod-payment-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.cod-payment-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--cod-text);
    line-height: 1.2;
}

.cod-payment-desc {
    font-size: 11px;
    color: var(--cod-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cod-payment-desc p {
    margin: 0;
    font-size: inherit;
    color: inherit;
}

.cod-payment-empty {
    font-size: 12.5px;
    color: var(--cod-muted);
    padding: 6px 0;
    margin: 0;
}

/* ── Quick Order button (product page) ── */
#quick_order_btn {
    background: #ff9900 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    transition: all 0.2s !important;
}

#quick_order_btn:hover:not(:disabled) {
    background: #e68a00 !important;
    transform: translateY(-1px) !important;
}

/* ── Responsive ── */
@media (max-width: 620px) {
    .cod-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .cod-modal {
        max-height: 96dvh;
        border-radius: 0;
        border-top-left-radius: var(--cod-r);
        border-top-right-radius: var(--cod-r);
        animation: codUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
    }

    @keyframes codUp {
        from { opacity: 0; transform: translateY(36px); }
        to   { opacity: 1; transform: none; }
    }

    .cod-grid {
        grid-template-columns: 1fr;
    }

    .cod-panel-left {
        border-right: none;
        border-bottom: 1px solid var(--cod-border);
    }

    .cod-modal-header {
        padding: 12px 16px;
    }

    .cod-panel {
        padding: 14px 16px;
    }

    .cod-field-row {
        grid-template-columns: 1fr 1fr;
    }
}
