/* АКАДИ — виджет-квиз (свой, без Marquiz) */

.acadi-quiz {
    --aq-pink: #e91e8c;
    --aq-pink-hover: #d1187d;
    --aq-ink: #1a1a1a;
    --aq-muted: #6b7280;
    --aq-line: #e5e7eb;
    --aq-footer: #3d3d3d;
    --aq-radius: 12px;
    font-family: var(--acadi-font, 'Inter', 'Segoe UI', system-ui, sans-serif);
    z-index: 2147483640;
}

/* —— Плашка (раскрытая) —— */
.acadi-quiz__teaser {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: min(350px, calc(100vw - 32px));
    background: #fff;
    border-radius: var(--aq-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    z-index: 2147483645;
}

.acadi-quiz__teaser[hidden],
.acadi-quiz__tab[hidden],
.acadi-quiz__modal[hidden] {
    display: none !important;
}

.acadi-quiz__teaser-img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.acadi-quiz__teaser-body {
    padding: 1rem 1.1rem 1.1rem;
}

.acadi-quiz__teaser-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--aq-ink);
}

.acadi-quiz__teaser-text {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--aq-muted);
}

.acadi-quiz__teaser-btn {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--aq-pink);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.acadi-quiz__teaser-btn:hover {
    background: var(--aq-pink-hover);
}

.acadi-quiz__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #666;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acadi-quiz__close:hover {
    background: #fff;
    color: #111;
}

/* —— Узкая вкладка —— */
.acadi-quiz__tab {
    position: fixed;
    right: 0;
    bottom: 16px;
    max-width: min(280px, 42vw);
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: none;
    border-radius: var(--aq-radius) 0 0 var(--aq-radius);
    background: #3d3d3d;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 2147483644;
}

.acadi-quiz__tab::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 48px;
    height: 28px;
    background: var(--aq-pink);
    border-radius: 28px 28px 0 0;
    transform: translateY(50%);
}

.acadi-quiz__tab-icon {
    position: absolute;
    right: 14px;
    bottom: 2px;
    color: #fff;
    font-size: 0.9rem;
    z-index: 1;
}

/* —— Модалка квиза —— */
.acadi-quiz__modal {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.acadi-quiz__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(420px, 100%);
    max-height: min(640px, calc(100vh - 2rem));
    background: #fff;
    border-radius: var(--aq-radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.acadi-quiz__panel-close {
    top: 12px;
    right: 12px;
}

.acadi-quiz__head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 3rem 0.75rem 1rem;
    border-bottom: 1px solid var(--aq-line);
    flex-shrink: 0;
}

.acadi-quiz__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #e46a17);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.acadi-quiz__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.acadi-quiz__manager-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--aq-ink);
}

.acadi-quiz__manager-role {
    margin: 0;
    font-size: 0.8rem;
    color: var(--aq-muted);
}

.acadi-quiz__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.1rem 1rem;
}

.acadi-quiz__step-title {
    margin: 0 0 0.65rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--aq-ink);
}

.acadi-quiz__step-desc {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--aq-muted);
}

.acadi-quiz__options {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.acadi-quiz__option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--aq-line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.acadi-quiz__option:hover {
    border-color: #d1d5db;
    background: #fafafa;
}

.acadi-quiz__option.is-selected {
    border-color: var(--aq-pink);
    background: #fdf2f8;
}

.acadi-quiz__option input {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--aq-pink);
    cursor: pointer;
}

.acadi-quiz__option span {
    font-size: 0.92rem;
    color: var(--aq-ink);
    line-height: 1.35;
}

/* —— Форма контактов —— */
.acadi-quiz__contact-brand {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    color: var(--aq-ink);
}

.acadi-quiz__contact-sub {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    text-align: center;
    color: var(--aq-muted);
}

.acadi-quiz__field {
    margin-bottom: 1rem;
}

.acadi-quiz__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--aq-ink);
}

