/* =========================================================
   Form Wizard — base & layout
   ========================================================= */
:root {
    --wz-primary: #3b5bfd;
    --wz-primary-dark: #2c46d8;
    --wz-primary-soft: #eaeefe;
    --wz-bg: #f4f6fb;
    --wz-surface: #ffffff;
    --wz-text: #1c2333;
    --wz-text-soft: #6b7280;
    --wz-border: #e4e8f0;
    --wz-danger: #e23b53;
    --wz-success: #1faf6b;
    --wz-radius: 16px;
    --wz-radius-sm: 10px;
    --wz-shadow: 0 6px 24px rgba(28, 35, 51, 0.08);
    --wz-footer-h: 76px;
    --wz-topbar-h: 64px;
    --wz-error-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%202a10%2010%200%20100%2020%2010%2010%200%20000-20zm0%205a1%201%200%20011%201v5a1%201%200%2001-2%200V8a1%201%200%20011-1zm0%2011a1.25%201.25%200%20110-2.5%201.25%201.25%200%20010%202.5z'/%3E%3C/svg%3E");
}


* {
    box-sizing: border-box;
    font-family: inherit;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
    background: var(--wz-bg);
    color: var(--wz-text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

/* App shell: column with sticky header and footer */
.wz-app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* =========================================================
   Top progress bar
   ========================================================= */
.wz-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--wz-surface);
    border-bottom: 1px solid var(--wz-border);
    padding-top: env(safe-area-inset-top);
}

.wz-topbar-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 14px 18px 12px;
}

.wz-topbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.wz-step-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--wz-text);
}

.wz-percent {
    font-size: 13px;
    font-weight: 700;
    color: var(--wz-primary);
}

.wz-progress-bar {
    height: 8px;
    border-radius: 99px;
    background: var(--wz-primary-soft);
    overflow: hidden;
}

.wz-progress-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--wz-primary), #6a83ff);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   Scrollable stage
   ========================================================= */
.wz-stage {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 22px 18px calc(var(--wz-footer-h) + 24px);
}

.wz-stage-inner {
    max-width: 640px;
    margin: 0 auto;
}

/* Step transition animation */
.wz-fade {
    animation: wzFade 0.35s ease;
}

@keyframes wzFade {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Loading state
   ========================================================= */
.wz-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 50dvh;
    color: var(--wz-text-soft);
}

.wz-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--wz-primary-soft);
    border-top-color: var(--wz-primary);
    border-radius: 50%;
    animation: wzSpin 0.8s linear infinite;
}

@keyframes wzSpin { to { transform: rotate(360deg); } }

/* =========================================================
   Group header
   ========================================================= */
.wz-group-head {
    margin-bottom: 18px;
}

.wz-group-title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--wz-text);
}

.wz-group-desc {
    margin: 0;
    font-size: 14px;
    color: var(--wz-text-soft);
}

/* =========================================================
   Field card
   ========================================================= */
.wz-field {
    background: var(--wz-surface);
    border: 1px solid var(--wz-border);
    border-radius: var(--wz-radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--wz-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Invalid field state. JS toggles ".wz-field--error" on the wrapper. */
.wz-field.wz-field--error {
    border-color: var(--wz-danger);
    box-shadow: 0 0 0 3px rgba(226, 59, 83, 0.12);
    animation: wz-field-shake 0.3s ease;
}


.wz-field-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.wz-field-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--wz-text);
}

.wz-required-star {
    color: var(--wz-danger);
    font-weight: 700;
}

/* Info/help toggle button */
.wz-info-btn {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--wz-border);
    border-radius: 50%;
    background: var(--wz-surface);
    color: var(--wz-text-soft);
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease,
    background 0.18s ease, box-shadow 0.18s ease;
}

