/**
 * Delveant Forms - Public Styles
 * @version 1.0.0
 */

/* ============================================================
   Form Container
   ============================================================ */
.df-form-wrap {
    --df-accent:       #2271b1;
    --df-accent-dark:  #135e96;
    --df-error:        #d63638;
    --df-success:      #00a32a;
    --df-border:       #c3c4c7;
    --df-border-focus: #2271b1;
    --df-bg:           #fff;
    --df-text:         #1d2327;
    --df-muted:        #646970;
    --df-radius:       6px;
    font-family: inherit;
    color: var(--df-text);
}

/* ============================================================
   Field Wrap & Spacing
   ============================================================ */
.df-field-spacing .df-field-wrap {
    margin-bottom: 18px;
}

.df-field-spacing .df-field-wrap:last-child {
    margin-bottom: 0;
}

.df-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--df-text);
}

.df-required {
    color: var(--df-error);
    margin-left: 2px;
}

/* ============================================================
   Inputs
   ============================================================ */
.df-input,
.df-select,
.df-textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1.5px solid var(--df-border);
    border-radius: var(--df-radius);
    font-size: 14px;
    color: var(--df-text);
    background: var(--df-bg);
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.5;
    appearance: none;
}

.df-input:focus,
.df-select:focus,
.df-textarea:focus {
    outline: none;
    border-color: var(--df-border-focus);
    box-shadow: 0 0 0 3px rgba(34,113,177,.18);
}

.df-input.df-invalid,
.df-select.df-invalid,
.df-textarea.df-invalid {
    border-color: var(--df-error);
    box-shadow: 0 0 0 3px rgba(214,54,56,.12);
}

.df-input.df-valid,
.df-select.df-valid,
.df-textarea.df-valid {
    border-color: var(--df-success);
}

.df-input::placeholder,
.df-textarea::placeholder { color: #a0a0a0; }

.df-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Select arrow */
.df-select-wrap {
    position: relative;
}

.df-select-wrap::after {
    content: '▾';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--df-muted);
    font-size: 12px;
}

/* ============================================================
   Radio & Checkbox
   ============================================================ */
.df-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
    /* Keep as block — flex on <fieldset> is unreliable across themes */
}

.df-legend {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--df-text);
    padding: 0;
    width: 100%;
}

.df-radio-label,
.df-checkbox-label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    user-select: none;
    margin-bottom: 8px;
}

.df-radio-label:last-of-type,
.df-checkbox-label:last-of-type {
    margin-bottom: 0;
}

.df-radio-label input[type="radio"],
.df-checkbox-label input[type="checkbox"] {
    /* Reset appearance so theme CSS can't hide the native control */
    -webkit-appearance: auto;
    appearance: auto;
    /* Explicit dimensions guard against theme width:100% resets */
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    box-sizing: content-box;
    opacity: 1;
    visibility: visible;
    position: static;
    accent-color: var(--df-accent);
    cursor: pointer;
}

/* Acceptance checkbox */
.df-acceptance-wrap {
    padding: 10px 14px;
    background: #f8f9fa;
    border: 1px solid var(--df-border);
    border-radius: var(--df-radius);
}

/* Label wraps the checkbox — prevents theme "input + label::before" patterns
   from injecting a second visual checkbox next to the native one. */
.df-acceptance-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
}

.df-acceptance-label::before,
.df-acceptance-label::after {
    display: none !important;
    content: none !important;
}

.df-acceptance-label input[type="checkbox"] {
    -webkit-appearance: auto;
    appearance: auto;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin-top: 3px;
    padding: 0;
    box-sizing: content-box;
    opacity: 1;
    visibility: visible;
    position: static;
    accent-color: var(--df-accent);
    cursor: pointer;
}

.df-acceptance-text { font-size: 14px; line-height: 1.5; color: var(--df-text); }

/* Cloudflare Turnstile widget wrapper — keeps it compact */
.df-turnstile-widget {
    margin: 8px 0;
    min-height: 0;
}

/* Google reCAPTCHA v2 widget wrapper */
.df-recaptcha-v2-widget {
    margin: 8px 0;
}

/* ============================================================
   File Upload
   ============================================================ */
