/* ========================================================================
   Crosspatch - frontend styles, v0.2.0
   Self-contained, scoped under .cxp-form. Reuses cf7-* class names so any
   existing Customizer CSS still applies, but adds our own polish on top.
   ======================================================================== */

.cxp-form {
    /* Tokens */
    --cxp-c-ink: #0b1929;
    --cxp-c-ink-2: #344152;
    --cxp-c-ink-3: #6b7785;
    --cxp-c-line: #e5e9ee;
    --cxp-c-bg: #ffffff;
    --cxp-c-field-bg: #ffffff;
    --cxp-c-accent: #00ff99;
    --cxp-c-accent-dk: #00cc7a;
    --cxp-c-accent-bg: rgba(0,255,153,.08);
    --cxp-c-cyan: #4ec3e0;
    --cxp-c-error: #d63638;
    --cxp-c-error-bg: #ffeceb;
    --cxp-c-success: #015825;
    --cxp-c-success-bg: #ebfff5;
    --cxp-c-warn: #8c5a00;
    --cxp-c-warn-bg: #fff4dc;
    --cxp-c-shadow: 0 1px 2px rgba(11,25,41,.05), 0 6px 16px rgba(11,25,41,.04);
    --cxp-r-md: 10px;
    --cxp-r-lg: 14px;
    --cxp-r-pill: 999px;
    --cxp-anim: .18s cubic-bezier(.4,.0,.2,1);

    position: relative;
    font-family: inherit;
    color: var(--cxp-c-ink);
}

/* ---------- Sections ---------- */
.cxp-form .cf7-section { margin: 0 0 22px; }
.cxp-form .cf7-section h4 {
    font-size: 13px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--cxp-c-ink-3); margin: 0 0 12px; font-weight: 700;
}
.cxp-form .cf7-note { color: var(--cxp-c-ink-3); font-size: 14px; margin: 0 0 12px; }

.cxp-form .cf7-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px;
}
.cxp-form .cf7-span-2 { grid-column: 1 / -1; }
@media (max-width: 540px) {
    .cxp-form .cf7-grid { grid-template-columns: 1fr; }
    .cxp-form .cf7-span-2 { grid-column: auto; }
}