.wz-info-btn:hover {
    border-color: var(--wz-primary);
    color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-info-btn:focus-visible {
    outline: none;
    border-color: var(--wz-primary);
    color: var(--wz-primary);
    box-shadow: 0 0 0 3px var(--wz-primary-soft);
}

.wz-info-btn:active {
    transform: scale(0.92);
}

/* Info help popover */
.wz-info-pop {
    position: absolute;
    z-index: 1000;
    max-width: 260px;
    padding: 10px 12px;
    border: 1px solid var(--wz-border);
    border-radius: 8px;
    background: var(--wz-surface);
    color: var(--wz-text);
    font-size: 12px;
    line-height: 1.6;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    animation: wz-info-fade 0.15s ease;
}

.wz-info-pop-body {
    word-break: break-word;
}

@keyframes wz-info-fade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Collapsible help panel */
.wz-help {
    margin-top: 10px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--wz-text-soft);
    background: #f8f9fd;
    border-radius: var(--wz-radius-sm);
    border: 1px dashed var(--wz-border);
    display: none;
}

.wz-help.is-open { display: block; }

/* =========================================================
   Inputs
   ========================================================= */
.wz-input,
.wz-select,
.wz-textarea {
    width: 100%;
    font: inherit;
    color: var(--wz-text);
    background: var(--wz-surface);
    border: 1.5px solid var(--wz-border);
    border-radius: var(--wz-radius-sm);
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wz-textarea {
    min-height: 96px;
    resize: vertical;
}

.wz-input:focus,
.wz-select:focus,
.wz-textarea:focus {
    border-color: var(--wz-primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.12);
}

.wz-input::placeholder,
.wz-textarea::placeholder {
    color: #aab0bd;
}

/* Error message element. Matches the runtime ".wz-error" node that JS
   toggles via the [hidden] attribute (setError / clearError). */
.wz-error {
    display: none;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--wz-danger);
}

/* Visible state. Using :not([hidden]) so author CSS does not override
   the JS-controlled "hidden" attribute. */
.wz-error:not([hidden]) {
    display: flex;
    animation: wz-error-in 0.22s ease both;
}

/* Recolorable warning icon (uses mask so it follows --wz-danger). */
.wz-error:not([hidden])::before {
    content: "";
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    background-color: currentColor;
    -webkit-mask: var(--wz-error-icon) no-repeat center / contain;
    mask: var(--wz-error-icon) no-repeat center / contain;
}

/* =========================================================
   Radio & Checkbox groups
   ========================================================= */
.wz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wz-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--wz-border);
    border-radius: var(--wz-radius-sm);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.wz-option:hover {
    border-color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--wz-primary);
    cursor: pointer;
}

.wz-option.is-checked {
    border-color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-option-label {
    font-size: 14px;
    color: var(--wz-text);
}

/* =========================================================
   File / camera upload
   ========================================================= */
.wz-upload {
    border: 2px dashed var(--wz-border);
    border-radius: var(--wz-radius);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.wz-upload:hover {
    border-color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-upload.is-dragover {
    border-color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-upload-icon {
    font-size: 30px;
    margin-bottom: 8px;
}

.wz-upload-text {
    font-size: 14px;
    color: var(--wz-text-soft);
}

.wz-upload-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #aab0bd;
}

.wz-upload input[type="file"] { display: none; }

/* Preview grid for uploaded files */
.wz-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.wz-preview-item {
    position: relative;
    border-radius: var(--wz-radius-sm);
    overflow: hidden;
    border: 1px solid var(--wz-border);
    aspect-ratio: 1;
    background: #f0f2f7;
}

.wz-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wz-preview-file {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 24px;
    color: var(--wz-text-soft);
}

.wz-preview-remove {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   Start screen
   ========================================================= */
.wz-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100dvh;
    padding: 32px 22px;
    gap: 18px;
}

.wz-start-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: var(--wz-radius);
}

.wz-start-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--wz-text);
}

.wz-start-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--wz-text-soft);
    max-width: 420px;
}

.wz-start-meta {
    display: flex;
    gap: 18px;
    font-size: 13px;
    color: var(--wz-text-soft);
}

.wz-start-meta b {
    color: var(--wz-primary);
    font-weight: 700;
}

/* =========================================================
   Done / success screen
   ========================================================= */
.wz-done {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100dvh;
    padding: 32px 22px;
    gap: 16px;
}

.wz-done-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--wz-success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    animation: wzPop 0.4s ease;
}

