/* Nur die Suchspezifischen Styles */
.nav-search {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    margin: 8px 0px;
    transform: translateZ(0);  /* Force GPU acceleration */
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Wrapper für die Suche, analog zum Theme-Switch */
.nav-search .wrapper {
    height: 100%;
    display: flex;
    align-items: center;
}

.search-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-search-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    width: 44px;
    margin: 10px;
    border-radius: 25px;
    transition: all 0.3s ease;
    z-index: 2;         /* Höherer z-index */
    font-size: 20px;      /* Größere Lupe */
    font-weight: bold;    /* Fettere Lupe */
    position: relative;  /* Explizite Positionierung */
    will-change: transform;  /* Hint für Browser-Optimierung */
}

.nav-search-toggle:hover {
    color: var(--background-color);
    background-color: var(--primary-color);
}

.nav-search-form {
    position: absolute;
    right: 28px;
    background: var(--primary-color);
    height: 44px;
    border-radius: 18px 25px 25px 18px;
    overflow: hidden;  /* Versteckt den Inhalt während Animation */
    display: flex;     /* Immer flex, auch während Animation */
    align-items: center;
    
    /* Startposition */
    width: 0;
    padding: 0;
    opacity: 1;       /* Volle Opacity von Anfang an */
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 1;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: width, visibility;
}

.nav-search-form.active {
    border-radius: 18px 0 0 18px;
    padding: 0 15px;
    width: 240px;     /* Endbreite des Suchfelds */
    visibility: visible;
}

.nav-search input {
    background: none;
    border: none;
    padding: 0 10px;
    font-family: inherit;
    font-size: inherit;
    color: var(--background-color);
    width: 100%;      /* Füllt den verfügbaren Platz */
    height: 100%;
    opacity: 0;       /* Startet unsichtbar */
    transition: opacity 0.2s ease-in-out 0.2s;  /* Verzögerte Einblendung */
}

.nav-search-form.active input {
    opacity: 1;       /* Wird sichtbar wenn aktiv */
}

.nav-search input:focus {
    outline: none;
}

.nav-search button[type="submit"] {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 10px;
}

/* Wenn aktiv, Button in Pill-Form verwandeln */
.nav-search-form.active + .nav-search-toggle {
    border-radius: 0 25px 25px 0;
    background-color: var(--primary-color);
    color: var(--background-color);
}

.nav-search-toggle i {
    font-weight: 900;    /* Extra bold für FontAwesome Icons */
}

.search-header {
    text-align: center;
    margin-bottom: 3rem;
}

.search-header h1 {
    margin-bottom: 2rem;
}

/* Größeres Suchfeld */
.nav-search.large {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    transform: scale(1.2);
    position: relative;
    display: flex;
    align-items: center;
}

/* Wichtig: Überschreibe die Navigation-Styles */
.nav-search.large input {
    height: 50px;
    font-size: 1.2rem;
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    border-radius: 25px 0 0 25px;
    padding: 0 20px;
    width: 100%;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative;
    margin-right: -1px;
    transition: none;  /* Keine Transition für Farbwechsel */
}

.nav-search.large input::placeholder {
    color: var(--background-color);                       /* Hintergrundfarbe für Placeholder */
    opacity: 0.7;
}

.nav-search.large .nav-search-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    right: auto;
    margin-left: -1px;
    transition: none;  /* Keine Transition für Farbwechsel */
}

.results-count {
    margin-top: 2rem;
    color: #666;
}

.results-count h2 {
    font-size: 1.2rem;
    font-weight: normal;
}

/* Ergebnisraster */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-page {
        padding: 1rem;
    }
    
    .nav-search.large {
        transform: scale(1);
    }
}

/* Zwei-Spalten Layout */
.search-content {
    display: grid;
    grid-template-columns: 1fr 300px;  /* Hauptinhalt und Sidebar */
    gap: 2rem;
    margin-top: 2rem;
}

