/**
 * COD Popup Checkout Pro - Popup CSS
 * Premium design inspired by Shopify one-page checkout
 */
#cod-pcp-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: var(--cod-pcp-overlay, rgba(0,0,0,0.6));
    backdrop-filter: blur(var(--cod-pcp-overlay-blur, 5px));
    -webkit-backdrop-filter: blur(var(--cod-pcp-overlay-blur, 5px));
    animation: codPcpFadeIn 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

@keyframes codPcpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes codPcpSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes codPcpSlideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cod-pcp-popup {
    position: relative;
    max-width: var(--cod-pcp-width, 600px);
    width: 100%;
    margin: 40px auto;
    background: var(--cod-pcp-popup-bg, #fff);
    border-radius: var(--cod-pcp-radius, 20px);
    box-shadow: var(--cod-pcp-shadow, 0 20px 60px rgba(0,0,0,0.3));
    animation: codPcpSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--cod-pcp-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    direction: rtl;
}

/* Close Button */
.cod-pcp-popup-close {
    position: absolute;
    top: 16px;
    right: 0px;
    z-index: 10;
    width: auto;
    height: auto;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #ea4335;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 1, 1);
}

.cod-pcp-popup-close:hover {
    background: transparent;
    color: #c62828;
    transform: rotate(90deg);
}

/* Header */
.cod-pcp-popup-header {
    padding: 30px 30px 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.cod-pcp-popup-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
    line-height: 1.3;
}

.cod-pcp-popup-subtitle {
    font-size: 14px;
    color: #888;
    margin: 0;
}

/* Body */
.cod-pcp-popup-body {
    padding: 20px 30px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.cod-pcp-popup-body::-webkit-scrollbar {
    width: 4px;
}

.cod-pcp-popup-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* Sections */
.cod-pcp-section {
    margin-bottom: 24px;
}

.cod-pcp-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Product Preview */
.cod-pcp-product-preview {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.cod-pcp-product-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

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

.cod-pcp-product-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 4px;
}

.cod-pcp-product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--cod-pcp-primary, #1a73e8);
    margin: 0;
}

.cod-pcp-stock {
    font-size: 12px;
    margin-top: 4px;
}

.cod-pcp-stock.in-stock {
    color: #34a853;
}

.cod-pcp-stock.out-of-stock {
    color: #ea4335;
}

/* Variations */
.cod-pcp-variations {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #f0f0f0;
}

.cod-pcp-variation-group {
    margin-bottom: 12px;
}

.cod-pcp-variation-group:last-child {
    margin-bottom: 0;
}

.cod-pcp-variation-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.cod-pcp-variation-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

.cod-pcp-variation-select:focus {
    border-color: var(--cod-pcp-primary, #1a73e8);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* Offers Grid */
.cod-pcp-offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.cod-pcp-offer-card {
    position: relative;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: #fff;
}

.cod-pcp-offer-card:hover {
    border-color: var(--cod-pcp-primary, #1a73e8);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.1);
}

.cod-pcp-offer-card.selected {
    border-color: var(--cod-pcp-primary, #1a73e8);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.05), rgba(26, 115, 232, 0.02));
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.15);
}

.cod-pcp-offer-badge {
    position: absolute;
    top: -8px;
    right: 50%;
    transform: translateX(50%);
    background: linear-gradient(135deg, #ff6b35, #e8451a);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.cod-pcp-offer-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 8px 0 4px;
}

.cod-pcp-offer-qty {
    font-size: 12px;
    color: #888;
    margin: 0 0 8px;
}

.cod-pcp-offer-price {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.cod-pcp-offer-save {
    font-size: 12px;
    color: var(--cod-pcp-secondary, #34a853);
    font-weight: 600;
    margin-top: 4px;
}

/* Summary */
.cod-pcp-summary-table {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #f0f0f0;
}

.cod-pcp-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #666;
}

.cod-pcp-summary-row + .cod-pcp-summary-row {
    border-top: 1px solid #f0f0f0;
}

.cod-pcp-summary-total {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid #e0e0e0 !important;
}

.cod-pcp-summary-value {
    font-weight: 600;
}

.cod-pcp-total-value {
    color: var(--cod-pcp-primary, #1a73e8);
    font-size: 20px;
}

.cod-pcp-discount-value {
    color: var(--cod-pcp-secondary, #34a853);
}

/* Coupon */
.cod-pcp-coupon-section {
    padding: 12px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.cod-pcp-coupon-input-wrap {
    display: flex;
    gap: 8px;
}

.cod-pcp-coupon-input-wrap .cod-pcp-input {
    flex: 1;
}

.cod-pcp-btn-sm {
    padding: 10px 20px;
    background: var(--cod-pcp-primary, #1a73e8);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cod-pcp-btn-sm:hover {
    background: #1557b0;
}

.cod-pcp-message {
    margin-top: 8px;
    font-size: 13px;
}

.cod-pcp-message.success {
    color: #34a853;
}

.cod-pcp-message.error {
    color: #ea4335;
}

/* Checkout Fields */
.cod-pcp-checkout-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cod-pcp-field {
    margin-bottom: 14px;
}

.cod-pcp-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.cod-pcp-required {
    color: #ea4335;
}

.cod-pcp-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.cod-pcp-input:focus {
    border-color: var(--cod-pcp-primary, #1a73e8);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.cod-pcp-input.error {
    border-color: #ea4335;
}

.cod-pcp-textarea {
    resize: vertical;
    min-height: 60px;
}

.cod-pcp-select {
    appearance: none;
    -webkit-appearance: none;
}

.cod-pcp-width-100 { width: 100%; }
.cod-pcp-width-50 { width: calc(50% - 6px); }
.cod-pcp-width-33 { width: calc(33.33% - 8px); }

@media (max-width: 480px) {
    .cod-pcp-width-50,
    .cod-pcp-width-33 {
        width: 100%;
    }
}

/* Footer */
.cod-pcp-popup-footer {
    padding: 16px 30px 24px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    position: sticky;
    bottom: 0;
}

.cod-pcp-btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--cod-pcp-primary, #1a73e8), #1557b0);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
    position: relative;
    overflow: hidden;
    min-height: 56px;
    font-family: inherit;
}

.cod-pcp-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
}

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

.cod-pcp-btn-submit-text {
    flex: 1;
}

.cod-pcp-btn-submit-total {
    background: rgba(255,255,255,0.2);
    padding: 4px 14px;
    border-radius: 8px;
    font-size: 16px;
}

.cod-pcp-btn-submit-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cod-pcp-spinner {
    animation: codPcpSpin 1s linear infinite;
}

@keyframes codPcpSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Thank You */
.cod-pcp-thankyou {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    text-align: center;
    background: #fff;
    border-radius: var(--cod-pcp-radius, 20px);
    animation: codPcpSlideUp 0.5s ease;
    overflow-y: auto;
}

.cod-pcp-thankyou-icon {
    margin-bottom: 20px;
    animation: codPcpScaleIn 0.5s ease 0.2s both;
}

@keyframes codPcpScaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.cod-pcp-thankyou-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--cod-pcp-primary, #1a73e8);
    margin: 0 0 12px;
}

.cod-pcp-thankyou-msg {
    font-size: 15px;
    color: #666;
    line-height: 1.8;
    margin: 0 0 24px;
    max-width: 420px;
}

.cod-pcp-thankyou-summary {
    background: #fafafa;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 28px;
    width: 100%;
    max-width: 460px;
    text-align: right;
    border: 1px solid #f0f0f0;
}

.cod-pcp-thankyou-summary-title {
    font-weight: 700;
    color: var(--cod-pcp-primary, #1a73e8);
    text-align: center;
    margin: 0 0 12px;
    font-size: 15px;
}

.cod-pcp-order-details {
    font-size: 13px;
    color: #555;
    line-height: 2.2;
}

.cod-pcp-order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.cod-pcp-order-row span:last-child {
    text-align: left;
}

.cod-pcp-order-total {
    border-top: 2px solid #e0e0e0;
    border-bottom: none;
    padding-top: 10px;
    margin-top: 4px;
    font-size: 15px;
    color: var(--cod-pcp-primary, #1a73e8);
}

.cod-pcp-thankyou-delivery {
    font-weight: 700;
    color: var(--cod-pcp-primary, #1a73e8);
    text-align: center;
    margin: 14px 0 0;
    font-size: 13px;
}

.cod-pcp-thankyou-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 400px;
}

.cod-pcp-btn-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--cod-pcp-primary, #1a73e8), #1557b0);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 160px;
}

.cod-pcp-btn-continue:hover {
    background: linear-gradient(135deg, #1557b0, #0d47a1);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
}

.cod-pcp-btn-home {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 160px;
}

.cod-pcp-btn-home:hover {
    background: #e8e8e8;
    color: #333;
    transform: translateY(-2px);
}

/* Exit Popup */
.cod-pcp-exit-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cod-pcp-exit-content {
    position: relative;
    max-width: 500px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px;
    animation: codPcpSlideUp 0.4s ease;
    text-align: center;
    direction: rtl;
}

.cod-pcp-exit-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cod-pcp-exit-close:hover {
    background: #e8e8e8;
}

.cod-pcp-exit-header {
    margin-bottom: 20px;
}

.cod-pcp-exit-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 12px 0 8px;
}

.cod-pcp-exit-header p {
    font-size: 14px;
    color: #888;
    margin: 0;
}

/* Exit Popup */
.cod-pcp-exit-icon {
    margin-bottom: 12px;
}

.cod-pcp-exit-image {
    max-width: 200px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.cod-pcp-exit-offer {
    margin-bottom: 16px;
}

.cod-pcp-exit-discount {
    display: inline-block;
    font-size: 36px;
    font-weight: 800;
    color: var(--cod-pcp-accent, #ea4335);
    background: linear-gradient(135deg, #fff5f5, #ffe0e0);
    padding: 8px 24px;
    border-radius: 16px;
}

.cod-pcp-btn-exit-claim {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--cod-pcp-accent, #ea4335), #d33426);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.cod-pcp-btn-exit-claim:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(234, 67, 53, 0.3);
}

.cod-pcp-exit-no-thanks {
    background: none;
    border: none;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
}

.cod-pcp-exit-no-thanks:hover {
    color: #333;
}

/* Radio & Checkbox Groups */
.cod-pcp-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cod-pcp-radio-label,
.cod-pcp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.cod-pcp-radio-label input[type="radio"],
.cod-pcp-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--cod-pcp-primary, #1a73e8);
}

/* Responsive */
@media (max-width: 768px) {
    #cod-pcp-popup-overlay {
        padding: 0;
    }

    .cod-pcp-popup {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
    }

    .cod-pcp-popup-header {
        padding: 20px 20px 16px;
    }

    .cod-pcp-popup-body {
        padding: 16px 20px;
        max-height: none;
    }

    .cod-pcp-popup-footer {
        padding: 16px 20px 20px;
    }

    .cod-pcp-offers-grid {
        grid-auto-flow: column;
        grid-template-columns: unset;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }

    .cod-pcp-offer-card {
        min-width: 140px;
        scroll-snap-align: start;
    }

    .cod-pcp-product-preview {
        flex-direction: row;
        align-items: flex-start;
        text-align: right;
    }
}
