/* ===== SEARCH BAR STYLES ===== */

/* Don't override header__search positioning - it's handled in main.css */

.search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    background-color: white;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #2E7D32);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color, #2E7D32);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-dropdown.active {
    display: block;
}

.search-dropdown__header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-dropdown__results {
    padding: 8px 0;
}

.search-dropdown__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    min-height: 44px; /* Touch target minimum */
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

.search-dropdown__item:hover {
    background-color: var(--bg-light, #f5f5f5);
}

.search-dropdown__item-image {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    background-color: var(--bg-light, #f5f5f5);
    flex-shrink: 0;
}

.search-dropdown__item-info {
    flex: 1;
    min-width: 0;
}

.search-dropdown__item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-dropdown__item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.search-dropdown__item-pzn {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-light, #f5f5f5);
    padding: 2px 6px;
    border-radius: 4px;
}

.search-dropdown__item-manufacturer {
    opacity: 0.8;
}

.search-dropdown__item-price {
    font-weight: 600;
    color: var(--primary-color, #2E7D32);
    margin-left: auto;
    flex-shrink: 0;
}

.search-dropdown__empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 14px;
}

.search-dropdown__loading {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 14px;
}

.search-dropdown__spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-top-color: var(--primary-color, #2E7D32);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Highlight matched text */
.search-highlight {
    background-color: rgba(46, 125, 50, 0.15);
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

/* Suggestion header - "Meinen Sie vielleicht..." */
.search-dropdown__suggestion-header {
    padding: 8px 16px;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--bg-light, #f5f5f5);
    border-top: 1px solid var(--border-color, #e0e0e0);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

/* Suggested item styling (slightly different from exact matches) */
.search-dropdown__item--suggestion {
    opacity: 0.9;
}

.search-dropdown__item--suggestion:hover {
    opacity: 1;
    background-color: rgba(46, 125, 50, 0.05);
}

.search-dropdown__item--suggestion .search-dropdown__item-name {
    color: var(--text-secondary, #666);
}

.search-dropdown__item--suggestion:hover .search-dropdown__item-name {
    color: var(--text-primary, #1a1a1a);
}

/* Responsive */
@media (max-width: 768px) {
    .search-dropdown {
        max-height: 60vh; /* Relative to viewport for better mobile sizing */
    }

    .search-dropdown__item {
        padding: 14px 16px; /* More padding for easier tapping */
        min-height: 56px;
    }

    .search-dropdown__item-image {
        width: 44px;
        height: 44px;
    }

    .search-dropdown__item-name {
        font-size: 13px;
    }

    .search-dropdown__item-meta {
        font-size: 11px;
    }

    .search-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 14px 48px 14px 16px;
    }
}

/* Close button for mobile */
.search-clear-btn {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-clear-btn.active {
    display: flex;
}

.search-clear-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1a1a1a);
}