@keyframes wzPop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.wz-done-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--wz-text);
}

.wz-done-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--wz-text-soft);
    max-width: 420px;
}

/* =========================================================
   Fixed footer (navigation)
   ========================================================= */
.wz-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--wz-surface);
    border-top: 1px solid var(--wz-border);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(20, 30, 60, 0.06);
}

.wz-footer-inner {
    display: flex;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto;
}

.wz-btn {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: var(--wz-radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wz-btn:active { transform: scale(0.98); }

.wz-btn-primary {
    background: var(--wz-primary);
    color: #fff;
}

.wz-btn-primary:hover { background: var(--wz-primary-dark); }

.wz-btn-ghost {
    background: var(--wz-primary-soft);
    color: var(--wz-primary);
    flex: 0 0 auto;
    min-width: 110px;
}

.wz-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.wz-btn-primary.is-busy {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.wz-btn-primary.is-busy::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 18px; height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: #fff;
    animation: wz-btn-spin 0.6s linear infinite;
}


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

/* =========================================================
   Step transition animations
   ========================================================= */
.wz-step {
    animation: wzFadeIn 0.32s ease;
}

@keyframes wzFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wz-step-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--wz-text);
    margin-bottom: 4px;
}

.wz-step-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--wz-text-soft);
    margin-bottom: 18px;
}

/* =========================================================
   Loading / spinner
   ========================================================= */
.wz-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wzSpin 0.7s linear infinite;
}

@keyframes wzSpin {
    to { transform: rotate(360deg); }
}

.wz-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wz-loading-overlay .wz-spinner {
    width: 36px;
    height: 36px;
    border-width: 3px;
    border-color: var(--wz-primary-soft);
    border-top-color: var(--wz-primary);
}

/* =========================================================
   Toast / inline messages
   ========================================================= */
.wz-toast {
    position: fixed;
    left: 50%;
    bottom: calc(80px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 60;
    background: var(--wz-text);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--wz-radius-sm);
    font-size: 14px;
    max-width: 90%;
    box-shadow: 0 8px 24px rgba(20, 30, 60, 0.25);
    animation: wzToastIn 0.3s ease;
}

.wz-toast--error { background: var(--wz-danger); }
.wz-toast--success { background: var(--wz-success); }

@keyframes wzToastIn {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* =========================================================
   Responsive (tablet / desktop)
   ========================================================= */
@media (min-width: 640px) {
    .wz-shell {
        max-width: 560px;
        margin: 0 auto;
        box-shadow: 0 10px 40px rgba(20, 30, 60, 0.08);
        border-radius: var(--wz-radius);
        min-height: auto;
        margin-top: 32px;
        margin-bottom: 32px;
    }

    .wz-start,
    .wz-done {
        min-height: 70vh;
    }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .wz-step,
    .wz-done-icon,
    .wz-toast {
        animation: none;
    }
}

/* One-question-per-page layout */
.wz-question {
    max-width: 640px;
    margin: 0 auto;
}

.wz-step-context {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 0.75rem;
}

.wz-fields--single {
    display: block;
}

/* Section breadcrumb in the topbar */
.wz-sections {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.5rem 0 0;
    margin-top: 0.4rem;
    -webkit-overflow-scrolling: touch;
}
.wz-sections::-webkit-scrollbar {
    display: none;
}
.wz-section {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: var(--wz-muted, #9aa0b4);
    opacity: 0.55;
    white-space: nowrap;
    transition: opacity 0.2s ease, color 0.2s ease;
}
.wz-section.is-active {
    opacity: 1;
    color: var(--wz-primary, #4f46e5);
    font-weight: 600;
}
.wz-section-sep {
    flex: 0 0 auto;
    opacity: 0.35;
    font-size: 0.75rem;
}

/* Radio / checkbox choice list */
.wz-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.wz-choice {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--wz-border, #e2e2ef);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.wz-choice:hover {
    border-color: var(--wz-primary, #4f46e5);
    background: var(--wz-hover, rgba(79, 70, 229, 0.04));
}
.wz-choice input {
    accent-color: var(--wz-primary, #4f46e5);
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}
.wz-choice-text {
    flex: 1;
}

.wz-check-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.wz-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 4px;
}
.wz-check-input {
    width: 18px;
    height: 18px;
    accent-color: #4f46e5;
    cursor: pointer;
}
.wz-check-text {
    line-height: 1.4;
}
@keyframes wz-error-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wz-field-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Respect reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
    .wz-error:not([hidden]),
    .wz-field.wz-field--error {
        animation: none;
    }
}

/* Center all topbar rows */
.wz-topbar-main,
.wz-progress,
.wz-sections {
    max-width: 640px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Section breadcrumb in the topbar */
.wz-sections {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0 2px;
    margin-top: 6px;
    border-top: 1px solid var(--wz-border);
}

.wz-sections::-webkit-scrollbar {
    display: none;
}

.wz-section {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--wz-text-soft);
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 99px;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease;
    cursor: default;
}

.wz-section.is-active {
    color: var(--wz-primary);
    font-weight: 700;
    background: var(--wz-primary-soft);
}

.wz-section-sep {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--wz-border);
    user-select: none;
    padding: 0 2px;
}


/* =========================================================
   Fatal error state
   ========================================================= */
.wz-fatal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 50dvh;
    text-align: center;
    padding: 32px 20px;
}

.wz-fatal-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wz-danger), #c72e45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(226, 59, 83, 0.25);
    animation: wzPulse 0.5s ease;
}

