/* Search Bar Card Container */
.sb-card {
    border: 2px solid #dae4f0; /* Leichter Pastell-Rahmen (Blau-Grau) */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Leichter Schatten für Tiefe */
}

.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    background: transparent;
    min-height: 48px; /* Fix für CLS Desktop: Platz reservieren */
}

/* 1. Kategorie Button */
.sb-cat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    border-right: 1px solid #eee; /* Leichterer Trenner innen */
    padding: 0 20px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    height: 48px;
    transition: background 0.2s;
    border-radius: 6px 0 0 6px;
}

.sb-cat-btn:hover {
    background-color: #f8f9fa;
    color: var(--mz-one);
}

.sb-cat-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    text-align: left;
}

.sb-cat-label {
    font-size: 1rem;
    color: #333;
    font-weight: 700;
    line-height: 1.2;
}

.sb-cat-value {
    font-size: 0.75rem;
    font-weight: 400;
    color: #888;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.sb-cat-icon {
    font-size: 1.2rem;
    color: #777;
}

/* 2. Typ Dropdown (Custom) */
.sb-type-dropdown {
    height: 48px;
    display: flex;
    align-items: center;
    border-right: 1px solid #eee; /* Leichterer Trenner innen */
}

.sb-type-btn {
    border: none;
    background: transparent;
    padding: 0 15px;
    font-size: 0.95rem;
    color: #555;
    cursor: pointer;
    height: 100%;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap; /* Verhindert Umbruch bei "Alle Typen" */
}

.sb-type-btn:hover {
    color: #000;
    background-color: #fcfcfc;
}

/* 3. Suchformular */
.sb-input-wrapper {
    flex: 1; /* Nimmt im Desktop den restlichen Platz ein */
    margin: 0 10px;
    position: relative; /* Für absolute Positionierung der Vorschläge */
}

.sb-input {
    border: 2px solid #cbd5e1; /* Kräftigerer Rahmen (Blue-Grey) */
    border-radius: 4px;
    outline: none;
    width: 100%;
    font-size: 1rem;
    height: 40px;
    background: #f8f9fa; /* Leichter Hintergrund für bessere Erkennbarkeit */
    padding: 0 35px 0 15px; /* Rechts Platz für das X */
    color: #333;
    margin: 0;
    transition: all 0.2s;
}

.sb-input:focus {
    background: #fff;
    border-color: var(--mz-two);
    box-shadow: 0 0 0 2px rgba(56, 75, 112, 0.1);
}

.sb-input::placeholder {
    color: #999;
}

/* Clear Button (X) */
.sb-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 1.5rem;
    line-height: 1;
    display: none; /* Standardmäßig versteckt */
    padding: 0 5px;
}
.sb-clear-btn:hover { color: #333; }

/* Suggestions Dropdown */
.sb-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    z-index: 9999; /* Sehr hoch, damit es über allem liegt */
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
}

.sb-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
    font-size: 0.95rem;
}
.sb-suggestion-item:hover, .sb-suggestion-item.active {
    background-color: #f0f0f0;
}

/* History Header & Footer */
.sb-suggestion-header {
    padding: 8px 15px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    cursor: default;
}

.sb-suggestion-footer {
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background-color: #fff;
    text-align: center;
}

.sb-suggestion-footer a {
    color: var(--mz-two);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}
.sb-suggestion-footer a:hover {
    text-decoration: underline;
}

/* NEU: Aktive Auswahl hervorheben */
.sb-suggestion-item.selected {
    background-color: #e8f0fe; /* Hellblau */
    color: #1a73e8; /* Blau */
    font-weight: 600;
}

/* 4. History Button */
.sb-history-btn {
    background-color: transparent;
    color: #999;
    border: none;
    padding: 0 10px;
    height: 40px;
    margin-right: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.sb-history-btn:hover {
    color: #333;
    background-color: #f0f0f0;
}

/* 5. View Toggles (Grid/List) */
.sb-view-toggle {
    display: flex;
    align-items: center;
    padding-left: 10px;
    margin-left: 5px;
    border-left: 1px solid #eee; /* Leichterer Trenner innen */
    height: 30px; /* Höhe des Trenners */
    gap: 5px;
}

.sb-view-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sb-view-btn .icon-grid,
.sb-view-btn .icon-list {
    display: none;
}

/* Wenn aktueller Modus LIST ist -> Zeige Grid-Icon (zum Umschalten) */
.sb-view-btn[data-view-mode="list"] .icon-grid { display: block; }

/* Wenn aktueller Modus GRID ist -> Zeige List-Icon (zum Umschalten) */
.sb-view-btn[data-view-mode="grid"] .icon-list { display: block; }

.sb-view-btn:hover {
    background-color: #f0f0f0;
    color: #666;
}

.sb-view-btn {
    height: 42px;
    width: 52px; /* Breiter */
    border: 1px solid #ccc; /* Kräftigerer Rahmen */
    background-color: #f8f9fa; /* Leichter Hintergrund für mehr "Body" */
    color: #333; /* Dunkleres Icon */
    justify-content: center;
}

/* CSP Helpers (statt Inline-Styles) */
.sb-history-icon {
    float: right;
}
.sb-history-meta {
    color: #999;
    margin-left: 5px;
}

/* History Modal Styles */
.btn-search-delete {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 10px;
    margin-left: 10px;
}
.btn-search-delete:hover {
    color: var(--mz-one);
}

/* Mobile Optimierung */
@media (max-width: 799.9px) {
    .search-wrapper {
        flex-wrap: wrap;
        gap: 10px;
        padding: 5px;
        min-height: 104px; /* Fix für CLS Mobile: Platz für 2 Zeilen + Gap reservieren */
        align-content: flex-start; /* Verhindert vertikales Strecken */
    }

    /* Zeile 1: Kategorie & Typ */
    .sb-cat-btn {
        order: 1;
        border-right: none;
        background-color: #f1f3f4;
        border-radius: 6px;
        height: 42px;
        width: calc(50% - 5px);
        flex: 0 0 auto;
        justify-content: center;
        padding: 0 10px;
    }

    .sb-cat-value {
        max-width: 100px; /* Weniger Platz auf Mobile */
        font-size: 0.75rem;
    }

    .sb-type-dropdown {
        order: 2;
        border-right: none;
        background-color: #f1f3f4;
        border-radius: 6px;
        height: 42px;
        width: calc(50% - 5px);
        flex: 0 0 auto;
        justify-content: center;
    }

    /* Zeile 2: Suche, Button, Toggles */
    .sb-input-wrapper {
        order: 3;
        width: auto;
        min-width: 0; /* WICHTIG: Erlaubt dem Input zu schrumpfen, damit Buttons passen */
        flex: 1 1 auto; /* Nimmt den restlichen Platz */
    }

    .sb-input {
        height: 42px;
        border: 1px solid #eee;
        border-radius: 6px;
        background-color: #fff;
        margin: 0;
    }

    .sb-history-btn {
        order: 4;
        padding: 0 10px;
        height: 42px;
        width: 42px; /* Quadratisch auf Mobile */
        justify-content: center;
        margin-right: 0;
    }

    .sb-view-toggle {
        order: 5;
        display: flex;
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        height: 42px;
        gap: 5px;
    }

    .sb-view-btn {
        height: 42px;
        width: 42px;
        border: 1px solid #eee;
        justify-content: center;
    }
}

.sb-history-title {
    font-size: 1.1rem;
    margin: 0;
}