/* Autosuggest Styles for Desktop */

.search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input {
    width: 520px !important;
    padding: 12px 16px;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: #1f2937;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-submit {
    padding: 13px 16px;
    background: #3b82f6;
    border: none;
    border-radius: 0 6px 6px 0;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0;
    top: 0;
}

.search-submit:hover {
    background: #2563eb;
}

.search-submit i {
    font-size: 16px;
}

/* Autosuggest Dropdown */
.autosuggest-dropdown {
    position: absolute;
    /* top: 100%; */
    /* left: 0; */
    /* right: 0; */
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.autosuggest-dropdown.show {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background-color: #f8fafc;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    flex-shrink: 0;
}

.suggestion-logo {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-name {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-type {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 500;
}

.suggestion-type.software {
    background: #dbeafe;
    color: #1d4ed8;
}

.suggestion-type.category {
    background: #f3e8ff;
    color: #7c3aed;
}

.suggestion-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.suggestion-stars {
    color: #fbbf24;
    font-size: 12px;
}

.suggestion-reviews {
    font-size: 11px;
    color: #9ca3af;
}

.no-suggestions {
    padding: 16px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.search-loading {
    padding: 16px;
    text-align: center;
    color: #6b7280;
}

.search-loading i {
    animation: spin 1s linear infinite;
}

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

/* Popular searches */
.popular-searches {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 14px;
}

.popular-searches span {
    color: #041f5c;
    font-weight: 500;
}

.popular-searches a {
    color: #ffffff;
    text-decoration: none;
    padding: 4px 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.popular-searches a:hover {
    background-color: #f1f5f9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-container {
        max-width: 100%;
    }
    
    .search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        width:300px;
    }
    
    .autosuggest-dropdown {
        max-height: 300px;
    }
    
    .suggestion-item {
        padding: 10px 12px;
    }
    
    .suggestion-logo {
        width: 28px;
        height: 28px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .search-input-wrapper {
        background: #ffffff;
        border-color: #3b82f6;
    }
    
    .search-input {
        color: #041f5c;
    }
    
    .search-input::placeholder {
        color: #9ca3af;
    }
    
    .autosuggest-dropdown {
        background: #374151;
        border-color: #4b5563;
    }
    
    .suggestion-item:hover,
    .suggestion-item.highlighted {
        background-color: #4b5563;
    }
    
    .suggestion-name {
        color: #f9fafb;
    }
    
    .suggestion-meta {
        color: #d1d5db;
    }
}

/* Accessibility improvements */
.search-input:focus {
    outline: none;
}

.suggestion-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Animation for dropdown appearance */
.autosuggest-dropdown {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.autosuggest-dropdown.show {
    width: 500px;
    opacity: 1;
    transform: translateY(0);
}
