/* Optimized Navbar Styles - Clean Layout Design */

/* ===== NAVBAR CORE STRUCTURE ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    height: 70px;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.98);
    border-bottom-color: rgba(139, 0, 0, 0.4);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 2rem;
}

/* ===== LOGO SECTION (TOP-LEFT) ===== */
.nav-brand {
    display: flex;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-logo:hover {
    transform: translateY(-1px);
}

.logo-icon {
    position: relative;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #8b0000, #660000);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    border: 1px solid rgba(139, 0, 0, 0.3);
    transition: all 0.3s ease;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    transition: opacity 0.3s ease;
    opacity: 0;
}

.nav-logo:hover .logo-icon::before {
    opacity: 1;
}

.logo-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #8b0000, #a50000);
    border-radius: 12px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(8px);
}

.nav-logo:hover .logo-glow {
    opacity: 0.6;
}

.logo-text-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8b0000, #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.logo-tagline {
    font-size: 0.65rem;
    color: #9ca3af;
    font-weight: 400;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* ===== CENTER NAVIGATION ===== */
.nav-center {
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    color: #8b0000;
    background: rgba(139, 0, 0, 0.08);
    transform: translateY(-1px);
}

.nav-link.active {
    color: #8b0000;
    background: rgba(139, 0, 0, 0.1);
}

.nav-icon {
    font-size: 1rem;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
    transform: scale(1.1);
}

