/* =============================================
   COD Popup Checkout — cod-popup.css
   ============================================= */

/* Overlay */
.cod-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

/* Modal */
.cod-modal {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 92vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: cod-slide-in 0.25s ease;
}

@keyframes cod-slide-in {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.cod-modal__head {
    background: #3B9165;
    color: #ffffff;
    padding: 14px 16px;
    text-align: center;
    position: relative;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.cod-modal__title {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.55;
    color: #ffffff;
    margin: 0;
}

.cod-modal__close {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.cod-modal__close:hover {
    opacity: 1;
}

/* Body */
.cod-modal__body {
    padding: 16px;
    flex: 1;
}

/* Notice */
.cod-notice {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}

.cod-notice--error {
    background: #fff0f0;
    color: #c0392b;
    border: 1px solid #f5c6c6;
}

.cod-notice--success {
    background: #f0fff4;
    color: #1e6e35;
    border: 1px solid #b2dfce;
}

/* Field */
.cod-field {
    margin-bottom: 12px;
}

.cod-field__label {
    font-size: 13px;
    color: #555;
    display: block;
    margin-bottom: 4px;
}

.cod-required {
    color: #e74c3c;
}

.cod-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.15s;
}

.cod-input-wrap:focus-within {
    border-color: #3B9165;
    box-shadow: 0 0 0 2px rgba(45, 106, 45, 0.15);
}

.cod-input-icon {
    padding: 0 10px;
    color: #888;
    font-size: 15px;
    border-right: 1px solid #eee;
    line-height: 1;
    display: flex;
    align-items: center;
    align-self: stretch;
}

.cod-input {
    border: none !important;
    outline: none !important;
    padding: 9px 10px !important;
    font-size: 14px !important;
    background: transparent !important;
    color: #333 !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Section title */
.cod-section-title {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin: 14px 0 8px;
}

/* Shipping methods */
.cod-shipping-methods {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cod-shipping-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.cod-shipping-option:hover {
    border-color: #3B9165;
}

.cod-shipping-option.cod-selected {
    border-color: #3B9165;
    background: #f2f9f2;
}

.cod-shipping-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cod-shipping-label {
    font-size: 14px;
    color: #333;
}

.cod-shipping-price {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Radio dot */
.cod-radio-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.cod-radio-dot--on {
    border-color: #3B9165;
}

.cod-radio-dot--on::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3B9165;
    display: block;
}

/* Divider */
.cod-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 12px 0;
}

/* Product list */
.cod-product-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cod-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.cod-product-img-wrap {
    position: relative;
    flex-shrink: 0;
}

.cod-product-img {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #eee;
}

.cod-product-info {
    flex: 1;
}

.cod-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.cod-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cod-qty-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
    line-height: 1;
}

.cod-qty-btn:hover {
    background: #e8e8e8;
}

.cod-qty-val {
    font-size: 13px;
    min-width: 18px;
    text-align: center;
    color: #333;
}

.cod-product-price {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    flex-shrink: 0;
}

/* Totals */
.cod-totals {
    margin: 8px 0;
}

.cod-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 3px 0;
    color: #666;
}

.cod-discount-row {
    color: #1e6e35;
}

.cod-grand {
    font-size: 15px;
    font-weight: 500;
    color: #222;
    padding-top: 8px;
    border-top: 1px solid #eee;
    margin-top: 4px;
}

/* Payment box */
.cod-payment-box {
    border: 2px solid #3B9165;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 10px 0;
}

.cod-payment-box__top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.cod-payment-title {
    font-size: 14px;
    font-weight: 500;
    color: #222;
}

.cod-payment-desc {
    font-size: 12px;
    color: #777;
    padding-left: 24px;
}

/* Coupon */
.cod-coupon-row {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.cod-coupon-input {
    flex: 1;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    padding: 9px 12px !important;
    font-size: 13px !important;
    outline: none !important;
    background: #fff !important;
    color: #333 !important;
    box-shadow: none !important;
    transition: border-color 0.15s;
}

.cod-coupon-input:focus {
    border-color: #3B9165 !important;
}

.cod-apply-btn {
    background: #3B9165;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.cod-apply-btn:hover {
    background: #24572a;
}

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

/* Order note */
.cod-note-label {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.cod-note-area {
    width: 100%;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    padding: 9px 12px !important;
    font-size: 13px !important;
    resize: vertical;
    outline: none !important;
    background: #fff !important;
    color: #333 !important;
    height: 64px;
    box-shadow: none !important;
    transition: border-color 0.15s;
    font-family: inherit;
}

.cod-note-area:focus {
    border-color: #3B9165 !important;
}

/* Confirm button */
.cod-confirm-btn {
    width: 100%;
    background: #3B9165;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 13px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 14px;
    transition: background 0.15s, transform 0.1s;
    line-height: 1.4;
    animation: cod-archive-vibrate 2s ease-in-out infinite;
}

.cod-confirm-btn:hover {
    background: #000;
}

.cod-confirm-btn:active {
    transform: scale(0.98);
}

.cod-confirm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Hint text */
.cod-hint {
    text-align: center;
    font-size: 11px;
    color: #3B9165;
    margin-top: 8px;
    line-height: 1.5;
}

/* Open button (shortcode) */
.cod-open-btn {
    background: #000000;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 15px 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    animation: cod-archive-vibrate 2s ease-in-out infinite;
}

.cod-open-btn:hover {
    background: #24572a;
}

/* Scrollbar inside modal */
.cod-modal::-webkit-scrollbar {
    width: 4px;
}

.cod-modal::-webkit-scrollbar-track {
    background: transparent;
}

.cod-modal::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

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

    .cod-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    .cod-modal__head {
        border-radius: 16px 16px 0 0;
    }
}


/* ── Loading state ──────────────────────────────────────────── */
.cod-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    color: #555;
    font-size: 14px;
}

.cod-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #3a8a4a;
    border-radius: 50%;
    animation: cod-spin 0.7s linear infinite;
}

@keyframes cod-spin {
    to { transform: rotate(360deg); }
}

/* ── Shared vibrate keyframe ───────────────────────────────────
   Used by .cod-open-btn and .cod-confirm-btn below. .cod-archive-btn
   itself (and its own copy of this keyframe) lives in cod-archive.css,
   which is only enqueued on shop/category/product pages — this file
   is loaded everywhere, so it needs its own copy for the buttons it
   defines. */
@keyframes cod-archive-vibrate {
    0%, 80%, 100% { transform: translateX(0); }
    82%           { transform: translateX(-3px); }
    84%           { transform: translateX(3px); }
    86%           { transform: translateX(-3px); }
    88%           { transform: translateX(3px); }
    90%           { transform: translateX(-2px); }
    92%           { transform: translateX(2px); }
    94%           { transform: translateX(0); }
}
