/* ========================================================================
   Architect Modal Forms — Base Modal Styles
   All selectors go through #amf-root for maximum specificity
   ======================================================================== */

/* CSS Variables — Defaults */
#amf-root {
    --amf-overlay-color: rgba(255,255,255,0.18);
    --amf-overlay-blur: 15px;
    --amf-bg: rgba(255,255,255,0.85);
    --amf-text: #333;
    --amf-title-color: #333;
    --amf-title-size: 38px;
    --amf-desc-color: #555;
    --amf-radius: 18px;
    --amf-width: 960px;
    --amf-input-bg: transparent;
    --amf-input-border: #b1b1b1;
    --amf-input-focus: #000;
    --amf-input-radius: 15px;
    --amf-input-text: #333;
    --amf-submit-bg: #000;
    --amf-submit-color: #fff;
    --amf-submit-radius: 6px;
    --amf-submit-bg-hover: #333;
    --amf-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── TARGETED RESET — neutralize theme styles without breaking layout ─────
   Instead of all:revert (which breaks flex, images, pseudo-elements),
   we reset only the properties that WordPress themes commonly override.
   ════════════════════════════════════════════════════════════════════════ */

/* Reset form elements — themes heavily style these */
#amf-root .amf-overlay input,
#amf-root .amf-overlay textarea,
#amf-root .amf-overlay select,
#amf-root .amf-overlay option,
#amf-root .amf-overlay label,
#amf-root .amf-thankyou-overlay input,
#amf-root .amf-thankyou-overlay textarea,
#amf-root .amf-thankyou-overlay select,
#amf-root .amf-thankyou-overlay label {
    background: none !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    text-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-indent: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    line-height: inherit !important;
    height: auto !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    float: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
}

/* Reset form/fieldset wrappers — CF7 + themes */
#amf-root .amf-overlay form,
#amf-root .amf-overlay fieldset,
#amf-root .amf-overlay .wpcf7,
#amf-root .amf-overlay .wpcf7-form {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
    width: auto !important;
    outline: none !important;
    float: none !important;
}

/* Hide CF7 hidden fieldset */
#amf-root .amf-overlay fieldset.hidden-fields-container {
    display: none !important;
}

/* Reset typography elements — themes add backgrounds, borders, weird spacing */
#amf-root .amf-overlay p,
#amf-root .amf-overlay span,
#amf-root .amf-overlay a,
#amf-root .amf-overlay h1,
#amf-root .amf-overlay h2,
#amf-root .amf-overlay h3,
#amf-root .amf-overlay h4,
#amf-root .amf-overlay h5,
#amf-root .amf-overlay h6,
#amf-root .amf-thankyou-overlay p,
#amf-root .amf-thankyou-overlay span,
#amf-root .amf-thankyou-overlay a,
#amf-root .amf-thankyou-overlay h1,
#amf-root .amf-thankyou-overlay h2,
#amf-root .amf-thankyou-overlay h3 {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0 !important;
    float: none !important;
    box-sizing: border-box !important;
    -webkit-font-smoothing: antialiased;
}

/* ── Overlay ─────────────────────────────────────────────────────────── */
#amf-root .amf-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--amf-transition), visibility var(--amf-transition);
    box-sizing: border-box !important;
    margin: 0 !important;
    float: none !important;
    border: none !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    transform: none;
}

#amf-root .amf-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

#amf-root .amf-overlay-blur::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: var(--amf-overlay-color) !important;
    backdrop-filter: blur(var(--amf-overlay-blur)) !important;
    -webkit-backdrop-filter: blur(var(--amf-overlay-blur)) !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    z-index: 0 !important;
}

#amf-root .amf-overlay-color::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: var(--amf-overlay-color) !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    z-index: 0 !important;
}

/* ── Positions ───────────────────────────────────────────────────────── */
#amf-root .amf-overlay.amf-pos-center          { align-items: center; justify-content: center; }
#amf-root .amf-overlay.amf-pos-top-left        { align-items: flex-start; justify-content: flex-start; }
#amf-root .amf-overlay.amf-pos-top-center      { align-items: flex-start; justify-content: center; }
#amf-root .amf-overlay.amf-pos-top-right       { align-items: flex-start; justify-content: flex-end; }
#amf-root .amf-overlay.amf-pos-center-left     { align-items: center; justify-content: flex-start; }
#amf-root .amf-overlay.amf-pos-center-right    { align-items: center; justify-content: flex-end; }
#amf-root .amf-overlay.amf-pos-bottom-left     { align-items: flex-end; justify-content: flex-start; }
#amf-root .amf-overlay.amf-pos-bottom-center   { align-items: flex-end; justify-content: center; }
#amf-root .amf-overlay.amf-pos-bottom-right    { align-items: flex-end; justify-content: flex-end; }

