/*
 * NaturaGart Advisor - chat widget styling (self-contained, no framework deps)
 */

#agileelk-advisor-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;
}

/* #132: Solange ein Fenster des Shops offen ist (Sidebar-Warenkorb, Hinweise; Bootstrap
   setzt dann body.modal-open), liegt es vorn und der Chat unter dessen Abdunklung
   (Bootstrap 5: Abdunklung 1050, Fenster 1055). Danach ist der Chat wieder ganz oben. */
body.modal-open #agileelk-advisor-widget {
    z-index: 1040;
}

.advisor-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: #2e7d32;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
}

.advisor-launcher:hover {
    background: #276b2b;
    transform: translateY(-2px);
}

.advisor-launcher:focus-visible {
    outline: 3px solid #ffd54f;
    outline-offset: 2px;
}

.advisor-launcher-icon {
    font-size: 26px;
    line-height: 1;
}

.advisor-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    /* Breite 440 statt 360 — Vergleichsmass ist der alte Bot (homie) mit 450.
       `min()` statt width+max-width: dieselbe Klammer, aber an einer Stelle. */
    width: min(440px, calc(100vw - 40px));

    /* 🔴 Die Hoehe waechst mit dem Fenster, sie ist KEINE Konstante.
       Hier standen bis 2026-08-06 feste 640px mit der Begruendung, homie messe
       "450x612". Die 612 stimmten — aber nur bei einem Viewport. Nachgemessen
       am 2026-08-06 ueber fuenf Fenstergroessen ist homie viewport-relativ,
       rund 85 % der Fensterhoehe, gedeckelt bei 820:

         1920x1080 -> 820    1440x900 -> 765    1024x768 -> 653

       Mit den festen 640 verschenkte unser Fenster auf einem 1080er Schirm
       180px. Gemessen hiess das: Nachrichtenflaeche 473px bei 1582px
       Scrollhoehe — der Kunde sah 30 % der Antwort und musste dreimal
       scrollen. Der Deckel bleibt, weil ein Chatfenster ueber 820px auf hohen
       Schirmen nur noch leerer Raum ist.

       Drei Klammern, die kleinste gewinnt:
         820px               Deckel auf hohen Schirmen
         88dvh               Anteilsdeckel — ohne ihn belegt das Fenster auf
                             einem 1024x768-Notebook 95 % der Hoehe und die
                             Seite dahinter verschwindet. homie bleibt dort
                             bei 85 %; gemessen 728px gegen 653px.
         calc(100dvh - 40px) Mindestabstand zum Rand auf sehr flachen Fenstern */
    height: min(820px, 88vh, calc(100vh - 40px));
    /* `dvh` rechnet die ein- und ausfahrende Adressleiste mobiler Browser mit;
       `vh` tut das nicht und laesst das Fenster unten herausragen. Die
       vh-Zeile darueber bleibt als Rueckfall fuer Browser ohne `dvh`. */
    height: min(820px, 88dvh, calc(100dvh - 40px));
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: #212529;
}

.advisor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #2e7d32;
    color: #fff;
    flex: 0 0 auto;
}

.advisor-header-title {
    font-weight: 600;
}

.advisor-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.advisor-close:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

/* Knoepfe rechts im Kopf: „Neues Gespraech“ links vom Schliessen-Knopf (#79). */
.advisor-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.advisor-newconv {
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}

.advisor-newconv:hover:not(:disabled) {
    color: #ffd54f;
}

.advisor-newconv:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.advisor-newconv:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

/* Rueckfrage „Neues Gespraech beginnen?“ direkt unter dem Kopf. */
.advisor-newconv-bar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #e8f5e9;
    border-bottom: 1px solid #a5d6a7;
    color: #1b5e20;
    font-size: 13px;
}

.advisor-newconv-bar[hidden] {
    display: none;
}

.advisor-newconv-text {
    flex: 1 1 auto;
    font-weight: 600;
}

.advisor-newconv-error {
    color: #b71c1c;
}

.advisor-newconv-yes,
.advisor-newconv-no {
    border: 1px solid #2e7d32;
    border-radius: 14px;
    padding: 4px 14px;
    font-size: 13px;
    cursor: pointer;
}

.advisor-newconv-yes {
    background: #2e7d32;
    color: #fff;
}

.advisor-newconv-no {
    background: #fff;
    color: #2e7d32;
}

