/**
 * Currency Converter Payment - Frontend Styles
 * Styles for the payment form shortcode
 */

/* Main form container */
.ccp-payment-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ccp-payment-form * {
    box-sizing: border-box;
}

/* Form inner wrapper */
.ccp-payment-form-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Form rows */
.ccp-form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Form groups */
.ccp-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Labels */
.ccp-label {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    margin: 0;
    line-height: 1.4;
}

/* Input wrapper for currency symbol */
.ccp-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Currency symbol */
.ccp-currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: #6b7280;
    font-size: 16px;
    z-index: 2;
    pointer-events: none;
}

/* Input fields */
.ccp-input {
    width: 100%;
    padding: 12px 16px 12px 32px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    color: #374151;
    background-color: #ffffff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ccp-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ccp-input:disabled,
.ccp-input[readonly] {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

.ccp-input::placeholder {
    color: #9ca3af;
}

/* Specific input styling */
.ccp-usd-input {
    font-weight: 600;
}

.ccp-cny-input {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    font-weight: 500;
}

/* Conversion info */
.ccp-conversion-info {
    text-align: center;
    padding: 8px 0;
}

.ccp-rate-display {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* Pay button */
.ccp-pay-button {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.ccp-pay-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ccp-pay-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.ccp-pay-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ccp-pay-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Button content */
.ccp-button-text {
    display: inline-block;
}

.ccp-button-spinner {
    display: none;
    align-items: center;
    gap: 8px;
}

.ccp-pay-button.loading .ccp-button-text {
    display: none;
}

.ccp-pay-button.loading .ccp-button-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Spinner animation */
.ccp-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: ccp-spin 1s linear infinite;
}

@keyframes ccp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form errors */
.ccp-form-errors {
    padding: 12px 16px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 14px;
    line-height: 1.4;
}

.ccp-form-errors:empty {
    display: none;
}

.ccp-form-errors ul {
    margin: 0;
    padding-left: 20px;
}

.ccp-form-errors li {
    margin-bottom: 4px;
}

.ccp-form-errors li:last-child {
    margin-bottom: 0;
}

/* Success message */
.ccp-success-message {
    padding: 12px 16px;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    color: #166534;
    font-size: 14px;
    line-height: 1.4;
}

/* Warning message */
.ccp-warning-message {
    padding: 12px 16px;
    background-color: #fffbeb;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    color: #92400e;
    font-size: 14px;
    line-height: 1.4;
}

/* Form validation states */
.ccp-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.ccp-input.success {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Responsive design */
@media (max-width: 480px) {
    .ccp-payment-form {
        margin: 0;
        padding: 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .ccp-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .ccp-pay-button {
        padding: 16px 20px;
        font-size: 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ccp-payment-form {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .ccp-label {
        color: #f9fafb;
    }
    
    .ccp-input {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .ccp-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .ccp-input:disabled,
    .ccp-input[readonly] {
        background-color: #1f2937;
        color: #9ca3af;
    }
    
    .ccp-cny-input {
        background-color: #1f2937;
        border-color: #374151;
    }
    
    .ccp-currency-symbol {
        color: #d1d5db;
    }
    
    .ccp-rate-display {
        color: #d1d5db;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ccp-payment-form {
        border: 2px solid #000000;
    }
    
    .ccp-input {
        border: 2px solid #000000;
    }
    
    .ccp-pay-button {
        background: #000000;
        border: 2px solid #000000;
    }
    
    .ccp-pay-button:hover:not(:disabled) {
        background: #333333;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ccp-input,
    .ccp-pay-button {
        transition: none;
    }
    
    .ccp-spinner {
        animation: none;
    }
    
    .ccp-pay-button:hover:not(:disabled) {
        transform: none;
    }
}

/* Print styles */
@media print {
    .ccp-payment-form {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .ccp-pay-button {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
}

/* Focus visible for better accessibility */
.ccp-pay-button:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.ccp-input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading overlay */
.ccp-payment-form.processing {
    position: relative;
    pointer-events: none;
}

.ccp-payment-form.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* Custom form variants */
.ccp-payment-form.compact {
    padding: 16px;
    max-width: 320px;
}

.ccp-payment-form.compact .ccp-form-row {
    gap: 12px;
}

.ccp-payment-form.minimal {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.ccp-payment-form.minimal .ccp-input {
    border-radius: 4px;
}

.ccp-payment-form.minimal .ccp-pay-button {
    border-radius: 4px;
}