/* storefront/app/static/css/navbar.css */
.main-nav {
    background: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-sm) 0;
    margin-top: 80px; /* Space for header */
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-items {
    display: flex;
    gap: var(--spacing-xl);
    list-style: none;
}

.nav-items a {
    color: var(--text-primary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.nav-items a:hover {
    color: var(--href-hover);
}

.nav-items a.active {
    color: var(--href-hover);
    position: relative;
}

.nav-items a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
}

/* Enhanced Search Bar Styling */
.search-bar {
    position: relative;
    min-width: 300px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    transition: all 0.2s ease;
}

.search-form:focus-within {
    border-color: var(--icy-blue);
    box-shadow: 0 0 0 2px rgba(129, 204, 219, 0.1);
}

.search-form input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--text-primary);
    width: 100%;
}

.search-form input::placeholder {
    color: var(--text-secondary);
}

.search-form button {
    background: none;
    border: none;
    padding: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.search-form button:hover {
    color: var(--icy-blue);
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    width: auto;
    max-height: 400px;
    min-width: 350px;
    background: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    z-index: 1000;
    overflow-y: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: top center;
}

/* Custom scrollbar for dropdown */
.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 3px;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Search Result Items */
.search-result-item {
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.search-result-item:hover {
    background: var(--glass-bg);
}

.search-result-item a {
    display: block;
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.search-result-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-result-content img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

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

.search-result-title {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.search-result-brand {
    font-size: 0.85rem;
    color: var(--icy-blue);
    margin-bottom: 0.25rem;
}

.search-result-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Empty results state */
.no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

/* View all results link */
.view-all-results {
    padding: 0.875rem;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-top: 1px solid var(--glass-border);
}

.view-all-results a {
    font-size: 0.9rem;
    color: var(--icy-blue);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.view-all-results a:hover {
    text-decoration: underline;
}

/* Loading state */
.search-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    display: none;
}

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

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--icy-blue);
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Menu Toggle Button (hidden by default) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Transformed hamburger when active */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Media Queries for Responsive Design */
@media (max-width: 1024px) {
    .search-bar {
        flex: 0 0 250px;
    }

    .nav-items {
        gap: var(--spacing-lg);
    }
}

@media (max-width: 768px) {

    .main-nav {
        padding: 0;
        margin-top: 4rem;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-container {
        padding: 0.5rem var(--spacing-md);
    }

    .nav-items {
        position: fixed;
        top: 80px; /* Header height */
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        align-items: center;
        padding: 1rem 0;
        gap: 0;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        z-index: 99;
    }

    .nav-items.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-items li {
        width: 100%;
        text-align: center;
    }

    .nav-items a {
        padding: 1rem;
        width: 100%;
    }

    .search-bar {
        position: static;
        flex: 1;
        margin-right: 1rem;
        margin-left: 1rem;
        margin-top: 0;
    }

    .search-form {
        width: 100%;
    }

    /* Adjust search results dropdown for mobile */
    .search-results-dropdown {
        width: 100%;
        left: 0;
        right: 0;
    }
}

@media (max-width: 576px) {
    .nav-container {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 3;
        margin-top: 0.5rem;
        width: 100%;
        margin-right: 0;
    }

    .search-form {
        width: 100%;
    }

    .mobile-menu-toggle {
        order: 2;
    }
}
