/* ============================================================
   search.css — Hilfeweb.com Suchfeld
   Such-Icon in Navigation + Vollbild-Overlay mit Trefferliste
   ============================================================ */

/* === Such-Button (schwebend, oben rechts) ===
 * Funktioniert auf allen Seiten unabhängig von der Navigation. */
.search-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    background: linear-gradient(135deg, #f5a623 0%, #e8951a 100%);
    border: 3px solid white;
    color: white;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    z-index: 99990;
    box-shadow: 0 6px 25px rgba(245, 166, 35, 0.5);
    animation: search-pulse 2s infinite;
}
@keyframes search-pulse {
    0%, 100% {
        box-shadow: 0 6px 25px rgba(245, 166, 35, 0.5), 0 0 0 0 rgba(245, 166, 35, 0.5);
    }
    50% {
        box-shadow: 0 6px 25px rgba(245, 166, 35, 0.5), 0 0 0 16px rgba(245, 166, 35, 0);
    }
}
.search-toggle:hover {
    background: linear-gradient(135deg, #1a7a4c 0%, #2d9560 100%);
    transform: scale(1.12) rotate(-8deg);
    box-shadow: 0 8px 30px rgba(26, 122, 76, 0.5);
    animation: none;
}
.search-toggle:active { transform: scale(0.95); }

/* === Text-Hinweis "Suche" neben dem Button === */
.search-toggle::before {
    content: "ابحث";
    position: absolute;
    right: 76px;
    top: 50%;
    transform: translateY(-50%);
    background: #1a5a38;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.search-toggle:hover::before {
    opacity: 1;
}

/* === Vollbild-Overlay === */
#search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 40, 0.85);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px 20px;
    overflow-y: auto;
}
#search-overlay.open {
    display: flex;
    animation: search-fade-in 0.25s ease-out;
}
@keyframes search-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === Such-Container === */
.search-container {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: search-slide-down 0.3s ease-out;
}
@keyframes search-slide-down {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* === Such-Eingabe === */
.search-header {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 2px solid #f0f5f2;
    gap: 12px;
}
.search-header .search-icon {
    font-size: 1.4rem;
    color: #1a7a4c;
}
#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.15rem;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    color: #212529;
    background: transparent;
    direction: rtl;
    text-align: right;
}
#search-input::placeholder { color: #999; }
.search-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}
.search-close:hover {
    color: #d93025;
    transform: scale(1.1);
}

/* === Trefferliste === */
.search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0;
}
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 5px; }
.search-results::-webkit-scrollbar-track { background: transparent; }

/* === Einzelner Treffer === */
.search-result {
    display: block;
    padding: 14px 22px;
    border-bottom: 1px solid #f0f5f2;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.search-result:hover,
.search-result.active {
    background: #f0f5f2;
}
.search-result:last-child { border-bottom: none; }

.search-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.search-result-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}
.search-result-title {
    font-weight: 700;
    color: #1a5a38;
    font-size: 1rem;
    flex: 1;
}
.search-result-source {
    font-size: 0.75rem;
    background: #f0f5f2;
    color: #1a7a4c;
    padding: 2px 10px;
    border-radius: 12px;
    flex-shrink: 0;
    font-weight: 600;
}
.search-result-preview {
    font-size: 0.88rem;
    color: #666;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}
.search-result mark {
    background: #fff3cd;
    color: #856404;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* === Statusmeldungen === */
.search-status {
    padding: 30px 22px;
    text-align: center;
    color: #888;
    font-size: 0.95rem;
}
.search-status .search-hint {
    margin-top: 8px;
    font-size: 0.82rem;
    color: #aaa;
}

/* === Mobile === */
@media (max-width: 768px) {
    #search-overlay {
        padding: 20px 10px 10px;
    }
    .search-container {
        border-radius: 12px;
        max-width: 100%;
    }
    .search-header { padding: 14px 16px; }
    #search-input { font-size: 1rem; }
    .search-result { padding: 12px 16px; }
    .search-toggle {
        top: 14px;
        right: 14px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}
