/* ===== Form Container ===== */
.qfld-form-container {
    max-width: 640px;
    margin: 20px auto;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* ===== Progress Bar ===== */
.qfld-form-progress {
    padding: 24px 24px 0;
    background: #fafbfc;
    border-bottom: 1px solid #eee;
}

.qfld-form-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.qfld-form-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 60px;
    flex-shrink: 0;
}

.qfld-form-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    background: #fff;
    transition: all 0.3s;
}

.qfld-form-step.active .qfld-form-step-number {
    border-color: #4a6cf7;
    background: #4a6cf7;
    color: #fff;
    box-shadow: 0 2px 8px rgba(74, 108, 247, 0.3);
}

.qfld-form-step.completed .qfld-form-step-number {
    border-color: #4CAF50;
    background: #4CAF50;
    color: #fff;
}

.qfld-form-step-label {
    font-size: 11px;
    color: #999;
    text-align: center;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qfld-form-step.active .qfld-form-step-label {
    color: #4a6cf7;
    font-weight: 600;
}

.qfld-form-step.completed .qfld-form-step-label {
    color: #4CAF50;
}

.qfld-form-step-connector {
    width: 32px;
    height: 2px;
    background: #ddd;
    flex-shrink: 0;
    margin-bottom: 22px;
    transition: background 0.3s;
}

.qfld-form-step-connector.completed {
    background: #4CAF50;
}

/* Progress bar */
.qfld-form-progress-bar {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0;
}

.qfld-form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a6cf7, #7c3aed);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ===== Content Area ===== */
.qfld-form-content {
    padding: 32px 24px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.qfld-form-fade-in {
    animation: qfldFormFadeIn 0.3s ease;
}

@keyframes qfldFormFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.qfld-form-step-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qfld-form-question {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.4;
}

.qfld-form-message {
    font-size: 16px;
    color: #444;
    line-height: 1.6;
}

/* ===== Form Fields ===== */
.qfld-form-field {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafbfc;
}

.qfld-form-field:focus {
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
    background: #fff;
}

.qfld-form-field.qfld-form-error {
    border-color: #F44336;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
    animation: qfldShake 0.4s ease;
}

textarea.qfld-form-field {
    resize: vertical;
}

select.qfld-form-field {
    appearance: auto;
}

.qfld-form-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.qfld-form-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 100%;
    min-width: 0;
    box-sizing: border-box;
}

.qfld-form-field-group.qfld-w-75 { flex: 0 0 calc(75% - 6px); }
.qfld-form-field-group.qfld-w-66 { flex: 0 0 calc(66.666% - 6px); }
.qfld-form-field-group.qfld-w-50 { flex: 0 0 calc(50% - 6px); }
.qfld-form-field-group.qfld-w-33 { flex: 0 0 calc(33.333% - 6px); }
.qfld-form-field-group.qfld-w-25 { flex: 0 0 calc(25% - 6px); }

.qfld-form-field-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* ===== Choice Buttons ===== */
.qfld-form-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qfld-form-choice-btn {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s;
    color: #333;
}

.qfld-form-choice-btn:hover {
    border-color: #4a6cf7;
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.12);
}

.qfld-form-choice-btn.selected {
    border-color: #4a6cf7;
    background: #f0f4ff;
    color: #4a6cf7;
}

.qfld-form-hint {
    font-size: 13px;
    color: #888;
    margin: 0 0 8px 0;
    font-style: italic;
}

/* ===== Image ===== */
.qfld-form-image {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.qfld-form-caption {
    font-size: 14px;
    color: #888;
    margin: 0;
    text-align: center;
}

/* ===== Navigation ===== */
.qfld-form-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #eee;
    background: #fafbfc;
}

.qfld-form-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.qfld-form-btn-back {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.qfld-form-btn-back:hover {
    background: #f5f5f5;
    color: #333;
}

.qfld-form-btn-next {
    background: #4a6cf7;
    color: #fff;
    box-shadow: 0 2px 8px rgba(74, 108, 247, 0.3);
}

.qfld-form-btn-next:hover {
    background: #3a5ce5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.4);
}

/* ===== End / Summary ===== */
.qfld-form-end {
    text-align: center;
    padding: 20px 0;
}

.qfld-form-end-message h3 {
    font-size: 22px;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.qfld-form-summary {
    text-align: left;
    margin-top: 20px;
    background: #fafbfc;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #eee;
}

.qfld-form-summary h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qfld-form-summary-table {
    width: 100%;
    border-collapse: collapse;
}

.qfld-form-summary-table td {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.qfld-form-summary-table tr:last-child td {
    border-bottom: none;
}

.qfld-form-summary-label {
    color: #888;
    width: 40%;
}

.qfld-form-summary-value {
    color: #333;
    font-weight: 500;
}

.qfld-form-total {
    font-size: 18px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #e0e0e0;
    color: #1a1a2e;
    text-align: right;
}

.qfld-form-email-sent {
    color: #4CAF50;
    font-style: italic;
    margin-top: 12px;
    font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .qfld-form-container {
        margin: 10px;
        border-radius: 8px;
    }

    .qfld-form-progress {
        padding: 16px 16px 0;
    }

    .qfld-form-content {
        padding: 24px 16px;
    }

    .qfld-form-nav {
        padding: 12px 16px;
    }

    .qfld-form-question {
        font-size: 18px;
    }

    .qfld-form-step-label {
        display: none;
    }

    .qfld-form-step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ===== Header Text ===== */
.qfld-form-header-text {
    padding: 16px 24px 0;
    background: #fafbfc;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}
.qfld-form-header-text a {
    color: #4A6CF7;
    text-decoration: underline;
}

/* ===== Checkbox Fields ===== */
.qfld-form-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    padding: 4px 0;
}
.qfld-form-checkbox-input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #4A6CF7;
}
.qfld-form-checkbox-label {
    color: #333;
}
.qfld-form-checkbox-label a {
    color: #4A6CF7;
    text-decoration: underline;
}
.qfld-form-required {
    color: #F44336;
}
.qfld-form-field-group.qfld-form-error .qfld-form-checkbox-wrap {
    color: #F44336;
    padding: 8px 10px;
    border: 2px solid #F44336;
    border-radius: 8px;
    background: rgba(244, 67, 54, 0.04);
    animation: qfldShake 0.4s ease;
}
.qfld-form-field-group.qfld-form-error .qfld-form-checkbox-label a {
    color: #F44336;
}

@keyframes qfldShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ===== File Upload ===== */
.qfld-form-file-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.qfld-form-file-input {
    padding: 10px;
    border: 2px dashed #d0d5dd;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    font-size: 14px;
}
.qfld-form-file-input:hover {
    border-color: #4a6cf7;
    background: #f0f4ff;
}
.qfld-form-field-group.qfld-form-error .qfld-form-file-input {
    border-color: #F44336;
}
.qfld-form-file-info {
    font-size: 12px;
    color: #888;
}
.qfld-form-file-status {
    font-size: 13px;
    color: #333;
}
.qfld-form-file-error {
    color: #F44336 !important;
    font-weight: 600;
}

/* ===== Date Field ===== */
.qfld-form-date-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.qfld-form-field[data-field-type="date"] {
    cursor: pointer;
    background: #fafbfc url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>') no-repeat right 12px center;
    padding-right: 36px;
}