/* Sidebar Styles */
.search-filters {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: none;  /* Standardmäßig ausgeblendet */
}

.filter-section {
    margin-bottom: 1.5rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-option input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .search-content {
        grid-template-columns: 1fr;  /* Stapel im mobilen Layout */
    }
}

/* Aktive Filter */
.active-filters {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.active-filters h3 {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text-color-light);
}

.filter-tag {
    background-color: var(--primary-color);
    color: var(--background-color);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-tag .remove-filter {
    color: var(--background-color);
    text-decoration: none;
    font-weight: bold;
}

.filter-tag .remove-filter:hover {
    opacity: 0.8;
}

.search-result-item .badge {
    font-size: 1rem;          /* Noch größere Schrift */
    padding: 4px 14px;        /* Größerer Badge */
    border-radius: 8px;
    color: white;
    display: inline-block;
    margin-bottom: 12px;      /* Mehr Abstand zur Karte */
    text-align: left;         /* Linksbündig belassen */
}

/* Spezifische Farben für jeden Typ */
.search-result-item .badge.recipe {
    background-color: #3d8c40; /* Dunkleres Grün */
}

.search-result-item .badge.blog {
    background-color: rgba(60, 0, 190, 0.8); /* Gewünschtes Lila */
}

.search-result-item .badge.page {
    background-color: rgba(0, 117, 255, 0.8); /* Gewünschtes Blau */
}

/* Container für die Suchergebnisse */
.search-result-item {
    text-align: left;  /* Alles linksbündig */
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.search-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* Titel und Text wieder linksbündig */
.search-result-item h3,
.search-result-item p {
    text-align: left;
}

/* Spezifischer Titel-Abstand für Suchergebnisse */
.search-result-item h3 {
    margin-top: 10px;
    margin-bottom: 10px;  /* Optional: für konsistenten Abstand */
}

/* Excerpt-Text styling */
.search-result-item p {
    color: var(--text-color-light);
    margin-bottom: 0;
    line-height: 1.5;
}

/* Bessere Link-Darstellung */
.search-result-item h3 a {
    color: var(--text-color);
    text-decoration: none;
}

.search-result-item h3 a:hover {
    color: var(--primary-color);
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    max-width: 800px;  /* Breiter, aber nicht zu breit */
    margin: 20px auto;  /* Zentriert unter dem Suchfeld */
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.no-results i {
    font-size: 48px;
    color: var(--text-color-light);
    margin-bottom: 20px;
}

.no-results h2 {
    margin-bottom: 10px;
    color: var(--text-color);
}

.no-results p {
    color: var(--text-color-light);
    margin-bottom: 30px;
    font-size: 1.1rem;  /* Etwas größer für bessere Lesbarkeit */
}

.search-suggestions {
    max-width: 500px;  /* Begrenzt die Breite der Liste */
    margin: 0 auto;
    text-align: left;  /* Liste linksbündig */
}

.search-suggestions h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.search-suggestions ul {
    list-style: disc;
    padding-left: 20px;
    margin: 0 auto;
    display: inline-block;  /* Zentriert die Liste, behält aber linksbündigen Text */
}

.search-suggestions li {
    color: var(--text-color-light);
    margin: 8px 0;
    line-height: 1.4;
}

.search-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
}

.suggestion-item {
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.suggestion-item:hover {
    background-color: var(--hover-color);
}

/* Hervorhebung der Suchbegriffe */
.search-result-item mark {
    background-color: rgba(255, 255, 0, 0.3); /* Standard/Light Mode */
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

/* Dark Mode Anpassung */
[data-theme="dark"] .search-result-item mark {
    background-color: rgba(6, 6, 6, 0.8); /* Dein Vorschlag */
    color: #fff;
}

/* Nur anzeigen wenn Ergebnisse vorhanden */
.has-results .search-filters {
    display: block;
}