.advisor-newconv-yes:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.advisor-newconv-yes:focus-visible,
.advisor-newconv-no:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.advisor-disclosure {
    flex: 0 0 auto;
    padding: 8px 14px;
    background: #fff8e1;
    border-bottom: 1px solid #ffe082;
    color: #6d4c00;
    font-size: 12px;
    line-height: 1.35;
}

.advisor-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f6f7f8;
}

.advisor-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.advisor-bubble-user {
    align-self: flex-end;
    background: #2e7d32;
    color: #fff;
    border-bottom-right-radius: 3px;
}

.advisor-bubble-bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 3px;
}

.advisor-bubble-status {
    color: #757575;
    font-style: italic;
}

/* The status text changes at most four times per turn, and a plain FAQ answer
   only twice. Between the changes the window would sit completely still, which
   reads as "nothing is happening". A slow pulse keeps it alive without adding
   a second moving element next to the text. */
.advisor-bubble-status {
    animation: advisor-status-pulse 1.6s ease-in-out infinite;
}

@keyframes advisor-status-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

/* WCAG 2.3.3 / respecting the OS setting: no motion for anyone who asked not to
   have any. The status text alone still carries the information. */
@media (prefers-reduced-motion: reduce) {
    .advisor-bubble-status {
        animation: none;
    }
}

/* Answer prose is block-rendered (Markdown subset: p / lists / tables) —
   no pre-wrap anymore, spacing comes from the block elements. */
.advisor-answer .advisor-md-p {
    margin: 0 0 8px;
}

.advisor-answer .advisor-md-p:last-child {
    margin-bottom: 0;
}

.advisor-answer .advisor-md-list {
    margin: 0 0 8px;
    padding-left: 20px;
}

.advisor-answer .advisor-md-list:last-child {
    margin-bottom: 0;
}

.advisor-answer .advisor-md-list li {
    margin: 2px 0;
}

/* Links im Antworttext (Vikunja #54). Unterstrichen, damit sie nicht nur an der
   Farbe erkennbar sind (WCAG 1.4.1); #1565c0 auf Weiss = 5,7:1. Der Fokusrahmen
   in Linkfarbe hat auf der weissen Blase genug Kontrast (WCAG 2.4.7 / 1.4.11) —
   das Gelb der Schaltflaechen waere dort kaum zu sehen. */
.advisor-answer .advisor-inline-link {
    color: #1565c0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.advisor-answer .advisor-inline-link:hover {
    color: #0d47a1;
}

.advisor-answer .advisor-inline-link:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Wide tables scroll inside their own container, never the panel. */
.advisor-md-table-wrap {
    overflow-x: auto;
    margin: 0 0 8px;
}

.advisor-md-table-wrap:last-child {
    margin-bottom: 0;
}

.advisor-md-table {
    border-collapse: collapse;
    font-size: 13px;
    min-width: 100%;
}

.advisor-md-table th,
.advisor-md-table td {
    border: 1px solid #dde3e6;
    padding: 5px 8px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
    /* Bubble erzwingt overflow-wrap:anywhere — in Zellen keine Wortmitte-Umbrüche,
       breite Tabellen scrollen stattdessen im .advisor-md-table-wrap. */
    overflow-wrap: normal;
    word-wrap: normal;
}

.advisor-md-table td {
    white-space: normal;
    min-width: 90px;
}

.advisor-md-table th {
    background: #eef4ee;
    color: #1b5e20;
    font-weight: 600;
}

.advisor-md-table tbody tr:nth-child(even) {
    background: #f6f9f6;
}

/* Product tiles (Design 2026-07-22): compact horizontal cards, whole card links
   to the product detail page (same tab — the widget re-opens after navigation). */