/* ── Modal Box ───────────────────────────────────────────────────────── */
#amf-root .amf-modal {
    position: relative !important;
    z-index: 1 !important;
    max-width: var(--amf-width) !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: calc(100vh - 40px) !important;
    overflow: visible !important;
    border-radius: var(--amf-radius) !important;
    box-shadow: 0 25px 80px rgba(0,0,0,0.12), 0 8px 30px rgba(0,0,0,0.08) !important;
    transform: translateY(30px);
    opacity: 0;
    transition: transform var(--amf-transition), opacity var(--amf-transition);
    box-sizing: border-box !important;
    float: none !important;
    margin: 0 !important;
    border: none !important;
    padding: 0 !important;
    text-align: left !important;
    line-height: normal !important;
    font-size: 16px !important;
    color: var(--amf-text) !important;
    display: block !important;
    background: var(--amf-bg, #fff);
}

#amf-root .amf-overlay.is-visible .amf-modal {
    transform: translateY(0);
    opacity: 1;
}

/* ── Close Button ────────────────────────────────────────────────────── */
#amf-root .amf-modal .amf-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 10 !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: transform 0.2s, opacity 0.2s !important;
    float: none !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    outline: none !important;
    text-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    font: inherit !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

#amf-root .amf-modal .amf-close:hover {
    transform: scale(1.15);
}

#amf-root .amf-modal .amf-close-dark { color: #222; }
#amf-root .amf-modal .amf-close-light { color: #fff; }

#amf-root .amf-modal .amf-close svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    max-width: none !important;
    max-height: none !important;
}

/* ── Animations (Open) ───────────────────────────────────────────────── */
#amf-root .amf-overlay .amf-modal {
    opacity: 0;
}
#amf-root .amf-overlay.is-visible .amf-modal {
    opacity: 1;
}

#amf-root .amf-overlay[data-anim-open="fade-up"] .amf-modal {
    transform: translateY(40px);
}
#amf-root .amf-overlay[data-anim-open="fade-up"].is-visible .amf-modal {
    transform: translateY(0);
}

#amf-root .amf-overlay[data-anim-open="fade-down"] .amf-modal {
    transform: translateY(-40px);
}
#amf-root .amf-overlay[data-anim-open="fade-down"].is-visible .amf-modal {
    transform: translateY(0);
}

#amf-root .amf-overlay[data-anim-open="scale"] .amf-modal {
    transform: scale(0.85);
}
#amf-root .amf-overlay[data-anim-open="scale"].is-visible .amf-modal {
    transform: scale(1);
}

#amf-root .amf-overlay[data-anim-open="slide-right"] .amf-modal {
    transform: translateX(-80px);
}
#amf-root .amf-overlay[data-anim-open="slide-right"].is-visible .amf-modal {
    transform: translateX(0);
}

#amf-root .amf-overlay[data-anim-open="slide-left"] .amf-modal {
    transform: translateX(80px);
}
#amf-root .amf-overlay[data-anim-open="slide-left"].is-visible .amf-modal {
    transform: translateX(0);
}

#amf-root .amf-overlay[data-anim-open="fade"] .amf-modal {
    transform: none;
}

/* ── Animations (Close) ──────────────────────────────────────────────── */
#amf-root .amf-overlay.is-closing .amf-modal {
    transition: transform 0.25s ease-in, opacity 0.25s ease-in;
}

#amf-root .amf-overlay[data-anim-close="fade"].is-closing .amf-modal { opacity: 0; }
#amf-root .amf-overlay[data-anim-close="fade-up"].is-closing .amf-modal { opacity: 0; transform: translateY(-30px); }
#amf-root .amf-overlay[data-anim-close="fade-down"].is-closing .amf-modal { opacity: 0; transform: translateY(30px); }
#amf-root .amf-overlay[data-anim-close="scale"].is-closing .amf-modal { opacity: 0; transform: scale(0.85); }
#amf-root .amf-overlay[data-anim-close="slide-right"].is-closing .amf-modal { opacity: 0; transform: translateX(80px); }
#amf-root .amf-overlay[data-anim-close="slide-left"].is-closing .amf-modal { opacity: 0; transform: translateX(-80px); }

/* ── Typography ──────────────────────────────────────────────────────── */
#amf-root .amf-modal .amf-modal-subtitle {
    font-size: 15px !important;
    color: var(--amf-desc-color) !important;
    margin: 0 0 4px !important;
    font-weight: 400 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    border: none !important;
    background: none !important;
    text-align: left !important;
    display: block !important;
    font-family: inherit !important;
    text-decoration: none !important;
    width: auto !important;
    float: none !important;
}