.df-file-wrap {
    border: 2px dashed var(--df-border);
    border-radius: var(--df-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}

.df-file-wrap:hover,
.df-file-wrap.dragover {
    border-color: var(--df-accent);
    background: rgba(34,113,177,.04);
}

.df-file-wrap input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.df-file-icon { font-size: 28px; margin-bottom: 6px; opacity: .5; }
.df-file-text { font-size: 13px; color: var(--df-muted); }
.df-file-text strong { color: var(--df-accent); }
.df-file-name { margin-top: 8px; font-size: 12px; font-weight: 500; color: var(--df-text); }

/* ============================================================
   Validation Messages
   ============================================================ */
.df-field-error {
    display: none;
    font-size: 12px;
    color: var(--df-error);
    margin-top: 5px;
    align-items: center;
    gap: 5px;
}

.df-field-error:not(:empty) {
    display: flex;
}

.df-field-error::before {
    content: '⚠';
    font-size: 13px;
    flex-shrink: 0;
}

/* ============================================================
   Submit Button
   ============================================================ */
.df-submit-wrap {
    margin-top: 20px;
}

.df-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    background: var(--df-accent);
    color: #fff;
    border: none;
    border-radius: var(--df-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s, opacity .2s;
    line-height: 1;
    position: relative;
    overflow: hidden;
}

.df-submit-btn:hover:not(:disabled) {
    background: var(--df-accent-dark);
    box-shadow: 0 4px 12px rgba(34,113,177,.35);
}

.df-submit-btn:active:not(:disabled) { transform: scale(.98); }

.df-submit-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* Loading text + three-dot animation */
.df-btn-loading { display: none; }

.df-submit-btn.loading .df-btn-text    { display: none; }
.df-submit-btn.loading .df-btn-loading { display: inline-block; }

.df-submit-btn.loading .df-btn-loading::after {
    content: '...';
    display: inline-block;
    overflow: hidden;
    width: 0;
    vertical-align: bottom;
    animation: df-loading-dots 1.4s steps(4, end) infinite;
}

@keyframes df-loading-dots { to { width: 1.4em; } }

/* ============================================================
   Form Messages
   ============================================================ */
.df-form-messages {
    padding: 16px 20px;
    border-radius: var(--df-radius);
    font-size: 14px;
    line-height: 1.55;
    margin-top: 20px;
    display: none;
    align-items: center;
    gap: 14px;
    border: 1px solid transparent;
    border-left-width: 4px;
}

.df-form-messages.visible {
    display: flex;
    animation: df-fadein .3s ease;
}

.df-form-messages.success {
    background: #f0fdf4;
    color: #15803d;
    border-color: #86efac;
    border-left-color: #22c55e;
    box-shadow: 0 2px 8px rgba(34, 197, 94, .10);
}

.df-form-messages.error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
    border-left-color: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, .10);
}

.df-form-message-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes df-fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Multi-step
   ============================================================ */
.df-step-indicators {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 0;
}

.df-step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    flex: 1;
}

.df-step-dot:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--df-border);
    z-index: 0;
}

.df-step-dot.completed::after { background: var(--df-accent); }

.df-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--df-border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--df-muted);
    z-index: 1;
    transition: all .2s;
}

.df-step-dot.active .df-step-circle {
    border-color: var(--df-accent);
    background: var(--df-accent);
    color: #fff;
}

.df-step-dot.completed .df-step-circle {
    border-color: var(--df-success);
    background: var(--df-success);
    color: #fff;
}

.df-step-label { font-size: 11px; color: var(--df-muted); white-space: nowrap; }
.df-step-dot.active .df-step-label { color: var(--df-accent); font-weight: 600; }

.df-step-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.df-step-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--df-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--df-border);
    background: #fff;
    color: var(--df-text);
    transition: all .15s;
}

.df-step-btn:hover { background: #f0f0f0; }
.df-step-btn.next { background: var(--df-accent); border-color: var(--df-accent); color: #fff; }
.df-step-btn.next:hover { background: var(--df-accent-dark); }

/* ============================================================
   Conditional field animation
   ============================================================ */
.df-field-group.df-hidden {
    display: none;
}

.df-field-group.df-show-anim {
    animation: df-show .2s ease;
}

@keyframes df-show { from { opacity: 0; height: 0; } to { opacity: 1; } }

/* ============================================================
   Visibility utility
   ============================================================ */
.df-hidden { display: none !important; }

/* ============================================================
   Honeypot - must be hidden from humans via CSS so the inline
   style attribute can be omitted from the rendered HTML.
   ============================================================ */
.df-hp-field {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================================
   reCAPTCHA row
   ============================================================ */
.df-recaptcha-wrap {
    margin-bottom: 14px;
}

/* ============================================================
   Progress bar (file upload / multi-step)
   ============================================================ */
.df-progress {
    height: 4px;
    background: var(--df-border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.df-progress-bar {
    height: 100%;
    background: var(--df-accent);
    border-radius: 2px;
    transition: width .3s ease;
    width: 0;
}

/* ============================================================
   Block field (collapsible container)
   ============================================================ */
.df-block {
    border: 1px solid var(--df-border);
    border-radius: var(--df-radius);
    overflow: hidden;
    margin-bottom: 0;
}

.df-field-spacing .df-field-wrap.df-field-block {
    margin-bottom: 18px;
}

.df-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: #f6f7f7;
    border: none;
    border-bottom: 1px solid var(--df-border);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--df-text);
    gap: 8px;
    transition: background .15s ease;
}

.df-block-header:hover {
    background: #ebebec;
}

.df-block-header[aria-expanded="false"] {
    border-bottom-color: transparent;
}

.df-block-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.df-block-toggle-icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
    font-weight: 400;
    color: var(--df-muted);
    width: 20px;
    text-align: center;
}

.df-block-body {
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.df-block-body .df-field-wrap {
    margin-bottom: 18px;
}

.df-block-body .df-field-wrap:last-child {
    margin-bottom: 0;
}

.df-block-description {
    flex: 1;
    font-size: 12px;
    font-weight: 400;
    color: var(--df-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 8px;
}

.df-block-header--static {
    cursor: default;
    pointer-events: none;
}
.df-block-header--static:hover {
    background: #f6f7f7;
}
