/**
 * Header Search Styles für ASEA-Integration
 * 
 * @package DEHOGA_Member_Search
 */

/* Hauptcontainer */
.dehoga-header-search-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* Suchformular */
.dehoga-header-search-form {
    position: relative;
    width: 100%;
}

/* Suchbox Container */
.dehoga-header-search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    overflow: hidden;
}

/* Suchfeld Input */
.dehoga-header-search-input {
    flex: 1;
    width: 100%;
    padding: 10px 45px 10px 15px;
    border: none;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: transparent;
}

.dehoga-header-search-input::placeholder {
    color: #999;
    opacity: 1;
}

.dehoga-header-search-input:focus {
    outline: none;
}

/* Submit Button */
.dehoga-header-search-submit {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.3s ease;
}

.dehoga-header-search-submit:hover {
    color: #333;
}

.dehoga-header-search-submit .icon-search {
    font-size: 18px;
}

.dehoga-header-search-submit:focus {
    outline: none;
}

/* Suchergebnisse Container */
.dehoga-header-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    margin-top: 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.dehoga-header-search-results:not(:empty) {
    display: block;
}

/* ASEA Suchergebnisse Styling (wiederverwendet) */
.dehoga-header-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dehoga-header-search-results ul li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #eee;
}

.dehoga-header-search-results ul li:last-child {
    border-bottom: none;
}

.dehoga-header-search-results ul li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s ease;
}

.dehoga-header-search-results ul li a:hover {
    background-color: #f5f5f5;
}

.dehoga-header-search-results .eckb-article-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dehoga-header-search-results .eckb-article-title-icon {
    font-size: 16px;
    color: #666;
}

.dehoga-header-search-results .eckb-article-title-text {
    flex: 1;
}

.dehoga-header-search-results .asea-search-context {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
}

/* Loading State */
.dehoga-header-search-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Error State */
.dehoga-header-search-error {
    padding: 20px;
    text-align: center;
    color: #d32f2f;
}

/* No Results State */
.dehoga-header-search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* "Mehr Ergebnisse" Link */
.dehoga-header-search-results #asea-all-search-results {
    padding: 12px 15px;
    text-align: center;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

.dehoga-header-search-results #asea-all-search-results a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.dehoga-header-search-results #asea-all-search-results a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dehoga-header-search-input {
        padding: 8px 40px 8px 12px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    .dehoga-header-search-submit {
        width: 35px;
    }
    
    .dehoga-header-search-results {
        max-height: 300px;
    }
}

/* Integration mit Theme */
.sc_layouts_item .dehoga-header-search-wrap {
    width: 100%;
}

/* Anpassung für Header-Layout */
.header_search .dehoga-header-search-wrap {
    max-width: 100%;
}

/* Scrollbar Styling für Ergebnisse */
.dehoga-header-search-results::-webkit-scrollbar {
    width: 8px;
}

.dehoga-header-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dehoga-header-search-results::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dehoga-header-search-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Spinner Container */
.dehoga-header-search-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #666;
    border-radius: 50%;
    animation: dehoga-spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Spinner während Suche anzeigen */
.dehoga-header-search-submit.searching .dehoga-header-search-spinner {
    display: block;
}

/* Lupe während Suche ausblenden */
.dehoga-header-search-submit.searching .icon-search {
    display: none;
}

/* Spinner-Animation */
@keyframes dehoga-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Verhindere Theme-Animationen auf der Lupe */
.dehoga-header-search-submit .icon-search {
    animation: none !important;
    transform: none !important;
}

/* Während Suche: Lupe komplett ausblenden */
.dehoga-header-search-submit.searching .icon-search {
    display: none !important;
    animation: none !important;
}

/* ============================================
   TRX_ADDONS SEARCH - Spinner statt rotierender Lupe
   ============================================ */

/* Verhindere Animation auf trx_addons Search Icon */
.search_wrap.search_progress .search_submit {
    animation: none !important;
}

.search_wrap.search_progress .search_submit:before {
    display: none !important;
}

/* Spinner für trx_addons Search */
.search_wrap .search_submit {
    position: relative;
}

.search_wrap .search_submit::after {
    content: '';
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #666;
    border-radius: 50%;
    animation: dehoga-spin 1s linear infinite;
}

/* Zeige Spinner während Suche */
.search_wrap.search_progress .search_submit::after {
    display: block;
}