#amf-root .amf-modal .amf-modal-title {
    font-size: var(--amf-title-size) !important;
    color: var(--amf-title-color) !important;
    font-weight: 700 !important;
    margin: 0 0 12px !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    text-transform: none !important;
    text-align: left !important;
    display: block !important;
    font-family: inherit !important;
    text-decoration: none !important;
    width: auto !important;
    float: none !important;
    text-shadow: none !important;
}

#amf-root .amf-modal .amf-modal-desc {
    font-size: 15px !important;
    color: var(--amf-desc-color) !important;
    margin: 0 0 20px !important;
    line-height: 1.5 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    display: block !important;
    font-family: inherit !important;
    text-align: left !important;
    width: auto !important;
    float: none !important;
}

/* ── Form Fields — Override CF7 / any form ────────────────────────────── */
#amf-root .amf-modal .amf-modal-form input[type="text"],
#amf-root .amf-modal .amf-modal-form input[type="email"],
#amf-root .amf-modal .amf-modal-form input[type="tel"],
#amf-root .amf-modal .amf-modal-form input[type="number"],
#amf-root .amf-modal .amf-modal-form input[type="url"],
#amf-root .amf-modal .amf-modal-form input[type="password"],
#amf-root .amf-modal .amf-modal-form input[type="search"],
#amf-root .amf-modal .amf-modal-form input[type="date"],
#amf-root .amf-modal .amf-modal-form select,
#amf-root .amf-modal .amf-modal-form textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    background: var(--amf-input-bg) !important;
    border: 1px solid var(--amf-input-border) !important;
    border-radius: var(--amf-input-radius) !important;
    padding: 14px 18px !important;
    font-size: 15px !important;
    color: var(--amf-input-text) !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    margin: 0 0 12px 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    height: auto !important;
    line-height: 1.4 !important;
    display: block !important;
    float: none !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    font-family: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    font-weight: 400 !important;
    text-align: left !important;
    text-indent: 0 !important;
    text-shadow: none !important;
    background-image: none !important;
    background-clip: border-box !important;
    vertical-align: baseline !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

#amf-root .amf-modal .amf-modal-form input:focus,
#amf-root .amf-modal .amf-modal-form select:focus,
#amf-root .amf-modal .amf-modal-form textarea:focus {
    border-color: var(--amf-input-focus) !important;
    box-shadow: none !important;
    outline: none !important;
}

#amf-root .amf-modal .amf-modal-form input::placeholder,
#amf-root .amf-modal .amf-modal-form textarea::placeholder {
    color: #999;
    opacity: 1;
}

/* Submit button */
#amf-root .amf-modal .amf-modal-form input[type="submit"],
#amf-root .amf-modal .amf-modal-form button[type="submit"],
#amf-root .amf-modal .amf-modal-form button:not([type]),
#amf-root .amf-modal .amf-modal-form .wpcf7-submit {
    width: 100% !important;
    background: var(--amf-submit-bg) !important;
    color: var(--amf-submit-color) !important;
    border: none !important;
    border-radius: var(--amf-submit-radius) !important;
    padding: 16px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.15s !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    margin: 4px 0 0 0 !important;
    display: block !important;
    height: auto !important;
    line-height: 1.4 !important;
    float: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    text-align: center !important;
    font-family: inherit !important;
    min-height: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    outline: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    background-image: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    vertical-align: baseline !important;
}

#amf-root .amf-modal .amf-modal-form input[type="submit"]:hover,
#amf-root .amf-modal .amf-modal-form button[type="submit"]:hover,
#amf-root .amf-modal .amf-modal-form button:not([type]):hover,
#amf-root .amf-modal .amf-modal-form .wpcf7-submit:hover {
    background: var(--amf-submit-bg-hover) !important;
    transform: translateY(-1px) !important;
}

#amf-root .amf-modal .amf-modal-form input[type="submit"]:disabled,
#amf-root .amf-modal .amf-modal-form button[type="submit"]:disabled,
#amf-root .amf-modal .amf-modal-form .wpcf7-submit:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* CF7 specific resets */
#amf-root .amf-modal .amf-modal-form .wpcf7-form-control-wrap {
    display: block;
    position: relative;
}

#amf-root .amf-modal .amf-modal-form .wpcf7-response-output {
    margin: 10px 0 0;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
}

#amf-root .amf-modal .amf-modal-form .wpcf7-not-valid-tip {
    font-size: 12px;
    color: #e74c3c;
}