@keyframes wzPulse {
    0%   { transform: scale(0.85); opacity: 0; }
    50%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

.wz-fatal-msg {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.6;
    color: var(--wz-text);
    max-width: 360px;
}


/* Section breadcrumb in the topbar */
.wz-sections {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0 2px;
    margin-top: 6px;
    border-top: 1px solid var(--wz-border);
}

.wz-sections::-webkit-scrollbar {
    display: none;
}

.wz-section {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--wz-text-soft);
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 99px;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease;
    cursor: default;
}

.wz-section.is-active {
    color: var(--wz-primary);
    font-weight: 700;
    background: var(--wz-primary-soft);
}

.wz-section-sep {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--wz-border);
    user-select: none;
    padding: 0 2px;
}

.wz-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ff9a56, #4caf50);
    border-radius: inherit;
    transition: width 0.25s ease, filter 0.25s ease;
}

.wz-q-num {
    color: var(--wz-primary);
    font-weight: 700;
    margin-left: 4px;
}

.wz-field-desc {
    margin: 4px 0 10px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--wz-muted, #6b7280);
}

.wz-camera-preview { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.wz-camera-video   { width: 100%; display: block; max-height: 320px; object-fit: cover; }
.wz-camera-controls {
    display: flex; gap: 8px; justify-content: center;
    padding: 10px; background: rgba(0,0,0,0.5);
}
.wz-camera-open { width: 100%; margin-bottom: 8px; }

/* =========================================================
   Camera field
   ========================================================= */
.wz-camera {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---- Live stage (revealed when .is-live) ---- */
.wz-camera-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--wz-radius, 14px);
    overflow: hidden;
    background: #0b0d12;
    display: none;
}

.wz-camera.is-live .wz-camera-stage {
    display: block;
    animation: wzCamIn 0.3s ease;
}

@keyframes wzCamIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.wz-camera-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.wz-camera-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(transparent 55%, rgba(0, 0, 0, 0.5));
}

.wz-cam-controls {
    display: none;
}
.wz-camera.is-live .wz-cam-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 2px;
}


/* Snapshot flash */
.wz-camera-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
}
.wz-camera.is-flash .wz-camera-stage::after {
    animation: wzFlash 0.18s ease;
}
@keyframes wzFlash {
    from { opacity: 0.85; }
    to   { opacity: 0; }
}