.advisor-products {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* #147: „Als CSV speichern“ unter den Artikelkarten einer Antwort */
.advisor-products-csv {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.advisor-products-csv-btn {
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid #2e7d32;
    border-radius: 18px;
    background: #fff;
    color: #1b5e20;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.advisor-products-csv-btn:hover,
.advisor-products-csv-btn:focus-visible {
    background: #e8f5e9;
}

.advisor-products-csv-status {
    font-size: 12px;
    color: #1b5e20;
}

.advisor-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #dbe4db;
    border-radius: 10px;
    background: #fafcfa;
    text-decoration: none;
    color: #212529;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.advisor-product-card:hover {
    border-color: #2e7d32;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.advisor-product-card:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

.advisor-product-media {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #eef2ee;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advisor-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.advisor-product-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.advisor-product-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #1b5e20;
}

.advisor-product-price {
    font-size: 13px;
    font-weight: 700;
    color: #212529;
}

/* Vikunja #56: the frame moves from the card link to .advisor-product, which
   also holds the "In den Warenkorb" button — a button must not sit inside <a>.
   Cards without a button look exactly as before. */
.advisor-product {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid #dbe4db;
    border-radius: 10px;
    background: #fafcfa;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.advisor-product:hover {
    border-color: #2e7d32;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.advisor-product > .advisor-product-card {
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
}

.advisor-product-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.advisor-product-status {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #1b5e20;
}

/* #145: Lieferampel wie im Shop (Punkt-Farben aus nattheme .ampel-2 … .ampel-5),
   wenn die Karte keinen Warenkorb-Knopf hat, weil der Artikel nicht bestellbar ist. */
.advisor-product-delivery {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #333;
}

.advisor-product-status a {
    color: #1565c0;
    text-decoration: underline;
}

.advisor-product-tobasket,
.advisor-product-variant {
    flex: 0 0 auto;
    border: 1px solid #2e7d32;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.advisor-product-tobasket {
    background: #2e7d32;
    color: #fff;
}

.advisor-product-tobasket:hover {
    background: #276b2b;
}

.advisor-product-tobasket[aria-disabled="true"] {
    opacity: 0.6;
    cursor: progress;
}

.advisor-product-variant {
    background: #fff;
    color: #2e7d32;
}

.advisor-product-variant:hover {
    background: #eef4ee;
}

.advisor-product-tobasket:focus-visible,
.advisor-product-variant:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

.advisor-citations {
    margin-top: 8px;
    font-size: 12px;
    color: #455a64;
}

.advisor-citations a {
    color: #1565c0;
    text-decoration: underline;
}

.advisor-claims {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 12px;
    color: #37474f;
}

.advisor-claims li {
    margin: 2px 0;
}

.advisor-suggestions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.advisor-chip {
    border: 1px solid #2e7d32;
    background: #fff;
    color: #2e7d32;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.advisor-chip:hover {
    background: #2e7d32;
    color: #fff;
}

.advisor-chip:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

.advisor-messages:focus {
    outline: none;
}

.advisor-chip:disabled {
    opacity: 0.55;
    cursor: default;
}

.advisor-chip:disabled:hover {
    background: #fff;
    color: #2e7d32;
}

/* Startknoepfe unter der Begruessung, in derselben Bot-Blase (#79). Wie die
   Antwort-Chips, nur etwas groesser und mit Zeilenumbruch fuer lange Beschriftungen;
   umbrechen auch in schmalen Fenstern. */
.advisor-start-buttons {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.advisor-start-button {
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    max-width: 100%;
}

.advisor-start-button:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

/* „Weiter rechnen“ (#81): Knopfgruppe unter dem Ergebnis bzw. unter einer Antwort. Wie die
   Antwort-Chips; Beschriftungen umbrechen, nichts laeuft ueber den Rand. */
.advisor-weiter {
    margin-top: 10px;
}

.advisor-weiter-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #1b5e20;
}

.advisor-weiter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.advisor-weiter-button {
    min-height: 44px;
    padding: 6px 14px;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    max-width: 100%;
}

.advisor-weiter-button:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.advisor-weiter-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.advisor-weiter-button:disabled:hover {
    background: #fff;
    color: #2e7d32;
}

/* Pflanzenliste einer „im Shop auswaehlen“-Zeile: eigene Zeile ueber die ganze Breite. */
.advisor-konf-choices {
    margin-top: 4px;
}

.advisor-konf-choices-summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #1b5e20;
}

.advisor-konf-choices-summary:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.advisor-konf-choices-list {
    margin: 0 0 4px;
    padding-left: 18px;
    max-height: 220px;
    overflow-y: auto;
    white-space: normal;
}

/* Konfigurator-Ergebnis (#77): Antwortknoepfe, Tabelle mit Shop-Preisen, Warenkorb, CSV.
   Kontraste: Text #263238 / #37474f auf Weiss (> 10:1), Gruen #1b5e20 auf Weiss (7.9:1),
   weisser Text auf #2e7d32 (5.1:1), Grund-Hinweis #8a3b00 auf #fff4e5 (7:1). */
.advisor-konf {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #263238;
}

.advisor-konf-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.advisor-konf-option {
    min-height: 44px;
    padding: 6px 14px;
    font-size: 13px;
}

.advisor-konf-option:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.advisor-konf-option:disabled:hover {
    background: #fff;
    color: #2e7d32;
}

.advisor-konf-section {
    margin: 0 0 10px;
}

.advisor-konf-h {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: #1b5e20;
}

/* Angaben und berechnete Werte: Bezeichnung links (bricht um), Wert rechts als
   Ganzes; reicht der Platz nicht, rutscht der Wert unter die Bezeichnung. */
.advisor-konf-list {
    margin: 0;
}

.advisor-konf-pair {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 12px;
    padding: 2px 0;
}

.advisor-konf-list dt {
    flex: 1 1 12em;
    min-width: 0;
    font-weight: 400;
    overflow-wrap: break-word;
}

.advisor-konf-list dd {
    flex: 0 1 auto;
    margin: 0;
    font-weight: 600;
    overflow-wrap: break-word;
    word-break: normal;
}

.advisor-konf-hints {
    margin: 0;
    padding-left: 18px;
    color: #37474f;
}

.advisor-konf-alt {
    margin: 0 0 10px;
    padding: 6px 10px 8px;
    border: 1px solid #b0bec5;
    border-radius: 6px;
}

.advisor-konf-legend {
    padding: 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: #1b5e20;
    float: none;
    width: auto;
}

.advisor-konf-alt-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 44px;
    padding: 6px 0;
    cursor: pointer;
}

.advisor-konf-alt-option input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
}

