.agf-sg {
    /* Aus den Plugin-Einstellungen gesetzt: Spaltenzahl und Breite des Layers */
    --agf-cols: 3;
    --agf-width: 0px;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1080;
    min-width: 100%;
    max-width: calc(100vw - 16px);
    background: #fff;
    border: 1px solid #dcdcdc;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.agf-sg.has-side {
    width: 640px;
    max-width: calc(100vw - 24px);
}

.agf-sg.is-grid {
    width: 560px;
    max-width: calc(100vw - 24px);
}

.agf-sg.is-grid.has-side {
    width: 740px;
}

.agf-sg-cols {
    display: flex;
    align-items: stretch;
    max-height: 70vh;
}

.agf-sg-side {
    flex: 0 0 190px;
    border-right: 1px solid #ececec;
    background: #fafafa;
    overflow-y: auto;
    padding-bottom: 6px;
}

.agf-sg-main {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: auto;
}

.agf-sg-head {
    padding: 10px 14px 5px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #999;
}

.agf-sg-term,
.agf-sg-cat {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    font-size: .82rem;
    color: #333;
    text-decoration: none;
}

.agf-sg-term svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    fill: none;
    stroke: #aaa;
    stroke-width: 1.6;
}

.agf-sg-term span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agf-sg-cat {
    color: #1a1a1a;
    font-weight: 600;
}

.agf-sg-term:hover,
.agf-sg-cat:hover,
.agf-sg-term.is-active,
.agf-sg-cat.is-active {
    background: #efefef;
    color: #000;
    text-decoration: none;
}

.agf-sg-note,
.agf-sg-empty {
    padding: 10px 14px;
    font-size: .82rem;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

.agf-sg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-bottom: 1px solid #f3f3f3;
    color: inherit;
    text-decoration: none;
}

.agf-sg-item:hover,
.agf-sg-item.is-active {
    background: #f6f6f6;
    text-decoration: none;
    color: inherit;
}

.agf-sg-item img,
.agf-sg-noimg {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex: 0 0 46px;
    background: #f2f2f2;
}

.agf-sg-body {
    flex: 1 1 auto;
    min-width: 0;
}

.agf-sg-name {
    display: block;
    font-size: .86rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agf-sg-sku {
    display: block;
    font-size: .7rem;
    color: #8a8a8a;
}

.agf-sg-price {
    flex: 0 0 auto;
    font-size: .86rem;
    font-weight: 600;
    white-space: nowrap;
}

.agf-sg-all {
    display: block;
    padding: 11px 14px;
    text-align: center;
    font-size: .82rem;
    font-weight: 600;
    background: #fafafa;
    color: inherit;
    text-decoration: none;
}

.agf-sg-all:hover,
.agf-sg-all.is-active {
    background: #f0f0f0;
    text-decoration: none;
}


/* --- Kachelansicht --- */

.agf-sg-grid {
    display: grid;
    grid-template-columns: repeat(var(--agf-cols, 3), 1fr);
    gap: 1px;
    background: #f0f0f0;
    padding: 1px;
}

.agf-sg-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 14px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    text-align: center;
}

.agf-sg-card:hover,
.agf-sg-card.is-active {
    background: #f7f7f7;
    text-decoration: none;
    color: inherit;
}

.agf-sg-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 88px;
    background: #f6f6f6;
}

.agf-sg-thumb img {
    max-width: 100%;
    max-height: 88px;
    object-fit: contain;
}

.agf-sg-cname {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .78rem;
    line-height: 1.3;
    min-height: 2.1em;
}

.agf-sg-cprice {
    font-size: .84rem;
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .agf-sg,
    .agf-sg.has-side,
    .agf-sg.is-grid,
    .agf-sg.is-grid.has-side {
        width: auto;
        right: 0;
        left: 0;
    }

    .agf-sg-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .agf-sg-side {
        max-height: 30vh;
    }

    .agf-sg-cols {
        display: block;
        max-height: 78vh;
        overflow-y: auto;
    }

    .agf-sg-side {
        border-right: 0;
        border-bottom: 1px solid #ececec;
    }
}

@media (max-width: 400px) {
    .agf-sg-grid {
        grid-template-columns: 1fr;
    }
}

.agf-sg-hl {
    background: none;
    color: inherit;
    font-weight: 700;
    padding: 0;
}

/* Breite aus den Plugin-Einstellungen. Der doppelte Attributselektor hebt die
   Spezifitaet ueber .agf-sg.is-grid.has-side; am Handy bleibt der Layer
   weiterhin so breit wie der Bildschirm. */
@media (min-width: 992px) {
    .agf-sg[style*="--agf-width"][style*="--agf-width"] {
        width: var(--agf-width);
        max-width: calc(100vw - 24px);
    }
}

/* Feste Weiterleitung fuer einen Suchbegriff (Einstellung "Weiterleitungen") */
.agf-sg-direct {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: #f7fbf8;
    color: #1a7f4b;
    text-decoration: none;
}

.agf-sg-direct:hover,
.agf-sg-direct.is-active {
    background: #eef7f1;
    color: #14663c;
    text-decoration: none;
}

.agf-sg-direct-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    opacity: .75;
}

.agf-sg-direct-target {
    font-size: .88rem;
    font-weight: 600;
}