/* Conditional sections animate in */
.cxp-form .cxp-conditional { transition: opacity .25s ease; }
.cxp-form .cxp-conditional.is-revealed {
    animation: cxp-slide-in .3s cubic-bezier(.4,.0,.2,1);
}
@keyframes cxp-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Fields ---------- */
.cxp-form .cf7-field { display: flex; flex-direction: column; }
.cxp-form .cf7-field label {
    font-size: 13px; font-weight: 600; color: var(--cxp-c-ink);
    margin: 0 0 6px;
}
.cxp-form input[type="text"],
.cxp-form input[type="email"],
.cxp-form input[type="tel"],
.cxp-form input[type="number"],
.cxp-form select,
.cxp-form textarea {
    width: 100%; box-sizing: border-box;
    padding: 11px 14px; font: inherit; font-size: 15px;
    background: var(--cxp-c-field-bg); color: var(--cxp-c-ink);
    border: 1px solid var(--cxp-c-line);
    border-radius: var(--cxp-r-md);
    transition: border-color var(--cxp-anim), box-shadow var(--cxp-anim), background var(--cxp-anim);
    appearance: none;
}
.cxp-form textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.cxp-form select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7785' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
    padding-right: 36px;
}
.cxp-form input:focus,
.cxp-form select:focus,
.cxp-form textarea:focus {
    outline: none;
    border-color: var(--cxp-c-cyan);
    box-shadow: 0 0 0 3px rgba(78,195,224,.22);
}
.cxp-form input:hover, .cxp-form select:hover, .cxp-form textarea:hover { border-color: #c6cdd5; }
.cxp-form input::placeholder, .cxp-form textarea::placeholder { color: #a8b0ba; }

.cxp-form .cf7-field.has-error input,
.cxp-form .cf7-field.has-error textarea,
.cxp-form .cf7-field.has-error select {
    border-color: var(--cxp-c-error);
    box-shadow: 0 0 0 3px rgba(214,54,56,.15);
}
.cxp-field-error {
    color: var(--cxp-c-error); font-size: 13px; margin-top: 4px;
    display: flex; align-items: center; gap: 5px;
}
.cxp-field-error::before { content: "!"; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; background: var(--cxp-c-error); color: #fff; border-radius: 50%; font-size: 11px; font-weight: 700; }

.cxp-form .cxp-help { font-size: 13px; color: var(--cxp-c-ink-3); margin: 6px 0 0; }

/* ---------- Radios (v0.11.54 BUG-14) ---------- */
.cxp-form .cxp-radios { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.cxp-form .cxp-radio {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1px solid var(--cxp-c-line);
    border-radius: var(--cxp-r-md); cursor: pointer; font-weight: 500;
    background: var(--cxp-c-field-bg);
    color: var(--cxp-c-ink);
    transition: border-color var(--cxp-anim), background var(--cxp-anim), color var(--cxp-anim);
}
.cxp-form .cxp-radio span { color: var(--cxp-c-ink); }
.cxp-form .cxp-radio:hover { border-color: #c6cdd5; background: #fafbfc; color: var(--cxp-c-ink); }

/* ---------- Checkboxes ---------- */
.cxp-form .cxp-checkboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.cxp-form .cxp-checkbox {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1px solid var(--cxp-c-line);
    border-radius: var(--cxp-r-md); cursor: pointer; font-weight: 500;
    background: var(--cxp-c-field-bg);
    color: var(--cxp-c-ink);
    transition: border-color var(--cxp-anim), background var(--cxp-anim), color var(--cxp-anim);
}
.cxp-form .cxp-checkbox span { color: var(--cxp-c-ink); }
.cxp-form .cxp-checkbox:hover { border-color: #c6cdd5; background: #fafbfc; color: var(--cxp-c-ink); }
.cxp-form .cxp-checkbox input[type="checkbox"] {
    width: 18px; height: 18px; margin: 0; accent-color: var(--cxp-c-accent);
    cursor: pointer;
}
.cxp-form .cxp-checkbox:has(input:checked) {
    /* Fully opaque mint, not translucent, so a theme's dark field background can't bleed through. */
    border-color: var(--cxp-c-accent-dk) !important;
    background: #d4fde9 !important;
    color: #0b1929 !important;
}
.cxp-form .cxp-checkbox:has(input:checked) span,
.cxp-form .cxp-checkbox:has(input:checked) * {
    /* !important defeats higher-specificity theme rules like ".elementor-form label { color: #fff }" */
    color: #0b1929 !important;
    font-weight: 600;
}

/* ---------- File upload ---------- */
.cxp-form .cxp-file-upload {
    border: 0; border-radius: var(--cxp-r-lg);
    background: #fafbfc; padding: 0; overflow: hidden;
}
.cxp-form .cxp-file-dropzone {
    padding: 36px 20px; text-align: center;
    border: 2px dashed rgba(0,255,153,.55);
    margin: 10px; border-radius: var(--cxp-r-md);
    background: var(--cxp-c-accent-bg);
    transition: background var(--cxp-anim), border-color var(--cxp-anim), transform var(--cxp-anim);
    cursor: pointer;
}
.cxp-form .cxp-file-dropzone:hover { background: rgba(0,255,153,.12); }
.cxp-form .cxp-file-dropzone.is-dragging {
    background: rgba(0,255,153,.18); border-color: var(--cxp-c-accent);
    transform: scale(1.01);
}
.cxp-form .cxp-file-prompt strong {
    display: block; font-size: 18px; margin-bottom: 4px; color: var(--cxp-c-ink);
}
.cxp-form .cxp-file-browse {
    background: transparent; border: 0;
    color: var(--cxp-c-cyan); text-decoration: underline;
    cursor: pointer; font: inherit; padding: 0;
}
.cxp-form .cxp-file-counter {
    text-align: right; padding: 8px 14px 0;
    font-size: 13px; color: var(--cxp-c-ink-3);
}
.cxp-form .cxp-file-list {
    list-style: none; margin: 0; padding: 12px 16px 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.cxp-form .cxp-file-list li {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: var(--cxp-c-bg); border: 1px solid var(--cxp-c-line);
    border-radius: var(--cxp-r-md);
    animation: cxp-slide-in .2s ease;
}
.cxp-form .cxp-file-list .cxp-file-thumb {
    width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
    background: rgba(78,195,224,.12); color: var(--cxp-c-cyan);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px; text-transform: uppercase;
    background-size: cover; background-position: center;
}
.cxp-form .cxp-file-list .cxp-file-name { font-weight: 600; color: var(--cxp-c-ink); flex: 1; word-break: break-all; }
.cxp-form .cxp-file-list .cxp-file-size { color: var(--cxp-c-ink-3); font-size: 12px; flex-shrink: 0; }
.cxp-form .cxp-file-list .cxp-file-remove {
    background: transparent; border: 1px solid var(--cxp-c-line);
    border-radius: 6px; padding: 4px 10px; cursor: pointer;
    color: var(--cxp-c-ink-3); font-size: 12px; font-weight: 600;
    transition: color var(--cxp-anim), border-color var(--cxp-anim);
}
.cxp-form .cxp-file-list .cxp-file-remove:hover { color: var(--cxp-c-error); border-color: var(--cxp-c-error); }
.cxp-form .cxp-file-list .cxp-file-progress {
    flex: 1; height: 4px; background: var(--cxp-c-line);
    border-radius: 2px; overflow: hidden; max-width: 120px;
}
.cxp-form .cxp-file-list .cxp-file-progress span {
    display: block; height: 100%; background: var(--cxp-c-accent); width: 0%;
    transition: width .25s;
}
.cxp-form .cxp-file-list li.is-uploading .cxp-file-name { color: var(--cxp-c-ink-3); }
.cxp-form .cxp-file-list li.is-error { border-color: var(--cxp-c-error); background: var(--cxp-c-error-bg); }
.cxp-form .cxp-file-list li.is-error .cxp-file-name { color: var(--cxp-c-error); }

/* ---------- Submit ---------- */
.cxp-form .cf7-submit, .cxp-form input[type="submit"].cf7-submit {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px; font: inherit; font-weight: 700; font-size: 16px;
    background: var(--cxp-c-accent); color: var(--cxp-c-ink);
    border: 0; border-radius: var(--cxp-r-pill); cursor: pointer;
    transition: background var(--cxp-anim), transform var(--cxp-anim), box-shadow var(--cxp-anim);
    box-shadow: 0 4px 12px rgba(0,255,153,.35);
    letter-spacing: .3px;
}
.cxp-form .cf7-submit:hover { background: var(--cxp-c-accent-dk); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,255,153,.45); }
.cxp-form .cf7-submit:active { transform: translateY(0); }
.cxp-form .cf7-submit:focus { outline: none; box-shadow: 0 0 0 3px rgba(0,255,153,.4), 0 4px 12px rgba(0,255,153,.35); }
.cxp-form .cf7-submit:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.cxp-form .cxp-loader {
    display: none; width: 18px; height: 18px; margin-left: 10px;
    border: 2px solid rgba(11,25,41,.2);
    border-top-color: var(--cxp-c-ink); border-radius: 50%;
    animation: cxp-spin .8s linear infinite; vertical-align: middle;
}
.cxp-form.is-submitting .cxp-loader { display: inline-block; }
.cxp-form.is-submitting .cf7-submit { opacity: .7; pointer-events: none; }
@keyframes cxp-spin { to { transform: rotate(360deg); } }

/* ---------- Response box ---------- */
.cxp-form-response {
    margin-top: 18px; min-height: 1em;
    transition: padding .15s, background .15s;
}
.cxp-form-response.is-error,
.cxp-form-response.is-success,
.cxp-form-response.is-validation {
    padding: 14px 18px; border-radius: var(--cxp-r-md); border: 1px solid;
    font-size: 14px; font-weight: 600; line-height: 1.4;
    animation: cxp-slide-in .25s ease;
    display: flex; align-items: flex-start; gap: 10px;
}
.cxp-form-response.is-error      { border-color: var(--cxp-c-error);   background: var(--cxp-c-error-bg);   color: #5a1418; }
.cxp-form-response.is-success    { border-color: var(--cxp-c-accent);  background: var(--cxp-c-success-bg); color: var(--cxp-c-success); }
.cxp-form-response.is-validation { border-color: #f59e0b;              background: var(--cxp-c-warn-bg);    color: var(--cxp-c-warn); }
.cxp-form-response::before {
    content: ""; width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px;
    background-position: center; background-repeat: no-repeat; background-size: 20px;
    display: none;
}
.cxp-form-response.is-success::before {
    display: inline-block;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23015825'%3E%3Cpath d='M16.7 5.3a1 1 0 010 1.4l-8 8a1 1 0 01-1.4 0l-4-4a1 1 0 011.4-1.4L8 12.6l7.3-7.3a1 1 0 011.4 0z'/%3E%3C/svg%3E");
}
.cxp-form-response.is-error::before {
    display: inline-block;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23d63638'%3E%3Cpath d='M10 0a10 10 0 100 20 10 10 0 000-20zm0 14a1 1 0 110 2 1 1 0 010-2zm0-10a1 1 0 011 1v6a1 1 0 11-2 0V5a1 1 0 011-1z'/%3E%3C/svg%3E");
}
.cxp-form-response.is-validation::before {
    display: inline-block;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23f59e0b'%3E%3Cpath d='M9.1 1.5a1 1 0 011.8 0l8 14A1 1 0 0118 17H2a1 1 0 01-.9-1.5l8-14zM10 7a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1zm0 8a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E");
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    .cxp-form .cxp-file-dropzone { padding: 24px 12px; }
    .cxp-form .cf7-submit { width: 100%; justify-content: center; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .cxp-form *,
    .cxp-form *::before,
    .cxp-form *::after { animation: none !important; transition: none !important; }
}

/* ---------- Dark mode ----------
   v1.0.2: the automatic @media (prefers-color-scheme: dark) theming was removed.
   An embedded form should match the design of the page it sits in, not the
   visitor's OS setting. When a form was placed in a light section but the
   visitor's browser was in dark mode, the auto-dark palette flipped the label
   ink light while the host background stayed light, leaving field labels
   (First Name, Email, ...) unreadable. Forms now always use the readable light
   token set; sites that want a dark form can theme .cxp-form explicitly. */

/* ============================================================
   v0.9.4 multi-step wizard chrome
   ============================================================ */
.cxp-form .cxp-wizard { margin-bottom: 20px; }
.cxp-form .cxp-wizard-progress {
    display: flex; flex-wrap: wrap; gap: 8px;
    list-style: none; margin: 0 0 20px; padding: 0;
}
.cxp-form .cxp-wizard-step-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px 6px 6px;
    background: var(--cxp-c-field-bg, #fff);
    border: 1px solid var(--cxp-c-line, #e5e9ee);
    border-radius: 999px;
    font-size: 13px; font-weight: 600;
    color: var(--cxp-c-ink-3, #6b7785);
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cxp-form .cxp-wizard-step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    background: var(--cxp-c-line, #e5e9ee);
    color: var(--cxp-c-ink-2, #344152);
    border-radius: 999px;
    font-size: 12px; font-weight: 700;
}
.cxp-form .cxp-wizard-step-pill.is-active {
    background: var(--cxp-c-accent-bg, rgba(0,255,153,.08));
    border-color: var(--cxp-c-accent-dk, #00cc7a);
    color: var(--cxp-c-ink, #0b1929);
}
.cxp-form .cxp-wizard-step-pill.is-active .cxp-wizard-step-num {
    background: var(--cxp-c-accent, #00ff99);
    color: #0b1929;
}
.cxp-form .cxp-wizard-step-pill.is-complete {
    background: #f1f5f9;
    border-color: var(--cxp-c-accent-dk, #00cc7a);
    color: var(--cxp-c-ink, #0b1929);
}
.cxp-form .cxp-wizard-step-pill.is-complete .cxp-wizard-step-num::after {
    content: ""; display: inline-block;
}
.cxp-form .cxp-wizard-step-pill.is-complete .cxp-wizard-step-num {
    background: var(--cxp-c-accent-dk, #00cc7a);
    color: #fff;
}
.cxp-form .cxp-wizard-step[hidden] { display: none; }
.cxp-form .cxp-wizard-nav {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--cxp-c-line, #e5e9ee);
}
.cxp-form .cxp-wizard-nav .cxp-btn-ghost { margin-right: auto; }
.cxp-form .cxp-wizard-nav .cxp-wizard-next { margin-left: auto; }
.cxp-form .cxp-conditional-hidden { display: none !important; }
.cxp-form .cxp-invalid { border-color: var(--cxp-c-error, #d63638) !important; box-shadow: 0 0 0 3px rgba(214,54,56,.12) !important; }

@media (max-width: 540px) {
    .cxp-form .cxp-wizard-step-pill { padding: 4px 10px 4px 4px; font-size: 12px; }
    .cxp-form .cxp-wizard-step-name { display: none; }
}

/* v0.11 signature field. Rendered as a bounded canvas with a Clear
 * button beneath. Touch-action: none on the canvas so mobile gestures
 * draw instead of scrolling the page during a signature.
 */
.cxp-signature {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.cxp-signature-pad {
    width: 100%;
    max-width: 500px;
    height: 160px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}
.cxp-signature-actions {
    display: flex;
    justify-content: flex-end;
    max-width: 500px;
}
.cxp-signature-clear {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
}
.cxp-signature-clear:hover { background: #f1f5f9; }

/* v0.11 form-closed message - shown by the availability gate when a
 * form is paused, outside its open window, or has hit its submission
 * cap. Sized like a regular form so it doesn't look like a 404.
 */
.cxp-form-closed {
    padding: 28px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    text-align: center;
}
.cxp-form-closed-message { max-width: 480px; margin: 0 auto; }

/* v0.11.33 (AC1): inline field error spans. Screen readers pick these
   up via aria-describedby; sighted users see red text just under the
   field. Hidden by default; frontend.js toggles hidden + sets text. */
.cxp-field-error { display:block; color:#b91c1c; font-size:12px; margin-top:4px; min-height:1em; }
.cxp-field-error[hidden] { display:none; }
.cxp-form-error-summary { background:#fef2f2; border-left:3px solid #b91c1c; padding:10px 14px; margin:8px 0; color:#7f1d1d; font-size:14px; border-radius:6px; }
.cxp-form-error-summary[hidden] { display:none; }
/* v0.11.33 visible focus indicators for keyboard users. */
.cxp-form input:focus-visible, .cxp-form textarea:focus-visible, .cxp-form select:focus-visible, .cxp-form button:focus-visible { outline:2px solid #1d4ed8; outline-offset:2px; }

.cxp-error-summary-link { color:#7f1d1d; text-decoration:underline; font-weight:600; cursor:pointer; }
.cxp-error-summary-link:hover { color:#b91c1c; }