.nav-link-indicator {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b0000, #a50000);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover .nav-link-indicator,
.nav-link.active .nav-link-indicator {
    width: 80%;
}

/* ===== RIGHT ACTIONS (NO AUTH BUTTONS) ===== */
.nav-actions {
    display: flex;
    align-items: center;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===== SEARCH SYSTEM ===== */
.search-container {
    position: relative;
}

.search-toggle {
    width: 42px;
    height: 42px;
    background: rgba(139, 0, 0, 0.1);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #8b0000;
}

.search-toggle:hover {
    background: rgba(139, 0, 0, 0.15);
    border-color: rgba(139, 0, 0, 0.4);
    transform: translateY(-1px);
}

.search-toggle.active {
    background: rgba(139, 0, 0, 0.2);
    border-color: rgba(139, 0, 0, 0.5);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-input-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: rgba(17, 17, 17, 0.8);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: rgba(139, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.search-input::placeholder {
    color: #6b7280;
}

.search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.2rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.search-input:not(:placeholder-shown) + .search-clear {
    opacity: 1;
}

.search-clear:hover {
    color: #8b0000;
}

/* ===== ENHANCED SEARCH RESULTS STYLES ===== */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #9ca3af;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(139, 0, 0, 0.2);
    border-top: 2px solid #8b0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(139, 0, 0, 0.1);
}

.results-count {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
}

.view-all-btn {
    background: none;
    border: 1px solid rgba(139, 0, 0, 0.3);
    color: #8b0000;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: rgba(139, 0, 0, 0.1);
    border-color: rgba(139, 0, 0, 0.5);
}

.search-see-more {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(139, 0, 0, 0.1);
    text-align: center;
}

.search-see-more button {
    background: none;
    border: none;
    color: #8b0000;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: underline;
    text-decoration-color: transparent;
}

.search-see-more button:hover {
    text-decoration-color: #8b0000;
}

.no-results-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.no-results-text {
    font-weight: 500;
    color: #d1d5db;
    margin-bottom: 0.25rem;
}

.no-results-suggestion {
    font-size: 0.875rem;
    color: #9ca3af;
}

.search-result-title mark {
    background: rgba(139, 0, 0, 0.2);
    color: #8b0000;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
}

/* ===== CART SYSTEM ===== */
.cart-toggle {
    position: relative;
    width: 42px;
    height: 42px;
    background: rgba(139, 0, 0, 0.1);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #8b0000;
}

.cart-toggle:hover {
    background: rgba(139, 0, 0, 0.15);
    border-color: rgba(139, 0, 0, 0.4);
    transform: translateY(-1px);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #8b0000, #660000);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transform: scale(0);
    transition: all 0.3s ease;
    opacity: 0;
}

.cart-count.has-items {
    display: flex !important;
    transform: scale(1);
    opacity: 1;
    animation: cartBounce 0.6s ease;
}

@keyframes cartBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ===== USER MENU ===== */
.user-menu-container {
    position: relative;
}

.user-menu-toggle {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #d1d5db;
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 12px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.user-link:hover {
    background: rgba(139, 0, 0, 0.1);
    color: #8b0000;
}

.user-divider {
    margin: 0.5rem 0;
    border: none;
    height: 1px;
    background: rgba(139, 0, 0, 0.2);
}

/* ===== MOBILE TOGGLE ===== */
.nav-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-mobile-toggle:hover {
    background: rgba(139, 0, 0, 0.1);
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: #8b0000;
    transition: all 0.3s ease;
}

.nav-mobile-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nav-mobile-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-mobile-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===== PROGRESS BAR ===== */
.nav-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b0000, #a50000);
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

/* ===== MOBILE NAVIGATION OVERLAY ===== */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(139, 0, 0, 0.2);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-nav-close {
    width: 40px;
    height: 40px;
    background: rgba(139, 0, 0, 0.1);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    color: #8b0000;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-close:hover {
    background: rgba(139, 0, 0, 0.2);
}

.mobile-nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    transform: translateX(-20px);
    opacity: 0;
}

.mobile-nav-overlay.active .mobile-nav-link {
    transform: translateX(0);
    opacity: 1;
}

.mobile-nav-link:nth-child(1) { transition-delay: 0.1s; }
.mobile-nav-link:nth-child(2) { transition-delay: 0.2s; }
.mobile-nav-link:nth-child(3) { transition-delay: 0.3s; }
.mobile-nav-link:nth-child(4) { transition-delay: 0.4s; }

.mobile-nav-link:hover {
    background: rgba(139, 0, 0, 0.1);
    color: #8b0000;
    transform: translateX(8px);
}

.mobile-nav-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(139, 0, 0, 0.2);
}

.mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .nav-container {
        grid-template-columns: auto 1fr auto;
        gap: 1rem;
    }
    
    .nav-center {
        display: none;
    }
    
    .nav-mobile-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
        grid-template-columns: auto 1fr auto;
    }
    
    .logo-text-container {
        display: none;
    }
    
    .action-group {
        gap: 0.5rem;
    }
    
    .search-dropdown {
        width: 280px;
    }
}

@media (max-width: 640px) {
    .search-dropdown {
        left: 0;
        right: 0;
        width: auto;
        margin: 0 1rem;
        transform: translateY(-10px);
    }
    
    .search-dropdown.active {
        transform: translateY(0);
    }
    
    .user-dropdown {
        left: 0;
        right: 0;
        width: auto;
        margin: 0 1rem;
    }
    
    .mobile-nav-content {
        padding: 1.5rem;
    }
    
    .mobile-nav-links {
        gap: 0.25rem;
    }
    
    .mobile-nav-link {
        padding: 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .search-dropdown {
        width: 260px;
        right: -1rem;
    }
    
    .user-dropdown {
        right: -1rem;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .search-toggle,
    .cart-toggle,
    .user-menu-toggle {
        width: 36px;
        height: 36px;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus States */
.nav-link:focus,
.search-toggle:focus,
.cart-toggle:focus,
.user-menu-toggle:focus,
.nav-mobile-toggle:focus {
    outline: 2px solid #8b0000;
    outline-offset: 2px;
    border-radius: 6px;
}

/* ===== SCROLLBAR STYLING ===== */
.search-results::-webkit-scrollbar {
    width: 4px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(107, 114, 128, 0.1);
    border-radius: 2px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(139, 0, 0, 0.3);
    border-radius: 2px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 0, 0, 0.5);
}
