/* 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: var(--eg-danger);
}

#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 var(--eg-danger);
}

#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: var(--eg-danger);
    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(--eg-primary);
    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 is defined in enrollment-form.css, which is the
 * only place it is used — the three chips inside .evergreen-security-badges.
 * A second definition lived here from an earlier design where the badge was a
 * standalone green reassurance box. It no longer matched the markup: the chips
 * already sit in a panel, so this rule double-boxed them, and it did it in
 * Evergreen green (#f0fdf4 / #86efac / #166534) that the rebrand missed
 * because the colour was in the file nobody expected to hold badge styling.
 * Deleted rather than recoloured; the surviving definition is correct.
 */

/* 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;
}

/* Scoped deliberately. Unqualified, this restyled every .gfield_required on
 * the site — a class this plugin does not own. Harmless on a dedicated site,
 * not on a shared marketing site running other form plugins. */
.evergreen-payment-fields .gfield_required {
    color: var(--eg-danger);
    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: var(--eg-brand-50);
    border: 1px solid var(--eg-brand-200);
    border-radius: 8px;
    font-size: 14px;
    color: var(--eg-brand-900);
    line-height: 1.5;
}

.evergreen-payment-schedule-notice svg {
    flex-shrink: 0;
    color: var(--eg-primary);
    margin-top: 2px;
}

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

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