.advisor-konf-alt-option input:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

/* Positionen als gestapelte Liste: im schmalen Fenster (440 px, Handy 360 px)
   kein Querscrollen. Lange Woerter brechen um. */
.advisor-konf-items {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
}

.advisor-konf-item {
    margin: 0 0 8px;
    padding: 8px 10px;
    border: 1px solid #dde3e6;
    border-radius: 6px;
    background: #fff;
    overflow-wrap: anywhere;
}

.advisor-konf-item p {
    margin: 0 0 2px;
}

.advisor-konf-item-title {
    font-weight: 600;
}

/* Nicht einlegbar: gestrichelter Rahmen und grauer Grund heben den Eintrag ab,
   der Grund steht zusaetzlich als Text im Eintrag (Farbe allein traegt es nicht). */
.advisor-konf-item-excluded {
    border-style: dashed;
    border-color: #78909c;
    background: #f1f3f4;
    color: #37474f;
}

/* "2 Stueck x 389,00 EUR = 778,00 EUR": eine Zeile, rechtsbuendig. */
.advisor-konf-item .advisor-konf-line {
    margin-top: 4px;
    text-align: right;
}

.advisor-konf-item .advisor-konf-choose {
    display: inline-block;
    padding: 6px 0;
}

.advisor-konf-jump {
    min-height: 44px;
    margin: 0 0 8px;
    padding: 6px 12px;
    border: 1px solid #2e7d32;
    border-radius: 22px;
    background: #fff;
    color: #1b5e20;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.advisor-konf-jump:focus-visible,
.advisor-konf-total:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.advisor-konf-pre {
    margin: 0 0 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
    background: transparent;
    border: 0;
    padding: 0;
}

.advisor-konf-noarticles {
    margin: 0 0 8px;
    font-weight: 600;
}

/* Beratungsfall: die Hinweise sind die Antwort. */
.advisor-konf-advice .advisor-konf-hints {
    font-size: 14px;
    color: #263238;
}

.advisor-konf-bubble {
    max-width: 100%;
}

.advisor-konf-sku,
.advisor-konf-note {
    display: block;
    font-size: 12px;
    color: #455a64;
}

.advisor-konf-reason {
    display: block;
    margin-top: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    background: #fff4e5;
    color: #8a3b00;
    font-size: 12px;
}

.advisor-konf-link {
    color: #1565c0;
    text-decoration: underline;
}

.advisor-konf-link:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
    border-radius: 2px;
}

.advisor-konf-status,
.advisor-konf-total {
    margin: 0 0 6px;
}

.advisor-konf-status:empty {
    display: none;
}

.advisor-konf-total strong {
    font-size: 14px;
}

.advisor-konf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.advisor-konf-btn {
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid #2e7d32;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.advisor-konf-add {
    background: #2e7d32;
    color: #fff;
}

.advisor-konf-add:hover {
    background: #276b2b;
}

.advisor-konf-csv {
    background: #fff;
    color: #1b5e20;
}

.advisor-konf-csv:hover {
    background: #eef4ee;
}

.advisor-konf-btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