.acadi-quiz__label-hint {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--aq-muted);
}

.acadi-quiz__input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--aq-line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.acadi-quiz__input:focus {
    outline: none;
    border-color: var(--aq-pink);
    box-shadow: 0 0 0 3px rgba(233, 30, 140, 0.12);
}

.acadi-quiz__input.is-error {
    border-color: #dc2626;
}

.acadi-quiz__consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--aq-muted);
}

.acadi-quiz__consent input {
    margin-top: 0.15rem;
    accent-color: var(--aq-pink);
}

.acadi-quiz__consent a {
    color: var(--aq-pink);
}

.acadi-quiz__error {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: #dc2626;
}

/* —— Спасибо —— */
.acadi-quiz__thanks {
    text-align: center;
    padding: 2rem 1rem;
}

.acadi-quiz__thanks-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--aq-ink);
}

.acadi-quiz__thanks-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--aq-muted);
}

/* —— Подвал модалки —— */
.acadi-quiz__foot {
    flex-shrink: 0;
    padding: 0.85rem 1rem 1rem;
    background: var(--aq-footer);
    color: #fff;
}

.acadi-quiz__progress-label {
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
}

.acadi-quiz__progress-bar {
    height: 4px;
    margin-bottom: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.acadi-quiz__progress-fill {
    height: 100%;
    background: var(--aq-pink);
    border-radius: 4px;
    transition: width 0.25s ease;
}

.acadi-quiz__nav {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
}

.acadi-quiz__btn-next[hidden] {
    display: none !important;
}

.acadi-quiz__btn-back {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.acadi-quiz__btn-back:disabled {
    opacity: 0.35;
    cursor: default;
}

.acadi-quiz__btn-next {
    flex: 1;
    max-width: 200px;
    height: 44px;
    padding: 0 1.25rem;
    border: none;
    border-radius: 8px;
    background: var(--aq-pink);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.acadi-quiz__btn-next:hover:not(:disabled) {
    background: var(--aq-pink-hover);
}

.acadi-quiz__btn-next:disabled {
    opacity: 0.45;
    cursor: default;
}

/* —— Мини «Спасибо» после отправки —— */
.acadi-quiz__mini-thanks {
    position: fixed;
    right: 16px;
    bottom: 16px;
    max-width: 280px;
    padding: 0.85rem 1.1rem;
    background: #fff;
    border-radius: var(--aq-radius);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
    color: var(--aq-ink);
    z-index: 2147483643;
}

.acadi-quiz__mini-thanks-title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
}

.acadi-quiz__mini-thanks-text {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--aq-muted, #5c6570);
}

/* FAB главной 3 — не перекрывает квиз */
body[data-acadi-quiz] .home-v3-fab {
    left: 1.25rem;
    right: auto;
    align-items: flex-start;
    z-index: 100;
}

@media (max-width: 600px) {
    .acadi-quiz__teaser {
        right: 8px;
        bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
        width: min(300px, calc(100vw - 16px));
    }

    .acadi-quiz__teaser-img {
        height: 120px;
    }

    .acadi-quiz__teaser-body {
        padding: 0.75rem 0.9rem 0.9rem;
    }

    .acadi-quiz__teaser-title {
        font-size: 0.95rem;
    }

    .acadi-quiz__teaser-text {
        font-size: 0.82rem;
        margin-bottom: 0.75rem;
    }

    .acadi-quiz__teaser-btn {
        padding: 0.7rem 0.85rem;
        font-size: 0.92rem;
    }

    .acadi-quiz__modal {
        padding: 0;
        align-items: flex-end;
    }

    .acadi-quiz__panel {
        width: 100%;
        max-height: 92vh;
        border-radius: var(--aq-radius) var(--aq-radius) 0 0;
    }
}

@media (max-width: 480px) {
    .acadi-quiz__teaser {
        width: min(280px, calc(100vw - 16px));
    }
}
