/* ==================== 导航栏用户状态样式 ==================== */

/* 导航栏右侧区域 */
.public-header-right-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 功能导航链接 */
.header-nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

.header-nav-links .nav-item {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.header-nav-links .nav-item:hover {
    color: #0066ff;
    background: rgba(0, 102, 255, 0.1);
}

/* ==================== 搜索框样式 ==================== */
.header-search-box {
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #999;
    font-size: 14px;
    transition: color 0.3s ease;
}

.search-input {
    width: 180px;
    height: 36px;
    padding: 0 12px 0 36px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    font-size: 13px;
    color: #333;
    background: #f5f7fa;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    width: 240px;
    border-color: #0066ff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.search-input:focus + .search-icon,
.search-input-wrapper:focus-within .search-icon {
    color: #0066ff;
}

.search-input::placeholder {
    color: #999;
}

/* 搜索下拉结果 */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background: #f5f7fa;
}

.search-result-item.active .search-result-title {
    color: #0066ff;
}

.search-result-item i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 102, 255, 0.1);
    color: #0066ff;
    border-radius: 8px;
    font-size: 14px;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-desc {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-empty {
    padding: 30px 20px;
    text-align: center;
    color: #999;
}

.search-empty i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* 搜索分类标题 */
.search-category {
    padding: 8px 16px;
    background: #f8f9fa;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 响应式搜索框 */
@media (max-width: 1200px) {
    .search-input {
        width: 150px;
    }
    .search-input:focus {
        width: 200px;
    }
}

@media (max-width: 992px) {
    .header-search-box {
        display: none;
    }
}

/* ==================== 用户资料区域（已登录） ==================== */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 100;
}

/* 头像和下拉区域 - 添加悬停检测区域 */
.avatar-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 5px;
    margin: -5px;
}

.user-profile:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-profile .username {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* 头像和下拉区域 */
.avatar-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e8e8e8;
    transition: all 0.3s ease;
}

.user-profile:hover .user-avatar-img {
    border-color: #0066ff;
    transform: scale(1.05);
}

.dropdown-arrow {
    font-size: 12px;
    color: #999;
    transition: all 0.3s ease;
}

.user-profile:hover .dropdown-arrow {
    transform: rotate(180deg);
    color: #0066ff;
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999 !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* 确保hover时显示下拉菜单 */
.user-profile:hover .dropdown-menu,
.user-profile:focus-within .dropdown-menu,
.avatar-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background: #f5f5f5;
    color: #0066ff;
}

.dropdown-menu a i {
    width: 16px;
    text-align: center;
    color: #999;
}

.dropdown-menu a:hover i {
    color: #0066ff;
}

.dropdown-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 8px 0;
}

.logout-link {
    color: #ff4d4f !important;
}

.logout-link:hover {
    background: #fff1f0 !important;
}

.logout-link i {
    color: #ff4d4f !important;
}

/* 未登录状态 - 登录注册按钮 */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-buttons a {
    padding: 8px 20px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-login {
    color: #0066ff;
    border: 1px solid #0066ff;
    background: transparent;
}

.btn-login:hover {
    background: #0066ff;
    color: #fff;
}

.btn-register {
    color: #fff;
    background: #0066ff;
    border: 1px solid #0066ff;
}

.btn-register:hover {
    background: #0052cc;
    border-color: #0052cc;
}

/* 移动端头像 */
.mobile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}

/* 响应式适配 */
@media (max-width: 992px) {
    .header-nav-links {
        gap: 15px;
    }

    .header-nav-links .nav-item {
        font-size: 13px;
        padding: 6px 10px;
    }

    .user-profile .username {
        display: none;
    }
}

@media (max-width: 768px) {
    .public-header-right-nav {
        display: none;
    }

    .public-header-right-m-nav {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .public-header-right-m-nav-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.9);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .public-header-right-m-nav-btn:hover {
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .public-header-right-m-nav-btn i {
        font-size: 18px;
        color: #333;
    }
}

/* 下拉菜单箭头 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
    z-index: 9999;
}

/* 确保下拉菜单内容在最上层 */
.dropdown-menu a {
    position: relative;
    z-index: 10000;
}
