/* ================================================================
   Quiz Pro — Modern UI v2.0
================================================================ */
.qp-overlay *, .qp-overlay *::before, .qp-overlay *::after {
    box-sizing: border-box;
}

/* ---------- Overlay ---------- */
.qp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15,15,30,0.75);
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.qp-overlay.qp-open {
    display: flex;
    animation: qpFadeIn .2s ease;
}
@keyframes qpFadeIn { from { opacity:0 } to { opacity:1 } }

/* ---------- Modal ---------- */
.qp-modal {
    position: relative;
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 28px 80px rgba(0,0,0,.25);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    animation: qpSlideUp .3s cubic-bezier(.34,1.4,.64,1);
}
@keyframes qpSlideUp {
    from { transform: translateY(50px) scale(.96); opacity:0 }
    to   { transform: translateY(0)    scale(1);   opacity:1 }
}
.qp-modal::-webkit-scrollbar { width: 4px; }
.qp-modal::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* ---------- Progress ---------- */
.qp-progress-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
}
.qp-progress-bar {
    height: 3px;
    background: #f3f4f6;
}
.qp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b6ef5, #818cf8);
    transition: width .4s ease;
    border-radius: 0 2px 2px 0;
}
.qp-progress-text { display: none; }

/* ---------- Header ---------- */
.qp-header {
    padding: 28px 24px 0;
    text-align: center;
    position: relative;
}
.qp-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.qp-close:hover { background: #e5e7eb; color: #111; }

.qp-logo { max-width: 72px; max-height: 72px; border-radius: 16px; margin: 0 auto 16px; display: block; object-fit: contain; }
.qp-modal-logo { text-align: center; padding: 20px 0 0; }
.qp-modal-logo img { max-width: 64px; max-height: 64px; border-radius: 14px; object-fit: contain; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.qp-header-title { font-size: 20px; font-weight: 700; color: #1a1a2e; margin: 0 0 6px; line-height: 1.3; }
.qp-header-subtitle { font-size: 13px; color: #6b7280; line-height: 1.5; margin: 0; }

/* ---------- Body ---------- */
.qp-body { padding: 20px 24px 0; }

/* ---------- Steps — hidden by default, shown by JS ---------- */
.qp-step { display: none; }
.qp-step.qp-active { display: block; animation: qpStepIn .22s ease; }
@keyframes qpStepIn {
    from { opacity:0; transform: translateX(20px) }
    to   { opacity:1; transform: translateX(0) }
}

.qp-step-question { font-size: 17px; font-weight: 700; color: #1a1a2e; margin: 0 0 6px; line-height: 1.35; }
.qp-step-description { font-size: 13px; color: #6b7280; margin: 0 0 16px; line-height: 1.5; }
.qp-step-image { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; margin-bottom: 16px; }

/* ---------- Options (radio/checkbox) ---------- */
.qp-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.qp-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    background: #fff;
    user-select: none;
}
.qp-option:hover { border-color: #5b6ef5; background: #f0f2ff; transform: translateX(2px); }
.qp-option.qp-selected { border-color: #5b6ef5; background: #f0f2ff; }
.qp-option-dot {
    width: 18px; height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
    position: relative;
}
.qp-option.qp-selected .qp-option-dot {
    border-color: #5b6ef5;
    background: #5b6ef5;
}
.qp-option.qp-selected .qp-option-dot::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 7px; height: 7px;
    background: #fff;
    border-radius: 50%;
}
/* Checkbox */
.qp-option.qp-option-check .qp-option-dot { border-radius: 5px; }
.qp-option.qp-option-check.qp-selected .qp-option-dot::after {
    content: '✓';
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: none;
    border-radius: 0;
    width: auto; height: auto;
}
.qp-option-img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.qp-option-text { font-size: 14px; font-weight: 500; color: #1a1a2e; flex: 1; }

/* ---------- Image options grid ---------- */
.qp-image-options { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 4px; }
@media (max-width: 400px) { .qp-image-options { grid-template-columns: 1fr; } }
.qp-image-option {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
    text-align: center;
}
.qp-image-option:hover { border-color: #5b6ef5; transform: scale(1.02); }
.qp-image-option.qp-selected { border-color: #5b6ef5; }
.qp-image-option img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    display: block;
    background: #f8fafc;
    padding: 4px;
}
.qp-image-option-text { padding: 7px 8px; font-size: 13px; font-weight: 500; color: #1a1a2e; }

/* ---------- Inputs ---------- */
.qp-field { margin-bottom: 4px; }
.qp-field-error { font-size: 12px; color: #ef4444; margin-top: 4px; min-height: 16px; display: none; }
.qp-field-error.qp-visible { display: block; }
/* Required step error banner */
.qp-step-error-banner {
    display: none;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    animation: qpShake .3s ease;
}
.qp-step-error-banner.qp-visible { display: block; }
@keyframes qpShake {
    0%,100% { transform: translateX(0); }
    20%,60%  { transform: translateX(-6px); }
    40%,80%  { transform: translateX(6px); }
}
/* Error input highlight */
.qp-input.qp-error, .qp-textarea.qp-error, .qp-select.qp-error {
    border-color: #ef4444;
}
.qp-input, .qp-textarea, .qp-select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
.qp-input:focus, .qp-textarea:focus, .qp-select:focus { border-color: #5b6ef5; }
.qp-textarea { resize: vertical; min-height: 90px; }
.qp-select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

/* ---------- Range ---------- */
.qp-range-wrap { padding: 4px 0; }
.qp-range { width: 100%; accent-color: #5b6ef5; cursor: pointer; }
.qp-range-value { text-align: center; font-size: 28px; font-weight: 800; color: #5b6ef5; margin: 8px 0 4px; }
.qp-range-unit { font-size: 16px; font-weight: 500; color: #6b7280; margin-left: 4px; }
.qp-range-labels { display: flex; justify-content: space-between; font-size: 12px; color: #9ca3af; margin-top: 4px; }

/* ---------- Contacts ---------- */
.qp-contacts { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Consent ---------- */
.qp-consent {
    display: flex; align-items: flex-start; gap: 10px;
    margin-top: 14px; padding: 12px; background: #f9fafb;
    border-radius: 10px; font-size: 12px; color: #6b7280;
}
.qp-consent input { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; accent-color: #5b6ef5; cursor: pointer; }
.qp-consent a { color: #5b6ef5; }

/* ---------- Welcome ---------- */
.qp-welcome { text-align: center; padding: 0; }
.qp-welcome-hero {
    width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    text-align: center;
}
.qp-welcome-hero img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
}
.qp-welcome-img { max-width: 80px; max-height: 80px; border-radius: 18px; margin: 0 auto 16px; display: block; object-fit: contain; box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.qp-welcome-title { font-size: 22px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px; }
.qp-welcome-text { font-size: 14px; color: #6b7280; line-height: 1.6; }

/* ---------- Success ---------- */
.qp-step-success { text-align: center; padding: 24px 0 8px; }
.qp-success-icon { font-size: 54px; margin-bottom: 14px; display: block; }
.qp-success-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.qp-success-text { font-size: 14px; color: #6b7280; line-height: 1.6; }

/* ---------- Footer ---------- */
.qp-footer {
    padding: 18px 24px 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Buttons ---------- */
.qp-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 13px 22px; border-radius: 12px;
    font-size: 15px; font-weight: 600; font-family: inherit;
    border: none; cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    line-height: 1;
}
.qp-btn:active { transform: scale(.96); }
.qp-btn:disabled { opacity: .5; cursor: not-allowed; }
.qp-btn-primary {
    background: #5b6ef5; color: #fff; flex: 1;
    box-shadow: 0 4px 14px rgba(91,110,245,.4);
}
.qp-btn-primary:hover:not(:disabled) { background: #4757e8; box-shadow: 0 6px 20px rgba(91,110,245,.5); }
.qp-btn-secondary {
    background: #f3f4f6; color: #6b7280; padding: 13px 14px;
}
.qp-btn-secondary:hover:not(:disabled) { background: #e5e7eb; color: #1a1a2e; }

/* ---------- Block mode ---------- */
.qp-block {
    border-radius: 16px; border: 1px solid #e5e7eb;
    background: #fff; font-family: inherit;
    box-shadow: 0 4px 20px rgba(0,0,0,.06);
    overflow: hidden;
}

/* ---------- Honeypot ---------- */
.qp-hp { display: none !important; }

/* ---------- Mobile ---------- */
@media (max-width: 540px) {
    .qp-overlay.qp-open { align-items: flex-end; padding: 0; }
    .qp-modal { border-radius: 20px 20px 0 0; max-height: 96vh; }
    .qp-header { padding: 22px 18px 0; }
    .qp-body { padding: 18px 18px 0; }
    .qp-footer { padding: 14px 18px 20px; }
}

/* Step image */
.qp-step-image-wrap {
    width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    text-align: center;
}
.qp-step-image {
    width: 230px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    height: auto;
}

/* File upload step */
.qp-upload-area {
    display: block;
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafbff;
}
.qp-upload-area:hover { border-color: #5b6ef5; background: #f0f2ff; }
.qp-upload-icon { margin-bottom: 10px; }
.qp-upload-text { font-size: 14px; color: #64748b; }
.qp-upload-name { font-size: 13px; color: #5b6ef5; font-weight: 600; margin-top: 8px; }
