/**
 * Stripe Payment Integration Styles
 */

/* Payment Section Styles */
.rbp-payment-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.rbp-payment-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.rbp-payment-amount {
    color: #28a745;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* Payment Method Selection */
.rbp-payment-methods {
    margin-bottom: 20px;
}

.rbp-payment-method-option {
    margin-bottom: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.rbp-payment-method-option:hover {
    border-color: #007cba;
    background-color: #f8f9fa;
}

.rbp-payment-method-option.selected {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.rbp-payment-method-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
}

.rbp-payment-method-label input[type="radio"] {
    margin-right: 12px;
    margin-top: 2px;
    transform: scale(1.2);
}

.rbp-payment-method-text {
    display: flex;
    flex-direction: column;
}

.rbp-payment-method-text strong {
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
}

.rbp-payment-method-text small {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.4;
}

/* Online Payment Container - simplified for mobile */
#rbp-online-payment-container {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stripe Payment Form - simplified */
#rbp-stripe-payment-form {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

.rbp-payment-header {
    margin-bottom: 20px;
}

.rbp-payment-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
}

.rbp-payment-header .rbp-payment-amount {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 10px;
}

.rbp-test-mode-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    color: #856404;
}

.rbp-test-mode-notice strong {
    color: #d63384;
}

/* Stripe Elements - main payment container */
#rbp-stripe-card-element {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#rbp-stripe-card-element:focus-within {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#rbp-stripe-card-element.StripeElement--invalid {
    border-color: #dc3545;
}

#rbp-stripe-card-element.StripeElement--focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Error Messages */
#rbp-stripe-card-errors {
    color: #dc3545;
    font-size: 14px;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    display: none;
}

#rbp-stripe-card-errors:empty {
    display: none !important;
}

/* Payment Button */
#rbp-stripe-submit-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    position: relative;
    min-width: 120px;
}

#rbp-stripe-submit-button:hover:not(:disabled) {
    background: #218838;
}

#rbp-stripe-submit-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Spinner */
.rbp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: rbp-spin 1s ease-in-out infinite;
}

@keyframes rbp-spin {
    to { transform: rotate(360deg); }
}

/* Payment Result Messages */
#rbp-stripe-payment-result {
    margin-top: 15px;
}

.rbp-payment-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.rbp-payment-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rbp-payment-total {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .rbp-payment-amount {
        font-size: 20px;
    }
    
    #rbp-stripe-payment-form {
        padding: 15px;
    }
    
    #rbp-stripe-submit-button {
        width: 100%;
        padding: 15px;
    }
}

/* Integration with existing form styles */
.rbp-form-step[data-step="5"] {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading state for payment container */
#rbp-stripe-payment-container.loading {
    position: relative;
    min-height: 200px;
}

#rbp-stripe-payment-container.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: rbp-spin 1s linear infinite;
}

/* Security badges */
.rbp-security-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 12px;
    color: #6c757d;
}

.rbp-security-badge {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rbp-security-badge::before {
    content: '🔒';
    font-size: 14px;
}


/* Card element container update */
#rbp-card-element-container {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 15px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#rbp-card-element-container:focus-within {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#rbp-card-element-container.StripeElement--invalid {
    border-color: #dc3545;
}

#rbp-card-element-container.StripeElement--focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Mobile optimizations for Payment Element */
@media (max-width: 768px) {
    /* Remove any extra padding from containers */
    #rbp-online-payment-container {
        padding: 0;
        margin: 0;
    }
    
    #rbp-stripe-payment-form {
        padding: 0;
        margin: 0;
    }
    
    /* Apple Pay and Google Pay Button Styles */
    #rbp-apple-pay-button {
        margin-bottom: 15px;
    }
    
    /* Payment separator */
    .rbp-payment-separator {
        display: none; /* Hidden by default, shown when Apple Pay is available */
        align-items: center;
        margin: 20px 0;
        text-align: center;
    }
    
    .rbp-separator-line {
        flex: 1;
        height: 1px;
        background-color: #ddd;
    }
    
    .rbp-separator-text {
        padding: 0 15px;
        color: #666;
        font-size: 14px;
        background-color: #fff;
    }
    
    /* Simple card input container */
    #rbp-card-input-container {
        margin-top: 10px;
    }
    
    #rbp-card-element-simple {
        background: #fff;
        border: 1px solid #ced4da;
        border-radius: 4px;
        padding: 12px;
        margin: 10px 0;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    }
    
    #rbp-card-element-simple:focus-within {
        border-color: #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    
    #rbp-card-element-simple.StripeElement--invalid {
        border-color: #dc3545;
    }
    
    #rbp-card-element-simple.StripeElement--focus {
        border-color: #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    
    /* Mobile adjustments */
    @media (max-width: 768px) {
        .rbp-separator-text {
            padding: 0 10px;
            font-size: 13px;
        }
        
        #rbp-apple-pay-button {
            margin-bottom: 15px;
        }
        
        .rbp-payment-separator {
            margin: 15px 0;
        }
        
        #rbp-card-element-simple {
            padding: 15px;
            margin: 15px 0;
        }
    }
    
    /* Main payment element styling for mobile */
    #rbp-stripe-card-element {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    /* Ensure Payment Element takes full width on mobile */
    #rbp-stripe-card-element .StripeElement {
        width: 100% !important;
    }
    
    /* Payment header adjustments */
    .rbp-payment-header {
        margin-bottom: 15px;
    }
    
    .rbp-payment-header .rbp-payment-amount {
        font-size: 16px;
    }
}