/* Secure Fields Styling */

/* Container for secure iframes (USAePay and Evervault) */
.evergreen-secure-input,
.evergreen-secure-iframe-container {
    min-height: 48px;
    border-radius: 8px;
    background: #fff;
    position: relative;
}

.evergreen-secure-input iframe,
.evergreen-secure-iframe-container iframe {
    width: 100% !important;
    min-height: 48px !important;
    border: none;
    border-radius: 8px;
}

/* USAePay card entry container — compact to match normal form fields */
#usaepay-card-entry {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 4px;
    background: #fff;
    min-height: 40px;
    max-height: 48px;
    overflow: hidden;
}

#usaepay-card-entry.error {
    border-color: #dc2626;
}

#usaepay-card-entry iframe {
    width: 100% !important;
    height: 40px !important;
    max-height: 44px !important;
    overflow: hidden !important;
    border: none !important;
}

/* Evervault SSN input container */
#evervault-ssn-input {
    min-height: 48px;
}

#evervault-ssn-input.error {
    border-radius: 8px;
    box-shadow: 0 0 0 2px #dc2626;
}

#evervault-ssn-input iframe {
    width: 100% !important;
    height: 48px !important;
}

/* Loading message for iframes */
.evergreen-iframe-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    color: #6b7280;
    font-size: 14px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 16px;
}

/* Fallback card inputs styling */
.evergreen-card-fallback {
    padding: 0;
}

.evergreen-card-fallback .evergreen-form-row {
    display: flex;
    gap: 12px;
}

.evergreen-card-fallback .evergreen-form-row.cols-3 > .evergreen-field {
    flex: 1;
}

/* Button spinner for loading state */
.evergreen-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: evergreen-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* Field error messages */
.evergreen-field-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
    display: none;
}

.evergreen-field-error.show {
    display: block;
}

/* Loading overlay */
.evergreen-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.evergreen-loading-content {
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.evergreen-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--evergreen-600, #356842);
    border-radius: 50%;
    animation: evergreen-spin 1s linear infinite;
    margin: 0 auto 16px;
}

.evergreen-loading-message {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

/* Security badges for payment section */
.evergreen-security-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: #166534;
}

.evergreen-security-badge svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Demo mode badge */
.evergreen-demo-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid #fcd34d;
}

/* SSN field specific */
.evergreen-ssn-field {
    margin-bottom: 16px;
}

.evergreen-ssn-field .gfield_label,
.evergreen-payment-fields .gfield_label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
}

.gfield_required {
    color: #dc2626;
    margin-left: 2px;
}

/* Card fields layout */
.evergreen-payment-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.evergreen-card-row {
    display: flex;
    gap: 16px;
}

.evergreen-card-row-split > div {
    flex: 1;
}

.evergreen-card-number {
    flex: 1;
}

/* Payment schedule notice */
.evergreen-payment-schedule-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #f0f7f1;
    border: 1px solid #bcdbc0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e3726;
    line-height: 1.5;
}

.evergreen-payment-schedule-notice svg {
    flex-shrink: 0;
    color: #356842;
    margin-top: 2px;
}

/* Responsive */
@media (max-width: 600px) {
    .evergreen-card-row {
        flex-direction: column;
    }

    .evergreen-loading-content {
        margin: 20px;
        padding: 30px 40px;
    }
}
