/**
 * MFA Pro 3.0 – Frontend Fallback Styles
 *
 * ARCHITECTURE:
 *   All visual styles use :where() → specificity (0,0,0)
 *   Theme SCSS (.contact-form__*) with ANY specificity wins automatically.
 *
 *   Only structural/functional rules (honeypot hiding, spinner animation,
 *   feedback states) use real specificity since they must always apply.
 *
 * Theme developers: You do NOT need to override this file.
 * Your .contact-form__* classes take priority by default.
 */

/* ==========================================================================
   FUNCTIONAL (real specificity — must always apply)
   ========================================================================== */

/* ── Honeypot: must be invisible ────────────────────────── */
.mfa-hp {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ── Spinner animation ──────────────────────────────────── */
.mfa-btn__spinner {
    animation: mfa-spin .8s linear infinite;
    display: inline-flex;
    align-items: center;
}

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

/* ── Feedback container (AJAX messages) ─────────────────── */
.mfa-feedback {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.mfa-feedback--success {
    background: rgba(16, 185, 129, .12);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, .3);
}

.mfa-feedback--error {
    background: rgba(239, 68, 68, .10);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, .3);
}

/* Dark-context-aware feedback (when parent has dark bg) */
.contact-form-section .mfa-feedback--success,
[class*="bg-dark"] .mfa-feedback--success {
    background: rgba(16, 185, 129, .15);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, .3);
}

.contact-form-section .mfa-feedback--error,
[class*="bg-dark"] .mfa-feedback--error {
    background: rgba(239, 68, 68, .15);
    color: #fecaca;
    border-color: rgba(239, 68, 68, .3);
}

/* ── Error field indicator (JS adds this class) ─────────── */
.mfa-field--error .contact-form__input,
.mfa-field--error .contact-form__textarea,
.mfa-field--error .contact-form__select,
.mfa-field--error .mfa-input {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15) !important;
}

/* ── Error message text ─────────────────────────────────── */
.mfa-field-error {
    display: block;
    font-size: 13px;
    color: #ef4444;
    margin-top: 4px;
    min-height: 0;
    line-height: 1.4;
}

/* Dark context */
.contact-form-section .mfa-field-error,
[class*="bg-dark"] .mfa-field-error {
    color: #fca5a5;
}

/* ── Conditional field hiding ───────────────────────────── */
.mfa-field--hidden {
    display: none !important;
}

/* ── Turnstile wrapper ──────────────────────────────────── */
.mfa-turnstile-wrapper {
    margin: 1rem 0;
}

/* ── Required asterisk ──────────────────────────────────── */
.mfa-required {
    color: #ef4444;
    font-weight: 700;
    margin-left: 2px;
}

.contact-form-section .mfa-required {
    color: #fca5a5;
}


/* ==========================================================================
   FALLBACK VISUALS (zero specificity via :where — theme always overrides)
   ========================================================================== */

/* ── Wrapper ────────────────────────────────────────────── */
:where(.mfa-form-wrapper) {
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
}

:where(.mfa-form-wrapper) *,
:where(.mfa-form-wrapper) *::before,
:where(.mfa-form-wrapper) *::after {
    box-sizing: inherit;
}

/* ── Form layout ────────────────────────────────────────── */
:where(.mfa-form) {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* ── Field group ────────────────────────────────────────── */
:where(.mfa-field) {
    width: 100%;
    position: relative;
}

/* ── Label ──────────────────────────────────────────────── */
:where(.mfa-label) {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

/* ── Inputs ─────────────────────────────────────────────── */
:where(.mfa-input) {
    display: block;
    width: 100%;
    padding: 1.1rem 1.25rem;
    font-size: 1.05rem;
    line-height: 1.5;
    color: inherit;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-family: inherit;
    transition: border-color .3s, box-shadow .3s, background .3s;
    -webkit-appearance: none;
    appearance: none;
}

:where(.mfa-input)::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

:where(.mfa-input):hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

:where(.mfa-input):focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

:where(.mfa-input.mfa-select) {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 20px;
}

/* ── Textarea ───────────────────────────────────────────── */
:where(textarea.mfa-input) {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

/* ── Checkbox ───────────────────────────────────────────── */
:where(.mfa-checkbox-label) {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}

:where(.mfa-checkbox) {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

:where(.mfa-privacy-text) a {
    text-decoration: underline;
}

/* ── Submit button ──────────────────────────────────────── */
:where(.mfa-btn-submit) {
    width: 100%;
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: var(--color-primary, #2563eb);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

:where(.mfa-btn-submit):hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

:where(.mfa-btn-submit):active {
    transform: translateY(-1px);
}

:where(.mfa-btn-submit):disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ── Half-width fields (desktop) ────────────────────────── */
@media (min-width: 640px) {
    :where(.mfa-field--half),
    :where(.contact-form__group--half) {
        width: calc(50% - 0.875rem);
        display: inline-block;
        vertical-align: top;
    }
}

/* ── Mobile fix: prevent iOS zoom on focus (≥16px) ──────── */
@media (max-width: 480px) {
    :where(.mfa-input) {
        font-size: 16px;
    }
}
