/* Search Bar Styling for SAMURAI */

.search-bar {
    background: linear-gradient(to right, rgba(21, 21, 32, 0.95), rgba(25, 25, 38, 0.95));
    border-top: 1px solid rgba(130, 87, 255, 0.2);
    border-bottom: 1px solid rgba(130, 87, 255, 0.3);
    padding: 12px 0;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3), inset 0 1px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 998; /* Lower than navbar so it appears underneath */
    display: none; /* Hidden by default, shown with JavaScript */
}

.search-bar.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.search-form {
    width: 100%;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    padding: 12px 70px 12px 20px;
    background: rgba(22, 22, 34, 0.8);
    border: 2px solid rgba(130, 87, 255, 0.3);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--light-text);
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(130, 87, 255, 0.15), inset 0 0 10px rgba(0, 0, 0, 0.2);
}

#search-input:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 15px rgba(247, 37, 133, 0.2), inset 0 0 10px rgba(0, 0, 0, 0.2);
    outline: none;
}

#search-input::placeholder {
    color: rgba(160, 160, 177, 0.7);
}

.search-submit {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    height: 34px;
    width: 34px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 8px;
    color: var(--light-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-submit:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 0 15px rgba(247, 37, 133, 0.5);
}

.search-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    width: 30px;
    background: rgba(40, 40, 60, 0.7);
    border: 1px solid rgba(130, 87, 255, 0.2);
    border-radius: 8px;
    color: var(--light-text);
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    opacity: 1;
    background: rgba(247, 37, 133, 0.2);
    transform: translateY(-50%) rotate(90deg);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, rgba(25, 23, 36, 0.98), rgba(22, 20, 34, 0.98));
    border-radius: 0 0 15px 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(130, 87, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    border: 1px solid rgba(130, 87, 255, 0.2);
    border-top: none;
}

.search-suggestions.active {
    display: block;
    max-height: 320px;
    padding: 8px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(130, 87, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.suggestion-item:hover {
    background: rgba(130, 87, 255, 0.15);
}

.suggestion-item:hover .suggestion-image-overlay {
    opacity: 1;
}

.suggestion-item:hover .suggestion-image {
    transform: scale(1.05);
}

.suggestion-image-container {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4), 0 0 12px rgba(130, 87, 255, 0.25);
    border: 1px solid rgba(247, 37, 133, 0.4);
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(22, 22, 33, 0.8), rgba(27, 27, 40, 0.8));
}

.suggestion-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: linear-gradient(135deg, rgba(22, 22, 33, 0.7), rgba(27, 27, 40, 0.7));
    padding: 2px;
    transition: transform 0.3s ease;
}

.suggestion-image.fallback-image {
    /* Enhanced styling for fallback images */
    background: linear-gradient(135deg, rgba(31, 31, 44, 0.9), rgba(40, 40, 60, 0.9));
    padding: 5px;
    opacity: 0.7;
    object-fit: cover;
    transform: scale(0.85);
}

.suggestion-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(130, 87, 255, 0.2), rgba(247, 37, 133, 0.2));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.suggestion-details {
    flex: 1;
}

.suggestion-name {
    font-weight: 600;
    color: var(--light-text);
}

.suggestion-category {
    font-size: 0.85rem;
    color: var(--accent-tertiary);
}

.suggestion-price {
    font-weight: 700;
    color: var(--accent-secondary);
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--muted-text);
}

/* Scrollbar styling */
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: rgba(31, 31, 44, 0.5);
    border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
}

/* Mobile optimization */
@media screen and (max-width: 650px) {
    .search-container {
        width: 90%;
    }
    
    #search-input {
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    .search-submit {
        height: 40px;
        width: 40px;
        right: 5px;
    }
    
    .search-close {
        top: -50px;
        font-size: 1.5rem;
    }
    .search-toggle {
        display: none;
    }
}
