/**
 * OPPD Referral Functionality - Styles
 */

/* OPPD Checkout Blurb */
.oppd-checkout-blurb {
    background: #d4edda;
    border: 2px solid #28a745;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

.oppd-checkout-blurb strong {
    color: #155724;
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
}

/* OPPD Price Comparison */
.oppd-price-comparison {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.oppd-price-comparison .original-price.crossed-out {
    text-decoration: line-through;
    color: #999;
    font-size: 18px;
}

.oppd-price-comparison .oppd-price {
    color: #28a745;
    font-size: 28px;
    font-weight: bold;
}

.oppd-price-label {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 5px;
}

/* OPPD Address Verification Section */
.oppd-address-verification-section {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
    display: block !important;
    visibility: visible !important;
}

.oppd-verification-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
}

.oppd-verification-notice strong {
    display: block;
    color: #856404;
    margin-bottom: 8px;
    font-size: 16px;
}

.oppd-verification-notice p {
    margin: 0;
    color: #856404;
}

.oppd-address-verification-section .form-row {
    margin-bottom: 15px;
}

/* OPPD Verify Button */
.oppd-verify-button-wrapper {
    margin: 15px 0;
    text-align: center;
}

.oppd-verify-address-btn {
    background: #28a745 !important;
    color: white !important;
    border: none !important;
    padding: 12px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 5px !important;
    cursor: pointer;
    transition: background 0.3s ease;
}

.oppd-verify-address-btn:hover {
    background: #218838 !important;
}

.oppd-verify-address-btn:disabled {
    background: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.oppd-discount-text {
    display: block;
    margin-top: 10px;
    color: #6c757d;
    font-size: 14px;
    font-style: italic;
}

/* OPPD Verification Status Messages */
.oppd-verified-message {
    background: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.oppd-verified-message .oppd-checkmark {
    color: #28a745;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.oppd-verification-error {
    padding: 12px 15px;
    border-radius: 5px;
    margin: 15px 0;
    text-align: center;
    font-weight: 500;
}

.oppd-verification-error.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.oppd-verification-error.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* OPPD Address Info Display */
.oppd-address-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.oppd-address-info h3 {
    color: #28a745;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.oppd-address-info p {
    margin: 5px 0;
    line-height: 1.6;
}

/* Hide Stripe Express Payment Buttons Until Address Verified */
body.oppd-referral:not(.oppd-verified) #wc-stripe-express-checkout-element,
body.oppd-referral:not(.oppd-verified) .wc-stripe-express-checkout-element,
body.oppd-referral:not(.oppd-verified) #wc-stripe-express-checkout-button-separator,
body.oppd-referral:not(.oppd-verified) .stripe-payment-request-button,
body.oppd-referral:not(.oppd-verified) .payment-request-button,
body.oppd-referral:not(.oppd-verified) .stripe-link-button,
body.oppd-referral:not(.oppd-verified) [class*="stripe-link"],
body.oppd-referral:not(.oppd-verified) [data-testid*="stripe-link"],
body.oppd-referral:not(.oppd-verified) #wc-stripe-payment-request-wrapper,
body.oppd-referral:not(.oppd-verified) #wc-stripe-payment-request-button-separator,
body.oppd-referral:not(.oppd-verified) .wc-stripe-elements-field {
    display: none !important;
}

/* Show message when express payments are hidden */
body.oppd-referral:not(.oppd-verified) .woocommerce-checkout-payment {
    position: relative;
}

body.oppd-referral:not(.oppd-verified) .woocommerce-checkout-payment::before {
    content: "Verify your OPPD service address above to enable payment options.";
    display: block;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    color: #856404;
    text-align: center;
    font-weight: 500;
}

/* Place Order Button Styling */
body.oppd-referral:not(.oppd-verified) #place_order {
    opacity: 0.5;
    cursor: not-allowed;
}

.oppd-place-order-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 10px 15px;
    margin-top: 10px !important;
    border-radius: 5px;
    color: #856404 !important;
    text-align: center;
    font-weight: 500 !important;
}

/* Product Page Styles */
body.oppd-referral .product .price {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

body.oppd-referral .single_add_to_cart_button {
    background: #28a745 !important;
    border-color: #28a745 !important;
}

body.oppd-referral .single_add_to_cart_button:hover {
    background: #218838 !important;
    border-color: #1e7e34 !important;
}

/* Cart Page Styles */
body.oppd-referral .cart-discount.coupon {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}

/* Admin Order View Styles */
.woocommerce-admin .oppd-address-info {
    background: #f0f0f1;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
}

/* Responsive Design */
@media (max-width: 768px) {
    .oppd-price-comparison {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .oppd-checkout-blurb strong {
        font-size: 16px;
    }

    .oppd-verify-address-btn {
        width: 100%;
        display: block;
    }

    .oppd-address-verification-section {
        padding: 15px;
    }
}

/* FunnelKit Checkout Specific Styles */
.wfacp_main_form .oppd-address-verification-section {
    background: white;
    border: 1px solid #e0e0e0;
    margin: 0 0 20px 0;
}

.wfacp_main_form .oppd-verify-address-btn {
    width: 100%;
}

/* Coupon Section Hide for OPPD */
body.oppd-referral .wfacp-coupon-section,
body.oppd-referral .woocommerce-form-coupon-toggle {
    display: none !important;
}

/* Loading State */
.oppd-verify-address-btn.loading {
    position: relative;
    pointer-events: none;
}

.oppd-verify-address-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

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

/* Success Checkmark Animation */
.oppd-verified-message .oppd-checkmark {
    animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}
