/* 导航栏样式 */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 70px;
    background: linear-gradient(135deg, #764ba2, #1A202C);
    position: relative;
    z-index: 1000;
}

.nav-logo {
    color: white;
    font-size: 1.8em;
    text-align: center;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-links li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-btn {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.nav-btn.primary {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 用户头像和下拉菜单样式 */
.user-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 10px;
}

.user-avatar-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #5d4a82;
    color: white;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: none;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

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

.avatar-initial {
    font-size: 1.2rem;
    text-transform: uppercase;
}

/* 下拉菜单内容 */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 55px;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    min-width: 280px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-radius: 15px;
    z-index: 1000;
    overflow: hidden;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(118, 75, 162, 0.1);
}

/* 添加一个小三角形箭头指向用户头像 */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #fff;
    filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.05));
}

/* 悬停触发 */
.user-dropdown:hover .dropdown-content {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

/* 点击触发（由JavaScript控制） */
.dropdown-content.active {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

/* 用户信息区域 */
.dropdown-user-info {
    background: linear-gradient(135deg, #764ba2, #667eea);
    color: white;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dropdown-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #fff;
    margin-bottom: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border: 3px solid rgba(255,255,255,0.5);
}

.dropdown-username {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.dropdown-email {
    font-size: 12px;
    opacity: 0.8;
}

/* 下拉菜单项 */
.dropdown-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
    position: relative;
    overflow: hidden;
}

/* 添加鼠标悬停时的动态效果 */
.dropdown-item::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #764ba2, #667eea);
    transition: width 0.3s ease;
}

.dropdown-item:hover::after {
    width: 100%;
}

.dropdown-item i {
    margin-right: 15px;
    width: 22px;
    text-align: center;
    font-size: 16px;
    color: #764ba2;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: rgba(118, 75, 162, 0.05);
    color: #764ba2;
    transform: translateX(5px);
}

.dropdown-item:hover i {
    color: #764ba2;
    transform: scale(1.2);
}

/* 分隔线 */
.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(118, 75, 162, 0.1), rgba(118, 75, 162, 0.3), rgba(118, 75, 162, 0.1));
    margin: 8px 15px;
}

/* 退出登录项特殊样式 */
.logout-item {
    color: #dc3545;
    margin-top: 5px;
    border-radius: 0 0 15px 15px;
}

.logout-item i {
    color: #dc3545;
}

.logout-item:hover {
    color: #fff;
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
}

.logout-item:hover i {
    color: #fff;
}

.logout-item::after {
    background: linear-gradient(90deg, #dc3545, #ff6b6b);
}

/* 登出表单 */
.logout-form {
    margin: 0;
    padding: 0;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* 登录模态框样式 */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.login-modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.login-modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.login-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #777;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .nav-links {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: linear-gradient(135deg, #764ba2, #1A202C);
        padding: 1rem 0;
        gap: 0.5rem;
        display: none;
        z-index: 1000;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links li {
        width: 100%;
        text-align: center;
    }
    
    .nav-links li a {
        display: block;
        padding: 12px 16px;
        width: 100%;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .nav-actions {
        flex-direction: column;
        position: absolute;
        top: 70px;
        right: 0;
        width: 100%;
        background: linear-gradient(135deg, #764ba2, #1A202C);
        padding: 1rem 0;
        gap: 0.5rem;
        display: none;
        z-index: 1000;
    }
    
    .nav-actions.active {
        display: flex;
    }
    
    .nav-actions .nav-btn {
        width: 90%;
        margin: 0 auto;
    }
    
    .user-dropdown {
        margin: 5px auto;
    }
    
    .user-avatar-btn {
        width: 36px;
        height: 36px;
    }
    
    .dropdown-content {
        position: fixed;
        top: 80px;
        left: 5%;
        right: 5%;
        width: 90%;
        max-width: 320px;
        margin: 0 auto;
        border-radius: 15px;
        transform: translateY(10px);
    }

    .dropdown-content::before {
        display: none; /* 移动端不显示小三角 */
    }
    
    .user-dropdown:hover .dropdown-content,
    .dropdown-content.active {
        transform: translateY(0);
    }
    
    .dropdown-user-info {
        padding: 20px;
    }
    
    .dropdown-avatar {
        width: 70px;
        height: 70px;
        margin-bottom: 15px;
    }
}
