/*
 * „Kérdezz a Labortól" — a lebegő gomb, az ablak és a saját lap.
 * Csak az oldal tokenjeit használja (--color-*, --radius*, --shadow-*), így a régi és az UI v2 felületen is a helyén
 * van (a ui-v2.css a tokeneket cseréli). Betöltés: a layout, ha a látogatónak a bot látszik (askVisible).
 */

/* ---- lebegő gomb ---- */
.ask-fab {
    position: fixed;
    right: clamp(1rem, 3vw, 1.75rem);
    bottom: clamp(1rem, 3vw, 1.75rem);
    z-index: 19; /* a süti-sáv (20) alatt: amíg az látszik, eltakarja */
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1.1rem .7rem .85rem;
    border: 0;
    border-radius: var(--radius-pill, 999px);
    background: var(--color-green-deep, #0f5a3e);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(15, 40, 28, .22), 0 2px 6px rgba(15, 40, 28, .14);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.ask-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15, 40, 28, .26), 0 3px 8px rgba(15, 40, 28, .16); }
.ask-fab:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 3px rgba(15, 90, 62, .35)), 0 10px 26px rgba(15, 40, 28, .22); }
.ask-fab-ic { display: inline-flex; width: 1.25rem; height: 1.25rem; }
.ask-fab-ic svg { width: 100%; height: 100%; }
.ask-fab.is-open { background: var(--color-ink, #17221b); }
@media print { .ask-fab, .ask-panel:not(.is-inline) { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .ask-fab, .ask-fab:hover { transition: none; transform: none; } }

/* ---- az ablak ---- */
.ask-panel {
    position: fixed;
    right: clamp(1rem, 3vw, 1.75rem);
    bottom: calc(clamp(1rem, 3vw, 1.75rem) + 3.6rem);
    z-index: 60;
    width: min(26rem, calc(100vw - 2rem));
    height: min(40rem, calc(100vh - 8rem));
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border, #dfe6dd);
    border-radius: var(--radius-lg, 18px);
    background: var(--color-surface, #fff);
    box-shadow: 0 24px 60px rgba(15, 40, 28, .22), 0 4px 14px rgba(15, 40, 28, .10);
    overflow: hidden;
}
.ask-panel[hidden] { display: none; }
.ask-panel.is-inline {
    position: relative;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: auto;
    height: clamp(32rem, 72vh, 46rem);
    box-shadow: var(--shadow-soft, 0 8px 24px rgba(15, 40, 28, .08));
}

.ask-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    background: var(--color-green-deep, #0f5a3e);
    color: #fff;
}
.ask-head-t { display: grid; gap: .1rem; min-width: 0; }
.ask-head-t strong { font-size: 1rem; line-height: 1.2; }
.ask-head-sub { font-size: .78rem; opacity: .8; }
.ask-head-tools { display: flex; gap: .25rem; flex-shrink: 0; }
.ask-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}
.ask-icon-btn:hover { background: rgba(255, 255, 255, .24); }
.ask-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.ask-list {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    background: var(--color-surface-soft, #f6f8f4);
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { .ask-list { scroll-behavior: auto; } }

.ask-msg { max-width: 100%; font-size: .93rem; line-height: 1.5; }
.ask-msg p { margin: 0; }
.ask-msg.is-user {
    align-self: flex-end;
    max-width: 85%;
    padding: .55rem .85rem;
    border-radius: 16px 16px 4px 16px;
    background: var(--color-green-deep, #0f5a3e);
    color: #fff;
}
.ask-msg.is-bot { align-self: stretch; display: grid; gap: .6rem; color: var(--color-ink, #17221b); }
.ask-msg.is-bot > p:first-child:not(.ask-lead):not(.ask-thinking):not(.ask-err) {
    padding: .65rem .85rem;
    border-radius: 16px 16px 16px 4px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #dfe6dd);
}
.ask-lead { color: var(--color-ink-soft, #3d4a42); font-size: .85rem; font-weight: 600; }
.ask-thinking { display: inline-flex; align-items: center; gap: .55rem; color: var(--color-muted, #6b776f); font-size: .88rem; }
.ask-dots { width: 1.6rem; height: .45rem; background: radial-gradient(circle, currentColor 45%, transparent 50%) 0 50% / .45rem .45rem repeat-x; opacity: .7; animation: ask-dots 1s steps(4) infinite; }
@keyframes ask-dots { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .ask-dots { animation: none; } }
.ask-err { padding: .6rem .8rem; border-radius: 10px; background: var(--color-danger-bg, #fdecea); color: var(--color-danger, #b42318); font-size: .88rem; }

.ask-small { padding: .65rem .85rem; border-radius: 16px 16px 16px 4px; background: var(--color-surface, #fff); border: 1px solid var(--color-border, #dfe6dd); }

/* kapcsolódó kérdések */
.ask-related { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .1rem; }

/* kezdő kérdések */
.ask-starters { display: flex; flex-wrap: wrap; gap: .4rem; }
.ask-starters-t { flex-basis: 100%; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted, #6b776f); }
.ask-chip {
    padding: .45rem .75rem;
    border: 1px solid var(--color-border, #dfe6dd);
    border-radius: var(--radius-pill, 999px);
    background: var(--color-surface, #fff);
    color: var(--color-ink, #17221b);
    font: inherit;
    font-size: .84rem;
    text-align: left;
    cursor: pointer;
}
.ask-chip:hover { border-color: var(--color-green, #1d7a52); color: var(--color-green-deep, #0f5a3e); }
.ask-chip:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 3px rgba(15, 90, 62, .25)); }

/* válaszkártya */
.ask-card {
    display: grid;
    gap: .35rem;
    padding: .8rem .9rem;
    border: 1px solid var(--color-border, #dfe6dd);
    border-radius: 14px;
    background: var(--color-surface, #fff);
}
.ask-card.is-primary { border-color: color-mix(in srgb, var(--color-green, #1d7a52) 45%, var(--color-border, #dfe6dd)); box-shadow: 0 4px 14px rgba(15, 40, 28, .06); }
.ask-tag { justify-self: start; padding: .12rem .5rem; border-radius: var(--radius-pill, 999px); background: var(--color-green-pale, #e8f2ec); color: var(--color-green-deep, #0f5a3e); font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.ask-card-t { margin: 0; font-size: .95rem; line-height: 1.3; font-weight: 700; color: var(--color-ink, #17221b); }
.ask-card-b { font-size: .88rem; line-height: 1.55; color: var(--color-ink-soft, #3d4a42); }
.ask-card-b p, .ask-card-b ul, .ask-card-b ol { margin: 0 0 .45rem; }
.ask-card-b p:last-child, .ask-card-b ul:last-child, .ask-card-b ol:last-child { margin-bottom: 0; }
.ask-card-b ul, .ask-card-b ol { padding-left: 1.15rem; }
.ask-card-b li + li { margin-top: .15rem; }
.ask-card-b strong { color: var(--color-ink, #17221b); }
.ask-card-b.is-clamped { max-height: 9.5rem; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.ask-more { justify-self: start; padding: 0; border: 0; background: none; color: var(--color-green-deep, #0f5a3e); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.ask-open { justify-self: start; margin-top: .1rem; color: var(--color-green-deep, #0f5a3e); font-size: .84rem; font-weight: 700; text-decoration: none; }
.ask-open:hover, .ask-more:hover { text-decoration: underline; }

/* okos ajánló kártya (panasz / terület) */
.ask-finder { display: grid; gap: .45rem; padding: .8rem .9rem; border-radius: 14px; background: var(--color-surface-warm, #fbf6ec); border: 1px solid var(--color-gold-soft, #ead9b4); }
.ask-finder-t { font-size: .9rem; color: var(--color-ink, #17221b); }
.ask-finder-btn { justify-self: start; padding: .45rem .8rem; border-radius: var(--radius-pill, 999px); background: var(--color-green-deep, #0f5a3e); color: #fff; font-size: .84rem; font-weight: 700; text-decoration: none; }
.ask-finder-note { margin: 0; font-size: .78rem; color: var(--color-muted, #6b776f); line-height: 1.45; }

.ask-foot { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; }
.ask-logged { font-size: .8rem; color: var(--color-ink-soft, #3d4a42); }
.ask-link-soft { font-size: .8rem; color: var(--color-green-deep, #0f5a3e); font-weight: 600; }
.ask-notit { padding: .3rem .7rem; border: 1px solid var(--color-border, #dfe6dd); border-radius: var(--radius-pill, 999px); background: var(--color-surface, #fff); color: var(--color-ink-soft, #3d4a42); font: inherit; font-size: .78rem; cursor: pointer; }
.ask-notit:hover { border-color: var(--color-border-strong, #c5d0c6); color: var(--color-ink, #17221b); }

/* beviteli sor */
.ask-form { display: flex; gap: .5rem; padding: .7rem .75rem .35rem; border-top: 1px solid var(--color-border, #dfe6dd); background: var(--color-surface, #fff); }
.ask-input {
    flex: 1;
    min-width: 0;
    padding: .65rem .85rem;
    border: 1px solid var(--color-border-strong, #c5d0c6);
    border-radius: var(--radius-pill, 999px);
    background: var(--color-surface, #fff);
    color: var(--color-ink, #17221b);
    font: inherit;
    font-size: 1rem; /* iOS: 16 px alatt ránagyít */
}
.ask-input:focus { outline: none; border-color: var(--color-green, #1d7a52); box-shadow: var(--focus-ring, 0 0 0 3px rgba(15, 90, 62, .2)); }
.ask-input[aria-invalid="true"] { border-color: var(--color-danger, #b42318); }
.ask-send { padding: .6rem 1rem; border: 0; border-radius: var(--radius-pill, 999px); background: var(--color-green-deep, #0f5a3e); color: #fff; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.ask-send:disabled { opacity: .55; cursor: progress; }
.ask-send:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 3px rgba(15, 90, 62, .3)); }
.ask-privacy { margin: 0; padding: .15rem .9rem .6rem; background: var(--color-surface, #fff); font-size: .72rem; color: var(--color-muted, #6b776f); line-height: 1.35; }

/* telefon: az ablak teljes képernyő, a lap alatta nem görget */
@media (max-width: 640px) {
    .ask-fab { padding: .8rem; }
    .ask-fab-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .ask-panel:not(.is-inline) { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
    html.ask-is-open, html.ask-is-open body { overflow: hidden; }
    html.ask-is-open .ask-fab { display: none; }
}

/* ---- a saját lap ---- */
.content-page.ask-page { max-width: 68rem; }
.ask-page-grid { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 960px) { .ask-page-grid { grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 1fr); } }
.ask-admin-note { margin-bottom: 1rem; }
.ask-browse { display: grid; gap: .5rem; }
.ask-browse h2 { margin: 0; font-size: 1.15rem; }
.ask-browse-lead { margin: 0 0 .35rem; font-size: .88rem; color: var(--color-muted, #6b776f); }
.ask-topic { border: 1px solid var(--color-border, #dfe6dd); border-radius: 12px; background: var(--color-surface, #fff); }
.ask-topic summary { display: flex; justify-content: space-between; gap: .5rem; padding: .65rem .85rem; font-weight: 700; font-size: .92rem; cursor: pointer; list-style: none; }
.ask-topic summary::-webkit-details-marker { display: none; }
.ask-topic-n { min-width: 1.6rem; padding: .05rem .45rem; border-radius: var(--radius-pill, 999px); background: var(--color-green-pale, #e8f2ec); color: var(--color-green-deep, #0f5a3e); font-size: .75rem; text-align: center; }
.ask-topic ul { margin: 0; padding: 0 .5rem .6rem; list-style: none; display: grid; gap: .15rem; }
.ask-browse-q { width: 100%; padding: .4rem .45rem; border: 0; border-radius: 8px; background: none; color: var(--color-ink-soft, #3d4a42); font: inherit; font-size: .86rem; text-align: left; cursor: pointer; }
.ask-browse-q:hover { background: var(--color-green-pale, #e8f2ec); color: var(--color-green-deep, #0f5a3e); }
.ask-browse-q:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 3px rgba(15, 90, 62, .25)); }

/* UI v2: a lebegő gomb a tinta-fekete pirula főgomb családjába */
html.ui-v2 .ask-fab { background: var(--u3-ink, #0f1c15); }
html.ui-v2 .ask-fab:hover { background: var(--color-green-deep, #0f5a3e); }
html.ui-v2 .ask-panel { border-radius: 22px; border-color: var(--u3-card-edge, var(--color-border, #dfe6dd)); }
html.ui-v2 .ask-panel.is-inline { box-shadow: var(--u3-card-shadow, var(--shadow-soft)); }

/* ---- admin lap ---- */
.ask-mode { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; justify-content: space-between; }
.ask-mode > div:first-of-type { display: grid; gap: .1rem; }
.ask-mode-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.ask-mode-try { font-weight: 700; color: var(--color-green-deep, #0f5a3e); text-decoration: none; }
.ask-tabs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 1.1rem 0 .8rem; }
.ask-tab { padding: .4rem .85rem; border: 1px solid var(--color-border, #dfe6dd); border-radius: var(--radius-pill, 999px); background: var(--color-surface, #fff); color: var(--color-ink, #17221b); font-size: .88rem; text-decoration: none; }
.ask-tab b { margin-left: .2rem; }
.ask-tab.is-active { background: var(--color-green-deep, #0f5a3e); border-color: transparent; color: #fff; }
.ask-export { margin-left: auto; }
.ask-bulk { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.ask-bulk select, .ask-bulk input[type="text"] { padding: .5rem .7rem; border: 1px solid var(--color-border-strong, #c5d0c6); border-radius: 10px; font: inherit; font-size: .9rem; background: var(--color-surface, #fff); }
.ask-bulk input[type="text"] { flex: 1; min-width: 14rem; }
.ask-table td { vertical-align: top; }

/* ---- admin: tanítás (a sor „Válasz" mezője), leggyakoribb válaszok ---- */
.ask-teach-how { max-width: 72ch; color: var(--color-muted, #5b6b60); font-size: .92rem; }
.ask-ref-cell { min-width: 15rem; }
.ask-table td:nth-child(3) { min-width: 13rem; }
.ask-ref { width: 100%; padding: .38rem .55rem; border: 1px solid var(--color-border-strong, #c5d0c6); border-radius: 8px; font: inherit; font-size: .85rem; background: var(--color-surface, #fff); }
.ask-ref:focus { outline: none; border-color: var(--color-green, #1d7a52); box-shadow: var(--focus-ring, 0 0 0 3px rgba(15, 90, 62, .2)); }
.ask-ref-cell small { display: block; margin-top: .2rem; line-height: 1.35; }
.ask-ref-tip { font-style: italic; }
.ask-hits summary { cursor: pointer; }
.ask-hits ol { margin: .6rem 0 0; padding-left: 1.4rem; display: grid; gap: .25rem; }
.ask-hit-n { display: inline-block; min-width: 2.6em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-green-deep, #0f5a3e); }

/* ---- gépelés közbeni javaslatok (a beviteli mező fölött) ---- */
.ask-form { position: relative; }
.ask-sugg { position: absolute; left: .75rem; right: .75rem; bottom: calc(100% - .2rem); z-index: 2; margin: 0; padding: .3rem; list-style: none;
    background: var(--color-surface, #fff); border: 1px solid var(--color-border, #dfe6dd); border-radius: 12px;
    box-shadow: 0 10px 28px rgba(15, 28, 21, .14), 0 2px 6px rgba(15, 28, 21, .06); }
.ask-sugg[hidden] { display: none; }
.ask-sugg-t { padding: .25rem .55rem .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--color-muted, #5b6b60); }
.ask-sugg li[role="option"] { padding: .45rem .6rem; border-radius: 8px; font-size: .9rem; line-height: 1.35; color: var(--color-ink, #17221b); cursor: pointer; }
.ask-sugg li[role="option"]:hover, .ask-sugg li[aria-selected="true"] { background: var(--color-green-pale, #e8f3ec); color: var(--color-green-deep, #0f5a3e); }
.ask-sugg mark { background: none; color: inherit; font-weight: 700; }
html.ui-v2 .ask-sugg { border-radius: 16px; border-color: var(--u3-card-edge, var(--color-border, #dfe6dd)); }

/* ---- vendég-bot: „csak alap súgó" jelzés a köszöntő alatt ---- */
.ask-scope-note { margin: .55rem 0 0; padding: .5rem .65rem; border-radius: 10px; background: var(--color-surface-soft, #f4f7f3);
    border: 1px dashed var(--color-border-strong, #c5d0c6); color: var(--color-muted, #5b6b60); font-size: .84rem; line-height: 1.45; }

/* ---- admin: saját válaszok ---- */
.ask-answer-form { display: grid; gap: .8rem; }
.ask-answer-form h2 { margin: 0; font-size: 1.15rem; }
.ask-answer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .7rem 1rem; align-items: end; }
.ask-answer-form label { display: grid; gap: .3rem; font-size: .88rem; font-weight: 600; }
.ask-answer-form input[type="text"], .ask-answer-form select, .ask-answer-form textarea {
    padding: .5rem .65rem; border: 1px solid var(--color-border-strong, #c5d0c6); border-radius: 10px; font: inherit; font-weight: 400;
    font-size: .92rem; background: var(--color-surface, #fff); width: 100%; }
.ask-answer-form textarea { resize: vertical; line-height: 1.5; }
.ask-answer-form small { font-weight: 400; }
.ask-answer-check { display: flex !important; align-items: center; gap: .45rem; font-weight: 500 !important; }
.ask-custom-prev summary { cursor: pointer; font-weight: 600; }
.ask-custom-prev .ask-card-b { margin: .45rem 0; font-size: .88rem; }
.ask-from-q { font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--color-green-deep, #0f5a3e); }
