/* ==================================================================
   Such-Autocomplete-Panel (OwnMag2Ext_SearchAutocomplete, Issue 02)
   Eigenes Vorschlagspanel unterm Suchfeld: Kategorien links auf
   zartem Marken-Tint, Produktkacheln rechts auf Weiss, Footer-Link
   zur Ergebnisseite. Optik "Mini-Kategorieseite": gleiche visuelle
   Sprache wie Megamenue/Kategorie-Nav (Chevron in Markenfarbe,
   translateX(4px)-Hover, 8px-Radius). Tastatur-Markierung (._active)
   teilt bewusst die Hover-Optik. !important nur auf Link-Farben:
   Porto setzt Header-Link-Farben spaeter im Bundle.
   Markup kommt theme-neutral aus dem Modul (autocomplete.phtml).
   ================================================================== */
.searchautocomplete-panel {
    position: absolute;
    top: calc(100% + 8px);
    /* Mittig unterm Suchfeld statt right:0 (rechtsbuendig ragte das Panel
       ~130px links ueber das Logo hinaus). Zentriert wird die PRODUKT-
       Flaeche, nicht das Gesamtpanel: die 220px-Kategorien-Spalte (Grid
       __inner) zaehlt nicht mit, darum -50% minus 110px (= halbe
       Spaltenbreite). translateX zentriert auch bei variabler calc-Breite;
       der Reduced-Motion-Block unten resettet nur Hover-Transforms,
       nicht das Panel. */
    left: 50%;
    transform: translateX(calc(-50% - 110px));
    z-index: 1100;
    display: flex;
    flex-direction: column;
    /* Zentriert braucht das Panel BEIDSEITIG je halbe Breite Platz um die
       Anker-Mitte; calc(100vw - 40px) faengt schmale Viewports ab. Ab 1200px
       weitet die Media-Query unten auf 900px + 4 Spalten. */
    width: min(760px, calc(100vw - 40px));
    /* Footer ("Alle X Ergebnisse") muss im Viewport bleiben (E2E-Befund
       1440x900: 100vh-220px = 680px). Ceiling 680 statt 640, weil der
       3-zeilige Titel-Clamp bis zu 2x18px mehr Hoehe braucht — sonst
       scrollt der Inhalt intern. */
    max-height: min(680px, calc(100vh - 220px));
    background: #fff;
    border: 1.5px solid color-mix(in srgb, var(--theme-color) 30%, #dadada);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    overflow: hidden;
    text-align: left;
}
.searchautocomplete-panel[hidden] {
    display: none;
}
.searchautocomplete-panel__inner {
    display: grid;
    grid-template-columns: 220px 1fr;
    overflow-y: auto;
}
.searchautocomplete-panel__footer {
    flex: none;
}
.searchautocomplete-panel__inner--empty {
    display: block;
    padding: 20px;
}
.searchautocomplete-panel__heading {
    grid-column: 1 / -1;
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #6b6b6b;
    text-transform: none;
}
.searchautocomplete-panel__categories {
    padding: 20px 16px 20px 20px;
    background: color-mix(in srgb, var(--theme-color) 4%, #fff);
    border-right: 1px solid #ececec;
}
.searchautocomplete-panel__categories ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.searchautocomplete-panel__category a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #2f2f2f !important;
    text-decoration: none;
    transition: color 0.15s ease-out, background-color 0.15s ease-out, transform 0.15s ease-out;
}
.searchautocomplete-panel__category a::after {
    content: "\203A";
    margin-left: 6px;
    color: var(--theme-color);
    opacity: 0;
    transition: opacity 0.15s ease-out;
}
.searchautocomplete-panel__category:hover a,
.searchautocomplete-panel__category._active a {
    color: var(--theme-color) !important;
    background: color-mix(in srgb, var(--theme-color) 10%, #fff);
    transform: translateX(4px);
}
.searchautocomplete-panel__category:hover a::after,
.searchautocomplete-panel__category._active a::after {
    opacity: 1;
}
.searchautocomplete-panel__count {
    font-weight: 400;
    color: #6b6b6b;
}
.searchautocomplete-panel__products {
    display: grid;
    /* Feste Spaltenzahl statt auto-fill: 8 Produkte (Config-Default) teilen
       sich sauber in 3 Reihen; ab 1200px schaltet die Media-Query auf 4
       Spalten (= 2 volle Reihen). Feste Zahl haelt die Kachelbreite bei
       ~150px, damit die 300er-Bildquelle nicht hochskaliert wird. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
    align-content: start;
    padding: 24px;
}
.searchautocomplete-panel__products--fallback {
    padding: 12px 0 0;
}
.searchautocomplete-panel__product {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.15s ease-out;
}
.searchautocomplete-panel__product:hover,
.searchautocomplete-panel__product._active {
    background: color-mix(in srgb, var(--theme-color) 6%, #fff);
}
.searchautocomplete-panel__product img,
.searchautocomplete-panel__noimage {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
}
.searchautocomplete-panel__name {
    font-size: 13px;
    line-height: 1.4;
    color: #2f2f2f !important;
    display: -webkit-box;
    /* 3 Zeilen statt 2: bei Suchen wie "cold brew" ist der Titel-Anfang fuer
       alle Treffer identisch ("Cold Brew Fruechtetee ..."), die
       unterscheidende Sorte steht am ENDE und wurde von 2 Zeilen genau dort
       abgeschnitten. 13px Schriftgroesse bleibt (Porto-Minimum). */
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.searchautocomplete-panel__product:hover .searchautocomplete-panel__name,
.searchautocomplete-panel__product._active .searchautocomplete-panel__name {
    color: var(--theme-color) !important;
}
.searchautocomplete-panel__price {
    /* margin-top:auto haelt die Preise einer Kachelreihe auf gleicher Hoehe,
       auch wenn Titel mal 2, mal 3 Zeilen belegen (Grid streckt Kacheln). */
    margin-top: auto;
    font-size: 14px;
    font-weight: 600;
    color: #222529 !important;
}
.searchautocomplete-panel__message {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #2f2f2f;
}
/* Primäre Panel-Aktion: als dezente Aktionsleiste statt reinem Text-Link
   (Ruhezustand-Tint + Marken-Trennlinie heben sie vom weißen Produktbereich ab).
   Bewusst KEINE vollgrüne Fläche wie im Mobile-Overlay — im breiten Desktop-Panel
   wäre das zu dominant; hier reicht ein klar lesbarer Akzent. */
.searchautocomplete-panel__footer {
    display: block;
    padding: 15px 20px;
    border-top: 1px solid color-mix(in srgb, var(--theme-color) 25%, #ececec);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: color-mix(in srgb, var(--theme-color) 88%, #000) !important;
    text-decoration: none;
    background: color-mix(in srgb, var(--theme-color) 6%, #fff);
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
}
.searchautocomplete-panel__footer:hover,
.searchautocomplete-panel__footer._active {
    background: color-mix(in srgb, var(--theme-color) 15%, #fff);
    color: color-mix(in srgb, var(--theme-color) 78%, #000) !important;
    text-decoration: none;
}
/* Kuratierte "Direkt zu"-Zeile (Such-Kuratierung Issue 02) als TOP-TREFFER-
   Karte im Listen-Vokabular (Spotlight-/Omnibox-Muster, Baymard: Vorschlags-
   typen distinkt, aber als Vorschlag erkennbar stylen). Bewusst KEINE voll-
   gruene Banner-Leiste (wurde als Deko-Element gelesen, nicht als Link):
   Sektionskopf wie "Kategorien"/"Produkte" + eine Karte mit Icon-Chip,
   unterstrichenem Label (Link-Affordance), Ziel-Pfad und Chevron; Hover/
   ._active teilt die Hover-Sprache der Kategorie-Zeilen. Gepinnt ueber dem
   scrollenden __inner (flex:none am Kopf UND an der Karte). */
.searchautocomplete-panel__redirect-head {
    flex: none;
    margin: 0;
    padding: 16px 20px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #6b6b6b;
}
.searchautocomplete-panel__redirect {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    margin: 0 12px 14px;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--theme-color) 6%, #fff);
    border: 1.5px solid color-mix(in srgb, var(--theme-color) 30%, #dadada);
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
}
.searchautocomplete-panel__redirect:hover,
.searchautocomplete-panel__redirect._active {
    background: color-mix(in srgb, var(--theme-color) 12%, #fff);
    border-color: var(--theme-color);
    text-decoration: none;
}
.searchautocomplete-panel__redirect-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--theme-color) 14%, #fff);
    color: color-mix(in srgb, var(--theme-color) 80%, #000);
    font-size: 18px;
    line-height: 1;
}
.searchautocomplete-panel__redirect-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.searchautocomplete-panel__redirect-text {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #222529 !important;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--theme-color) 55%, #fff);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}
.searchautocomplete-panel__redirect:hover .searchautocomplete-panel__redirect-text,
.searchautocomplete-panel__redirect._active .searchautocomplete-panel__redirect-text {
    color: color-mix(in srgb, var(--theme-color) 80%, #000) !important;
    text-decoration: underline;
    text-decoration-color: var(--theme-color);
    text-decoration-thickness: 2px;
}
.searchautocomplete-panel__redirect-path {
    font-size: 13px;
    line-height: 1.3;
    color: #6b6b6b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.searchautocomplete-panel__redirect-arrow {
    flex: none;
    margin-left: auto;
    font-size: 22px;
    line-height: 1;
    color: var(--theme-color);
    transition: transform 0.15s ease-out;
}
.searchautocomplete-panel__redirect:hover .searchautocomplete-panel__redirect-arrow,
.searchautocomplete-panel__redirect._active .searchautocomplete-panel__redirect-arrow {
    transform: translateX(4px);
}
.searchautocomplete-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
@media (prefers-reduced-motion: reduce) {
    .searchautocomplete-panel__category a,
    .searchautocomplete-panel__category a::after,
    .searchautocomplete-panel__product,
    .searchautocomplete-panel__footer,
    .searchautocomplete-panel__redirect,
    .searchautocomplete-panel__redirect-arrow {
        transition: none;
    }
    .searchautocomplete-panel__category:hover a,
    .searchautocomplete-panel__category._active a,
    .searchautocomplete-panel__redirect:hover .searchautocomplete-panel__redirect-arrow,
    .searchautocomplete-panel__redirect._active .searchautocomplete-panel__redirect-arrow {
        transform: none;
    }
}
/* Breiteres Panel + 4 Spalten ab 1200px. Zentriert braucht das Panel
   beidseitig je 450px um die Anker-Mitte; calc(100vw - 300px) haelt darunter
   Sicherheitsabstand zu beiden Kanten. */
@media (min-width: 1200px) {
    .searchautocomplete-panel {
        width: min(900px, calc(100vw - 300px));
    }
    .searchautocomplete-panel__products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


/* ==================================================================
   Such-Overlay (OwnMag2Ext_SearchAutocomplete, Issue 03)
   Vollbild-Suche unter 992px (Porto versteckt die Header-Suche dort
   hinter dem Lupen-Icon). Das Overlay wird per JS an <body> gehaengt,
   damit es aus dem versteckten .block-search ausbricht. Es nutzt die
   GLEICHEN Render-Templates wie das Desktop-Panel; das einspaltige
   Listen-Layout entsteht allein durch die Modus-Klasse
   .searchautocomplete-overlay (Produkt-<a> als Grid Bild|Text).
   ================================================================== */
.searchautocomplete-overlay {
    position: fixed;
    inset: 0;
    /* ueber Sticky-Header, Off-Canvas-Nav (1001) und Desktop-Panel (1100) */
    z-index: 100000;
    display: flex;
    flex-direction: column;
    background: #fff;
    animation: sa-overlay-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.searchautocomplete-overlay[hidden] {
    display: none;
}
@keyframes sa-overlay-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
.searchautocomplete-overlay__bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #ececec;
    background: #fff;
}
.searchautocomplete-overlay__form {
    flex: 1 1 auto;
    display: flex;
    min-width: 0;
    margin: 0;
}
.searchautocomplete-overlay__input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    /* !important: Portos input[type="search"] (Spezifitaet 0,1,1) laedt spaeter
       im Bundle und ueberstimmt sonst font-size/height. Die 16px sind der
       iOS-Auto-Zoom-Schutz und muessen zwingend gewinnen. */
    height: 48px !important;
    padding: 0 16px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    color: #2f2f2f !important;
    border: 1.5px solid color-mix(in srgb, var(--theme-color) 30%, #dadada) !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.searchautocomplete-overlay__input:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-color) 16%, transparent);
}
.searchautocomplete-overlay__close {
    flex: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #2f2f2f;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease-out, background-color 0.15s ease-out;
}
.searchautocomplete-overlay__close:hover,
.searchautocomplete-overlay__close:focus-visible {
    background: color-mix(in srgb, var(--theme-color) 8%, #fff);
    color: var(--theme-color);
}
/* __results ist der Scroll-Container; __inner + CTA scrollen gemeinsam, der CTA
   sitzt als letztes Fluss-Element UNTER den Ergebnissen (kein schwebender
   Sticky-Footer -> bei offener Tastatur nicht mehr fehlpositioniert, Ergebnisse
   behalten die volle Hoehe). */
.searchautocomplete-overlay__results {
    flex: 1 1 auto;
    min-height: 0;
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.searchautocomplete-overlay__hint {
    margin: 0;
    padding: 28px 20px;
    font-size: 15px;
    line-height: 1.6;
    color: #6b6b6b;
    text-align: center;
}
.searchautocomplete-overlay .searchautocomplete-panel__inner {
    display: block;
    overflow: visible;
}
.searchautocomplete-overlay .searchautocomplete-panel__inner--empty {
    display: block;
    padding: 20px;
}
.searchautocomplete-overlay .searchautocomplete-panel__heading {
    margin: 16px 0 6px;
    padding: 0 20px;
    font-size: 12px;
    letter-spacing: 0.02em;
}
/* Kategorien als kompakte, volle Zeilen (Touch >= 44px) */
.searchautocomplete-overlay .searchautocomplete-panel__categories {
    padding: 0 0 8px;
    background: none;
    border-right: 0;
    border-bottom: 8px solid color-mix(in srgb, var(--theme-color) 5%, #f4f4f4);
}
.searchautocomplete-overlay .searchautocomplete-panel__category a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 20px;
    border-radius: 0;
    font-size: 15px;
}
.searchautocomplete-overlay .searchautocomplete-panel__category a::after {
    margin-left: auto;
    opacity: 1;
    font-size: 18px;
}
.searchautocomplete-overlay .searchautocomplete-panel__category:hover a,
.searchautocomplete-overlay .searchautocomplete-panel__category._active a {
    transform: none;
    background: color-mix(in srgb, var(--theme-color) 8%, #fff);
}
/* Produkte als Liste: Bild links 64px, Name oben / Preis unten rechts */
.searchautocomplete-overlay .searchautocomplete-panel__products {
    display: block;
    padding: 0 0 8px;
}
.searchautocomplete-overlay .searchautocomplete-panel__products--fallback {
    padding: 0 0 8px;
}
.searchautocomplete-overlay .searchautocomplete-panel__product {
    display: grid;
    grid-template-columns: 64px 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    align-items: center;
    min-height: 44px;
    padding: 12px 20px;
    border-radius: 0;
    border-bottom: 1px solid #f1f1f1;
}
.searchautocomplete-overlay .searchautocomplete-panel__product img,
.searchautocomplete-overlay .searchautocomplete-panel__noimage {
    grid-row: 1 / 3;
    width: 64px;
    height: 64px;
    border-radius: 8px;
}
.searchautocomplete-overlay .searchautocomplete-panel__name {
    align-self: end;
    font-size: 15px;
    /* Overlay-Listenzeilen sind breit (~40 Zeichen/Zeile), 2 Zeilen reichen —
       den 3-Zeilen-Desktop-Clamp hier bewusst NICHT erben (64px-Row-Rhythmus). */
    -webkit-line-clamp: 2;
}
.searchautocomplete-overlay .searchautocomplete-panel__price {
    align-self: start;
    font-size: 15px;
}
/* CTA als letztes Fluss-Element UNTER den Ergebnissen (kein Sticky mehr) */
.searchautocomplete-overlay .searchautocomplete-panel__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 14px 20px;
    border-top: 0;
    background: var(--theme-color);
    color: #fff !important;
}
.searchautocomplete-overlay .searchautocomplete-panel__footer:hover,
.searchautocomplete-overlay .searchautocomplete-panel__footer._active {
    background: color-mix(in srgb, var(--theme-color) 88%, #000);
}
/* Top-Treffer-Karte im Overlay: gleiche Karte, mobile Raender und volle
   Touch-Hoehe (>= 44px + Luft); Kopf fluchtet mit den Listen-Headings. */
.searchautocomplete-overlay .searchautocomplete-panel__redirect-head {
    padding: 14px 20px 8px;
}
.searchautocomplete-overlay .searchautocomplete-panel__redirect {
    min-height: 60px;
    margin: 0 16px 12px;
}
@media (prefers-reduced-motion: reduce) {
    .searchautocomplete-overlay {
        animation: none;
    }
    .searchautocomplete-overlay__close {
        transition: none;
    }
}
