/* ============================================================================
   v0.29 - the registration questionnaire (Components/OnboardingSurveyView) and the compose bar's
   capability hint (Components/ComposeHints).

   THE QUESTIONNAIRE. One question per screen inside ONE card whose size never changes: a fixed
   height with an internal scroll, so no translation, no 11-option question and no finish screen
   moves the frame (owner rule: changing modals do not resize). Max-width 480, inside the 420-520
   band; 94% wide on a phone, 375px being the design width. Logical properties throughout, so
   Hebrew mirrors without a rule of its own.

   THE HINT. Absolutely positioned over the compose slot and shown by CSS alone while the field is
   focused and empty, so the page height never changes (owner rule: Home fits one screen).
   ============================================================================ */

/* ---- the card ------------------------------------------------------------------------------ */

.modal-survey {
    width: 94%;
    min-width: 0;
    max-width: 480px;
    height: min(580px, calc(100vh - 32px));
    height: min(580px, calc(100svh - 32px));
    padding: 0;
    gap: 0;
    overflow: hidden;
    align-items: stretch;
}

/* /studio draws the same card in flow, not over the page. */
.survey-stage {
    display: flex;
    justify-content: center;
}
.survey-stage .modal-survey {
    width: 100%;
    max-width: 480px;
}

.survey-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 6px;
}

.survey-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}
.survey-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--chronos-outline);
    transition: width 0.18s ease, background-color 0.18s ease;
}
.survey-dot.is-done {
    background: color-mix(in srgb, var(--chronos-violet) 45%, var(--chronos-outline));
}
.survey-dot.is-current {
    width: 22px;
    background: var(--chronos-violet);
}

.survey-count {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    color: var(--chronos-fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.survey-skip {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--chronos-fg-muted);
    font: inherit;
    font-size: 13px;
    padding: 6px 4px;
    cursor: pointer;
}
.survey-skip:hover:not(:disabled) { color: var(--chronos-violet); }
.survey-skip:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- the scroll region ---------------------------------------------------------------------- */

.survey-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 8px 20px 14px;
}

.survey-title {
    margin: 0 0 4px;
    font-size: 20px;
    line-height: 1.25;
    color: var(--chronos-fg-primary);
}

.survey-hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--chronos-fg-muted);
}
.survey-hint.is-nudge {
    color: var(--chronos-violet);
    font-weight: 600;
    animation: survey-nudge 0.28s ease;
}
@keyframes survey-nudge {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(-4px); }
    70% { transform: translateX(4px); }
}

.survey-options {
    display: grid;
    gap: 8px;
}

.survey-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--chronos-outline);
    border-radius: 12px;
    background: var(--chronos-card-bg);
    color: var(--chronos-fg-primary);
    font: inherit;
    font-size: 15px;
    line-height: 1.3;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.survey-option:hover:not(:disabled) { background: var(--chronos-hover-bg); }
.survey-option:disabled { cursor: not-allowed; opacity: 0.7; }
.survey-option.is-on {
    border-color: var(--chronos-violet);
    background: color-mix(in srgb, var(--chronos-violet) 9%, var(--chronos-card-bg));
}

.survey-mark {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--chronos-outline);
    border-radius: 6px;
    position: relative;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}
.survey-mark.is-round { border-radius: 999px; }
.survey-option.is-on .survey-mark {
    background: var(--chronos-violet);
    border-color: var(--chronos-violet);
}
.survey-option.is-on .survey-mark::after {
    content: "";
    position: absolute;
    inset-block-start: 2px;
    inset-inline-start: 5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.survey-mark.is-round::after { display: none; }
.survey-option.is-on .survey-mark.is-round::after {
    display: block;
    inset: 3px;
    width: auto;
    height: auto;
    border: none;
    border-radius: 999px;
    background: #fff;
    transform: none;
}

.survey-option-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ---- the foot: back, status, next - always the same row ------------------------------------- */

.survey-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--chronos-outline);
}

.survey-back.is-hidden { visibility: hidden; }

.survey-status {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 18px;
    font-size: 13px;
    text-align: center;
    color: var(--chronos-fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.survey-status.is-failed { color: var(--chronos-red); }

.survey-next {
    flex: 0 0 auto;
    min-width: 112px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--chronos-violet), var(--chronos-lavender));
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.survey-next:hover:not(:disabled) { filter: brightness(1.08); }
.survey-next:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- the finish screen ---------------------------------------------------------------------- */

.survey-finish {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding-block: 24px;
}
.survey-finish .survey-title { margin: 0; }
.survey-finish-icon {
    font-size: 44px;
    color: var(--chronos-violet);
}
.survey-finish-body {
    margin: 0;
    max-width: 38ch;
    font-size: 14px;
    line-height: 1.5;
    color: var(--chronos-fg-muted);
}
.survey-import {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 10px 16px;
    border: 1px solid var(--chronos-violet);
    border-radius: var(--radius-pill);
    color: var(--chronos-violet);
    font-weight: 600;
    text-decoration: none;
}
.survey-import:hover { background: color-mix(in srgb, var(--chronos-violet) 9%, transparent); }
.survey-import .material-icons { font-size: 20px; }

@media (max-width: 480px) {
    .modal-survey {
        height: min(560px, calc(100vh - 24px));
        height: min(560px, calc(100svh - 24px));
    }
    .survey-head { padding: 12px 16px 4px; }
    .survey-scroll { padding: 8px 16px 12px; }
    .survey-foot { padding: 12px 16px 14px; }
    .survey-title { font-size: 18px; }
    .survey-next { min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
    .survey-dot,
    .survey-option,
    .survey-mark { transition: none; }
    .survey-hint.is-nudge { animation: none; }
}

/* ---- the compose bar's capability hint ------------------------------------------------------ */

.compose-hints {
    display: none;
    position: absolute;
    inset-inline: 0;
    bottom: calc(100% + 10px);
    z-index: 21;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 12px;
    background: var(--chronos-card-bg);
    border: 1px solid var(--chronos-outline);
    border-radius: var(--radius-card);
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.16), 0 3px 10px rgba(17, 24, 39, 0.10);
    animation: compose-hints-in 0.14s ease-out;
}
@keyframes compose-hints-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Shown while the field is focused AND empty; Escape (compose-hints.js) closes it until the next focus. */
.compose-slot:not([data-hints-off]):has(.compose-input:focus:placeholder-shown) > .compose-hints {
    display: flex;
}

/* /studio draws it in flow, always open. */
.compose-hints.is-static {
    display: flex;
    position: static;
    animation: none;
    max-width: 560px;
}

.compose-hints-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--chronos-fg-muted);
}

.compose-hints-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.compose-hint {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--chronos-outline);
    border-radius: 10px;
    background: var(--chronos-chip-bg);
    color: var(--chronos-fg-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.12s ease;
}
.compose-hint:hover { border-color: var(--chronos-violet); }

.compose-hint-cap {
    font-size: 11px;
    font-weight: 700;
    color: var(--chronos-violet);
}
.compose-hint-ex {
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* A phone: one row that scrolls sideways. */
@media (max-width: 480px) {
    .compose-hints-row {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-block-end: 2px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }
    .compose-hints-row::-webkit-scrollbar { display: none; }
    .compose-hint {
        flex: 0 0 150px;
        scroll-snap-align: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .compose-hints { animation: none; }
    .compose-hint { transition: none; }
}
