/* ===== 多级导航页头样式 ===== */

/* 基础变量 */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;

    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;

    --bg-page: #f1f3f5;
    --bg-card: #ffffff;
    --bg-input: #f8f9fa;
    --bg-hover: #e9ecef;

    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-muted: #8c8c8c;

    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 页头容器 */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    z-index: 101;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* 汉堡菜单按钮（移动端） */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 101;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

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

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* 导航链接容器 */
.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 导航链接基础样式 */
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 500;
}

/* 下拉菜单容器 */
.dropdown-container {
    position: relative;
}

/* 下拉触发器 */
.dropdown-trigger {
    position: relative;
    padding-right: 28px !important;
}

.dropdown-trigger .dropdown-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s;
}

.dropdown-trigger.active .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 下拉菜单项 */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.dropdown-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* 下拉菜单分隔线 */
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* 用户导航容器 */
.user-nav-container {
    position: relative;
}

.user-nav-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.user-nav-trigger:hover {
    background: var(--bg-hover);
}

.user-nav-trigger .dropdown-arrow {
    flex-shrink: 0;
}

/* 用户头像 */
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

/* 用户名 */
.user-name {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 登录按钮 */
.login-btn {
    background: var(--primary);
    color: white !important;
    padding: 8px 20px;
    border-radius: 6px;
    transition: background 0.2s;
}

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

/* 响应式设计 - 平板 */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 20px;
        gap: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
        border-radius: 6px;
    }

    .dropdown-container {
        width: 100%;
    }

    .dropdown-trigger {
        width: 100%;
        justify-content: space-between;
    }

    .dropdown-menu {
        position: static;
        margin-top: 4px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        box-shadow: none;
        border: none;
        background: var(--bg-input);
    }

    .dropdown-menu.active {
        display: block;
    }

    .user-nav-container {
        width: 100%;
    }

    .user-dropdown {
        position: static;
        margin-top: 4px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        box-shadow: none;
        border: none;
        background: var(--bg-input);
    }

    .user-dropdown.active {
        display: block;
    }

    .login-btn {
        width: 100%;
        text-align: center;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 480px) {
    .header-inner {
        padding: 12px 16px;
    }

    .logo-text {
        font-size: 18px;
    }

    .user-name {
        max-width: 80px;
    }
}
