/* 导航栏基础样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    padding: 0.5rem 0;
}

.navbar.scrolled {
    padding: 0.25rem 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.12);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Logo样式 */
.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.navbar-brand:hover {
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.navbar-brand img {
    height: 40px;
    width: auto;
    transition: all 0.3s ease;
}

.navbar.scrolled .navbar-brand img {
    height: 32px;
}

/* 导航菜单样式 */
.navbar-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.08);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.12);
    font-weight: 600;
}

.nav-link i {
    font-size: 1rem;
}

/* 搜索框样式 */
.navbar-search {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #f3f4f6;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    width: 240px;
}

.navbar-search:hover {
    background-color: #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.navbar-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

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

.navbar-search input:focus {
    outline: none;
}

.navbar-search button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.navbar-search button:hover {
    background-color: rgba(79, 70, 229, 0.1);
    transform: scale(1.1);
}

.navbar-search button i {
    font-size: 1rem;
}

/* 用户菜单样式 */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user a {
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.navbar-user a:hover {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.08);
}

.navbar-user i {
    font-size: 1rem;
}

/* 登录按钮 */
.login-btn {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.login-btn:hover {
    color: white;
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* 用户下拉菜单 */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.user-menu-trigger:hover {
    background-color: rgba(79, 70, 229, 0.08);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 500;
    color: var(--text-color);
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

.user-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 0.75rem;
}

.dropdown-item:hover {
    background-color: rgba(79, 70, 229, 0.08);
    color: var(--primary-color);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* 购物车图标 */
.cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    color: var(--dark-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.cart-icon:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    border-color: var(--primary-color);
}

.cart-icon i {
    font-size: 1.2rem;
    color: inherit;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 通知图标 */
.notification-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(79, 70, 229, 0.08);
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-icon:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.notification-icon i {
    font-size: 1.2rem;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 移动端菜单按钮 */
.navbar-toggler {
    display: none;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-toggler:hover {
    background-color: rgba(79, 70, 229, 0.08);
}

.navbar-toggler i {
    font-size: 1.5rem;
}

/* 移动端菜单 */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu.show {
    right: 0;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-close:hover {
    background-color: #f3f4f6;
    color: var(--danger-color);
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 0.75rem;
}

.mobile-nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.08);
}

.mobile-nav-link.active {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.12);
    font-weight: 600;
}

.mobile-nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.mobile-menu-user {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

.mobile-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem;
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.mobile-login-btn:hover {
    color: white;
    background-color: var(--primary-color);
}

.mobile-user-menu {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.mobile-user-menu.show {
    display: flex;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: #f3f4f6;
    border-radius: 8px;
}

.mobile-user-info i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.mobile-user-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-user-action {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 0.75rem;
}

.mobile-user-action:hover {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.08);
}

.mobile-user-action i {
    font-size: 1rem;
    width: 24px;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 991.98px) {
    .navbar-search {
        width: 180px;
    }
    
    .navbar-nav {
        display: none;
    }
    
    .navbar-user {
        display: none;
    }
    
    .navbar-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .navbar-brand img {
        height: 32px;
    }
    
    .navbar.scrolled .navbar-brand img {
        height: 28px;
    }
    
    .navbar-search {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .navbar-container {
        padding: 0 0.75rem;
    }
    
    .mobile-menu {
        width: 100%;
        max-width: 100%;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .navbar {
        background: rgba(31, 41, 55, 0.95);
    }
    
    .navbar-brand {
        color: var(--primary-light);
    }
    
    .navbar-brand:hover {
        color: var(--primary-light);
    }
    
    .nav-link {
        color: #e5e7eb;
    }
    
    .nav-link:hover {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.15);
    }
    
    .nav-link.active {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.2);
    }
    
    .navbar-search {
        background-color: #374151;
    }
    
    .navbar-search:hover {
        background-color: #4b5563;
    }
    
    .navbar-search input {
        color: #e5e7eb;
    }
    
    .navbar-search input::placeholder {
        color: #9ca3af;
    }
    
    .navbar-user a {
        color: #e5e7eb;
    }
    
    .navbar-user a:hover {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.15);
    }
    
    .login-btn {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.15);
        border: 1px solid rgba(79, 70, 229, 0.3);
    }
    
    .login-btn:hover {
        color: white;
        background-color: var(--primary-light);
    }
    
    .user-menu-trigger:hover {
        background-color: rgba(79, 70, 229, 0.15);
    }
    
    .user-name {
        color: #e5e7eb;
    }
    
    .user-dropdown {
        background: #1f2937;
    }
    
    .dropdown-item {
        color: #e5e7eb;
    }
    
    .dropdown-item:hover {
        background-color: rgba(79, 70, 229, 0.15);
        color: var(--primary-light);
    }
    
    .cart-icon {
        background-color: rgba(79, 70, 229, 0.15);
        color: var(--primary-light);
    }
    
    .cart-icon:hover {
        background-color: var(--primary-light);
    }
    
    .notification-icon {
        background-color: rgba(79, 70, 229, 0.15);
        color: var(--primary-light);
    }
    
    .notification-icon:hover {
        background-color: var(--primary-light);
    }
    
    .navbar-toggler {
        color: var(--primary-light);
    }
    
    .navbar-toggler:hover {
        background-color: rgba(79, 70, 229, 0.15);
    }
    
    .mobile-menu {
        background: #1f2937;
    }
    
    .mobile-menu-header {
        border-bottom: 1px solid #374151;
    }
    
    .mobile-menu-close {
        color: #e5e7eb;
    }
    
    .mobile-menu-close:hover {
        background-color: #374151;
        color: var(--danger-color);
    }
    
    .mobile-nav-link {
        color: #e5e7eb;
    }
    
    .mobile-nav-link:hover {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.15);
    }
    
    .mobile-nav-link.active {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.2);
    }
    
    .mobile-login-btn {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.15);
        border: 1px solid rgba(79, 70, 229, 0.3);
    }
    
    .mobile-login-btn:hover {
        color: white;
        background-color: var(--primary-light);
    }
    
    .mobile-user-info {
        background-color: #374151;
    }
    
    .mobile-user-info i {
        color: var(--primary-light);
    }
    
    .mobile-user-action {
        color: #e5e7eb;
    }
    
    .mobile-user-action:hover {
        color: var(--primary-light);
        background-color: rgba(79, 70, 229, 0.15);
    }
    
    .mobile-menu-user {
        border-top: 1px solid #374151;
    }
}