#amf-root .amf-modal .amf-modal-form .wpcf7-spinner {
    display: block;
    margin: 10px auto 0;
}

#amf-root .amf-modal .amf-modal-form p {
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    color: inherit !important;
    text-align: left !important;
    width: auto !important;
    float: none !important;
}

#amf-root .amf-modal .amf-modal-form br {
    display: none !important;
}

#amf-root .amf-modal .amf-modal-form .wpcf7-form {
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

#amf-root .amf-modal .amf-modal-form label {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    background: none !important;
    border: none !important;
    width: auto !important;
    float: none !important;
    line-height: inherit !important;
    text-transform: none !important;
}

/* ── Warning ─────────────────────────────────────────────────────────── */
#amf-root .amf-modal .amf-modal-warning {
    padding: 14px 24px;
    font-size: 12px;
    line-height: 1.5;
    color: #666;
    text-align: center;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: rgba(0,0,0,0.02);
    margin: 0;
}

#amf-root .amf-modal .amf-modal-warning a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    background: none;
    border: none;
    padding: 0;
}

#amf-root .amf-modal .amf-modal-warning a:hover {
    color: #000;
}

#amf-root .amf-modal .amf-modal-warning-links {
    display: inline;
}

/* ── Scrollbar lock ──────────────────────────────────────────────────── */
body.amf-no-scroll {
    overflow: hidden !important;
    padding-right: var(--amf-scrollbar-width, 0px);
}

/* ── Thank You Modal ─────────────────────────────────────────────────── */
#amf-root .amf-thankyou-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0,0,0,0.45) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
}

#amf-root .amf-thankyou-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

#amf-root .amf-thankyou-modal {
    position: relative !important;
    background: #fff !important;
    border-radius: 20px !important;
    padding: 48px 40px 40px !important;
    max-width: 420px !important;
    width: 90% !important;
    min-width: 0 !important;
    height: auto !important;
    text-align: center !important;
    box-shadow: 0 30px 80px rgba(0,0,0,0.15) !important;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0 !important;
    float: none !important;
    border: none !important;
    color: #333 !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    display: block !important;
}

#amf-root .amf-thankyou-modal,
#amf-root .amf-thankyou-modal * {
    box-sizing: border-box !important;
}

#amf-root .amf-thankyou-overlay.is-visible .amf-thankyou-modal {
    transform: scale(1);
}

#amf-root .amf-thankyou-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    transition: color 0.2s;
}

#amf-root .amf-thankyou-close:hover {
    color: #333;
}

#amf-root .amf-thankyou-logo {
    margin-bottom: 20px;
}

#amf-root .amf-thankyou-logo img {
    max-height: 40px;
    max-width: 160px;
    object-fit: contain;
}

#amf-root .amf-thankyou-logo img[src=""] {
    display: none;
}

/* Animated checkmark */
#amf-root .amf-thankyou-check { margin-bottom: 20px; }
#amf-root .amf-ty-circle { stroke-dasharray: 190; stroke-dashoffset: 190; }
#amf-root .amf-ty-checkmark { stroke-dasharray: 40; stroke-dashoffset: 40; }
#amf-root .amf-thankyou-overlay.is-visible .amf-ty-circle { animation: amf-circle 0.6s ease-out 0.2s forwards; }
#amf-root .amf-thankyou-overlay.is-visible .amf-ty-checkmark { animation: amf-check 0.4s ease-out 0.6s forwards; }

@keyframes amf-circle { to { stroke-dashoffset: 0; } }
@keyframes amf-check { to { stroke-dashoffset: 0; } }

#amf-root .amf-thankyou-heading { font-size: 28px; font-weight: 700; color: #222; margin: 0 0 8px; }
#amf-root .amf-thankyou-subheading { font-size: 16px; color: #555; margin: 0 0 6px; font-weight: 500; }
#amf-root .amf-thankyou-description { font-size: 14px; color: #888; margin: 0; line-height: 1.5; }

/* ── Trigger Button (shortcode) ──────────────────────────────────────── */
.amf-trigger-btn {
    display: inline-block;
    cursor: pointer;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #amf-root .amf-overlay {
        padding: 10px;
    }

    #amf-root .amf-modal {
        max-width: 100%;
        border-radius: 14px;
    }

    #amf-root .amf-modal .amf-modal-title {
        font-size: clamp(22px, 5vw, var(--amf-title-size));
    }

    #amf-root .amf-modal .amf-close {
        top: 10px;
        right: 10px;
    }

    #amf-root .amf-thankyou-modal {
        padding: 36px 24px 28px;
    }
}