.advisor-konf-add[aria-disabled="true"] {
    cursor: progress;
}

.advisor-konf-btn:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.advisor-konf-btn[hidden] {
    display: none;
}

.advisor-konf-outcome:empty {
    display: none;
}

.advisor-konf-outcome {
    margin-top: 8px;
}

.advisor-konf-outcome:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.advisor-konf-outcome-list {
    margin: 0 0 6px;
    padding-left: 18px;
}

.advisor-konf-outcome-failed {
    color: #8a3b00;
}

.advisor-konf-basketlink {
    display: inline-block;
    padding: 12px 0;
}

/* AP-A: thumbs feedback under a fresh answer */
.advisor-feedback {
    margin-top: 10px;
    display: flex;
    gap: 6px;
}

.advisor-feedback-btn {
    border: 1px solid #cfd8dc;
    background: #fff;
    border-radius: 14px;
    padding: 2px 9px;
    font-size: 14px;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.advisor-feedback-btn:hover {
    background: #f1f8e9;
    border-color: #2e7d32;
}

.advisor-feedback-btn:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

.advisor-feedback-up.advisor-feedback-active {
    background: #e8f5e9;
    border-color: #2e7d32;
}

.advisor-feedback-down.advisor-feedback-active {
    background: #fdecea;
    border-color: #c62828;
}

.advisor-input-row {
    flex: 0 0 auto;
    display: flex;
    /* Der Zeichenzaehler bekommt eine eigene Zeile unter dem Eingabefeld
       (flex: 1 0 100%), statt die Zeile enger zu machen. */
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

/* Zeichenzaehler "123 / 2000". Bleibt verborgen, solange die Grenze unbekannt
   ist — "0 / ?" waere schlechter als nichts. */
.advisor-counter {
    flex: 1 0 100%;
    margin: -2px 4px 0 0;
    text-align: right;
    font-size: 12px;
    line-height: 1.2;
    /* 5,3:1 auf Weiss — ueber der WCAG-AA-Schwelle von 4,5:1. */
    color: #6b6b6b;
}

/* Ab 90 % der Grenze, damit das Limit nicht mitten im Satz ueberrascht.
   6,4:1 auf Weiss. */
.advisor-counter-near {
    color: #a04000;
    font-weight: 600;
}

.advisor-input {
    /* Basis 0 statt auto: ein Textfeld bringt von sich aus ~20 Zeichen Breite
       mit. Mit dem Mikrofon-Knopf daneben reichte das auf 320px-Telefonen nicht
       mehr, und der Senden-Knopf rutschte in eine eigene Zeile. */
    flex: 1 1 0%;
    min-width: 0;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 16px;
    /* 🔴 NICHT unter 16px setzen. iOS Safari zoomt beim Fokussieren
       automatisch in die Seite, wenn ein Eingabefeld kleiner schreibt — der
       Kunde tippt, und die Seite springt. Das ist kein Schoenheitsfehler. */
    font-size: 16px;
    outline: none;
}

.advisor-input:focus {
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.advisor-send {
    flex: 0 0 auto;
    border: none;
    background: #2e7d32;
    color: #fff;
    border-radius: 20px;
    padding: 10px 18px;
    font-size: 15px;
    cursor: pointer;
}

.advisor-send:disabled {
    opacity: 0.6;
    cursor: default;
}

.advisor-send:focus-visible {
    outline: 2px solid #ffd54f;
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Spracheingabe (Mikrofon-Knopf). Entsteht nur, wenn der Browser die
   Erkennung kann — siehe advisor.js.
   --------------------------------------------------------------------------- */
.advisor-mic {
    flex: 0 0 auto;
    align-self: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #2e7d32;
    border-radius: 50%;
    background: #fff;
    /* 5,1:1 auf Weiss */
    color: #2e7d32;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.advisor-mic:hover {
    background: #f1f8e9;
}

/* Dunkler Ring statt des Gelbs der anderen Knoepfe: auf der weissen
   Eingabezeile hat Gelb nur 1,4:1, Gruen 7,9:1 (WCAG 2.4.7 / 1.4.11: 3:1). */
.advisor-mic:focus-visible {
    outline: 2px solid #1b5e20;
    outline-offset: 2px;
}

.advisor-mic:disabled {
    opacity: 0.6;
    cursor: default;
}

.advisor-mic svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Aufnahme laeuft: Symbol wechselt von Mikrofon zu Stopp-Quadrat (Form, nicht
   nur Farbe), dazu der Text in .advisor-voice-status. Weiss auf Rot 5,6:1. */
.advisor-mic .advisor-mic-stop {
    display: none;
}

.advisor-mic-active {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
    animation: advisor-mic-pulse 1.4s ease-out infinite;
}

.advisor-mic-active:hover {
    background: #b71c1c;
}

.advisor-mic-active .advisor-mic-glyph {
    display: none;
}

.advisor-mic-active .advisor-mic-stop {
    display: block;
}

@keyframes advisor-mic-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.45); }
    70%  { box-shadow: 0 0 0 8px rgba(198, 40, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .advisor-mic-active {
        animation: none;
    }
}

/* Statuszeile ("Aufnahme laeuft", Fehler) und Datenschutz-Satz, je eine eigene
   Zeile unter dem Eingabefeld — wie der Zeichenzaehler. */
.advisor-voice-status,
.advisor-voice-note {
    flex: 1 0 100%;
    margin: -2px 4px 0;
    font-size: 12px;
    line-height: 1.35;
    /* 5,3:1 auf Weiss */
    color: #6b6b6b;
}

.advisor-voice-status {
    /* 7,9:1 auf Weiss */
    color: #1b5e20;
    font-weight: 600;
}

/* 6,6:1 auf Weiss */
.advisor-voice-status.advisor-voice-error {
    color: #b71c1c;
}

/* Leer: aus dem Fluss nehmen (sonst stuende eine leere Zeile samt Abstand da),
   aber NICHT display:none — als Live-Region muss das Element im
   Barrierefreiheitsbaum bleiben, damit der naechste Text angesagt wird. */
.advisor-voice-status:empty {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.advisor-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Vollbild auf Telefonen.
   🔴 Die Grenze lag bei 420px und damit UNTER der Breite gaengiger Geraete
   (iPhone 14/15 Pro Max 430, Pixel 8 Pro 448). Die landeten knapp daneben im
   Fenstermodus mit 20px Rand — und mit dem breiteren Panel waere das schlechter
   geworden, nicht besser. 576px ist Bootstraps `sm`, also dieselbe Grenze, die
   das Theme drumherum benutzt. */
@media (max-width: 576px) {
    .advisor-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        /* `dvh` beruecksichtigt die Adressleiste, `vh` nicht — ohne diese Zeile
           schiebt sich die Eingabezeile unter den Bildschirmrand. */
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
}

/* ---------------------------------------------------------------------------
   Bildschirmecke (Modul-Einstellung `agileelk_advisor_position`)

   Der Standard ist rechts und steht oben in den Grundregeln. Hier steht nur
   die Abweichung — `right: auto` ist dabei nicht optional: ohne das Zuruecksetzen
   waeren beide Kanten gesetzt, und das Fenster zoege sich ueber die volle
   Breite auf.

   Auf Telefonen (Vollbild, siehe unten) hat die Ecke keine Bedeutung mehr —
   deshalb steht dieser Block VOR der Vollbild-Regel und wird von ihr
   ueberschrieben.
   --------------------------------------------------------------------------- */
/* Der Launcher ist NICHT selbst `fixed` — er sitzt im Container, und der wird
   positioniert. Eine Regel auf `.advisor-launcher` allein liefe ins Leere. Das
   Panel dagegen ist `fixed` und braucht seine eigene Zeile. */
#agileelk-advisor-widget.advisor-links,
#agileelk-advisor-widget.advisor-links .advisor-panel {
    right: auto;
    left: 20px;
}

@media (max-width: 576px) {
    #agileelk-advisor-widget.advisor-links .advisor-panel {
        left: 0;
        right: 0;
    }
}

/* #114 (F61): Hinweis „bereits in den Warenkorb gelegt“ nach dem Neuladen — sitzt im
   Rückmeldebereich, wo sonst die Rückmeldung je Position steht. */
.advisor-konf-already {
    margin: 0 0 6px;
}

/* #119: Knopf „Zum Kontaktformular“ unter Antworten mit Übergabe an einen Menschen.
   Ein echter Link im Aussehen der Hauptknöpfe (wie „In den Warenkorb“), 44 px hoch. */
.advisor-contact {
    margin-top: 10px;
}

.advisor-contact-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid #2e7d32;
    border-radius: 22px;
    background: #2e7d32;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.12s ease;
}

.advisor-contact-link:hover,
.advisor-contact-link:focus {
    background: #276b2b;
    color: #fff;
    text-decoration: none;
}

.advisor-contact-link:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}