/* ===== Face-detection guide (dxCamera with editorOptions.faceDetect) ===== */
/* Transparent guide: outline only, no dark surround. */
.wz-face-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 78%;
    aspect-ratio: 30 / 40;
    transform: translate(-50%, -50%);
    border: 2.5px dashed rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: transparent;
    box-shadow: none; /* removes the black dimming */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    pointer-events: none;
    z-index: 2;
}
.wz-camera.face-bad .wz-face-guide { border-color: #f59e0b; }
.wz-camera.face-ok .wz-face-guide {
    border-style: solid;
    border-color: #22c55e;
    box-shadow: 0 0 16px 2px rgba(34, 197, 94, 0.5);
}

/* Kill the dark bottom gradient while in face mode. */
.wz-camera.wz-face .wz-camera-overlay { background: none; }

.wz-camera.face-bad .wz-face-guide { border-color: #f59e0b; }
.wz-camera.face-ok  .wz-face-guide { border-color: #22c55e; border-style: solid; }

/* Shutter stays locked until a valid face is detected. */
.wz-camera.wz-face .wz-cam-shutter:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.wz-camera.face-ok .wz-cam-shutter {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.45);
}

/* Status hint colors per face state. */
.wz-camera.face-bad .wz-cam-hint { color: #fbbf24; }
.wz-camera.face-ok  .wz-cam-hint { color: #34d399; }


/* ---- Corner controls ---- */
.wz-cam-ctrl {
    position: absolute;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.15s ease, transform 0.12s ease;
}
.wz-cam-ctrl:hover  { background: rgba(0, 0, 0, 0.7); }
.wz-cam-ctrl:active { transform: scale(0.92); }

.wz-cam-close { top: 12px; inset-inline-end: 12px; }
.wz-cam-flip  { bottom: 24px; inset-inline-end: 18px; }

/* ---- Shutter button ---- */
.wz-cam-shutter {
    position: static;
    transform: none;
    width: 66px;
    height: 66px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.wz-cam-shutter-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--wz-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
    transition: transform 0.12s ease;
}
.wz-cam-shutter:active .wz-cam-shutter-ring { transform: scale(0.84); }

.wz-cam-hint {
    position: static;
    transform: none;
    font-size: 12px;
    color: var(--wz-muted, #6b7280);
    text-align: center;
}

/* ---- Open button (fades out + collapses when live) ---- */
.wz-camera-open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 54px;
    padding: 0 16px;
    border-radius: var(--wz-radius, 14px);
    border: 1.5px dashed var(--wz-primary, #6366f1);
    background: rgba(99, 102, 241, 0.08);
    color: var(--wz-primary, #6366f1);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    max-height: 60px;
    transition: opacity 0.25s ease, max-height 0.3s ease,
    margin 0.3s ease, padding 0.3s ease, transform 0.25s ease;
}
.wz-camera-open:hover {
    background: rgba(99, 102, 241, 0.16);
}

.wz-camera.is-live .wz-camera-open {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

/* ---- Thumbs ---- */
.wz-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
}
.wz-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--wz-radius-sm, 10px);
    overflow: hidden;
    border: 1.5px solid var(--wz-border, #e2e5ee);
    background: #f0f2f7;
}
.wz-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wz-thumb-x {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.wz-thumb-x:hover { background: var(--wz-danger, #ef4444); }

/* =========================================================
   Thumbs (captured / uploaded photos)
   ========================================================= */
.wz-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.wz-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--wz-radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--wz-border);
    background: #f0f2f7;
}

.wz-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wz-thumb-x {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.wz-thumb-x:hover {
    background: var(--wz-danger);
}

/* =========================================================
   Responsive adjustments
   ========================================================= */
@media (min-width: 480px) {
    .wz-camera-preview {
        aspect-ratio: 16 / 9;
    }

    .wz-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }
}

@media (max-width: 360px) {
    .wz-camera-controls .wz-btn {
        font-size: 12px;
        padding: 0 6px;
        height: 38px;
    }

    .wz-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    }
}

/* ===== Error summary: mobile-first bottom sheet ===== */
#wz-error-summary[hidden] { display: none; }

/* Keep the last field reachable above the collapsed bar + footer. */
body.wz-has-errsum .wz-stage { padding-bottom: 140px; }

/* Collapsed bar: full-width, sits just above the footer. */
.wz-es-bar {
    position: fixed;
    inset-inline: 0;
    bottom: var(--wz-footer-h, 64px);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-top: 1px solid #f3c4c4;
    background: #fdecec;
    color: #b01919;
    font: inherit;
    font-weight: 700;
    text-align: start;
    cursor: pointer;
}
.wz-es-bar-badge {
    flex: none;
    min-width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0 7px;
    border-radius: 999px;
    background: #d92020;
    color: #fff;
    font-size: 14px;
    line-height: 1;
}
.wz-es-bar-label { flex: 1; font-size: 15px; }
.wz-es-bar-caret { flex: none; font-size: 16px; opacity: .8; }

/* Backdrop + sheet appear only when open. */
.wz-es-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(17, 17, 17, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
}
.wz-es-sheet {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 71;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.22, .61, .36, 1);
}
#wz-error-summary[data-open] .wz-es-bar { display: none; }
#wz-error-summary[data-open] .wz-es-backdrop { opacity: 1; visibility: visible; }
#wz-error-summary[data-open] .wz-es-sheet { transform: translateY(0); }

.wz-es-handle {
    width: 44px;
    height: 5px;
    margin: 10px auto 4px;
    border-radius: 999px;
    background: #d9d9d9;
}
.wz-es-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 18px 8px;
}
.wz-es-title { font-size: 17px; font-weight: 700; color: #b01919; }
.wz-es-title b { font-size: 19px; }
.wz-es-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: #f3f3f3;
    color: #555;
    font-size: 16px;
    cursor: pointer;
}
.wz-es-hint { margin: 0; padding: 0 18px 8px; color: #777; font-size: 13px; }
.wz-es-list {
    list-style: none;
    margin: 0;
    padding: 0 8px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.wz-es-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 10px 12px;
    border-radius: 14px;
    cursor: pointer;
}
.wz-es-item:active { background: #f6f6f6; }
.wz-es-item + .wz-es-item { border-top: 1px solid #f0f0f0; }
.wz-es-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #d92020; }
.wz-es-text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wz-es-label { font-size: 15px; font-weight: 700; color: #222; }
.wz-es-msg { font-size: 13px; color: #b01919; }
.wz-es-go {
    flex: none;
    font-size: 26px;
    line-height: 1;
    color: #c0c0c0;
    transform: scaleX(-1); /* RTL: point the chevron toward the start side */
}

/* Desktop / wide screens: compact floating pill + card. */
@media (min-width: 768px) {
    body.wz-has-errsum .wz-stage { padding-bottom: 0; }
    .wz-es-bar {
        inset-inline: auto;
        inset-inline-end: 24px;
        bottom: 24px;
        width: auto;
        border: 1px solid #f0bcbc;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(217, 32, 32, .18);
    }
    .wz-es-backdrop { background: transparent; }
    .wz-es-sheet {
        inset-inline: auto;
        inset-inline-end: 24px;
        bottom: 24px;
        width: 360px;
        max-height: 60vh;
        border-radius: 16px;
        border: 1px solid #eee;
    }
    .wz-es-handle { display: none; }
}

/* Desktop / wide screens: pill sits above the footer, opens upward. */
@media (min-width: 768px) {
    body.wz-has-errsum .wz-stage { padding-bottom: 0; }

    /* Sit just above the footer's next/previous buttons. */
    .wz-es-bar {
        inset-inline: auto;
        inset-inline-end: 24px;
        bottom: calc(var(--wz-footer-h, 64px) + 16px);
        width: auto;
        border: 1px solid #f0bcbc;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(217, 32, 32, .18);
    }

    .wz-es-backdrop { background: transparent; }

    /* Card grows upward from just above the bar (bottom-anchored). */
    .wz-es-sheet {
        inset-inline: auto;
        inset-inline-end: 24px;
        bottom: calc(var(--wz-footer-h, 64px) + 16px);
        top: auto;
        width: 360px;
        max-height: 60vh;
        border-radius: 16px;
        border: 1px solid #eee;
        transform: translateY(8px); /* closed: slight slide-down + fade */
        opacity: 0;
    }
    #wz-error-summary[data-open] .wz-es-sheet {
        transform: translateY(0);
        opacity: 1;
    }

    .wz-es-handle { display: none; }
}


