/**
 * 公共头部样式
 * 所有页面共用统一样式
 */

/* ========================================
   顶部导航栏
   ======================================== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px #E4E7ED solid;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    margin: 0 auto;
    padding: 0;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon img {
    width: 24px;
    height: 24px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 15px;
    font-weight: 600;
    color: #1A1A2E;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 11px;
    color: #5E6C84;
    line-height: 1.2;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.nav-link {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #4A5565;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: #155DFC;
    background: #F9FAFB;
}

.nav-link.active {
    color: #155DFC;
    background: #EFF6FF;
}

/* 登录按钮（未登录） */
.nav-login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: #155DFC;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
    text-decoration: none;
    transition: background 0.2s ease;
}

.nav-login-btn:hover {
    background: #1447E6;
}

.nav-login-icon {
    width: 18px;
    height: 18px;
}

/* 用户下拉触发器 */
.nav-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.nav-user-trigger:hover {
    background: #F3F4F6;
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #155DFC;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.nav-user-name {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
}

.nav-user-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.nav-user-trigger.active .nav-user-arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 192px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0px 4px 6px -4px rgba(0, 0, 0, 0.10), 0px 10px 15px -3px rgba(0, 0, 0, 0.10);
    outline: 1px #F3F4F6 solid;
    outline-offset: -1px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.nav-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 14px;
    color: #364153;
    text-decoration: none;
    transition: background 0.2s ease;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.nav-dropdown-item:hover {
    background: #F9FAFB;
}

.nav-dropdown-item img {
    width: 16px;
    height: 16px;
}

.nav-dropdown-divider {
    height: 1px;
    background: #F3F4F6;
    margin: 8px 0;
}

.nav-dropdown-item-danger {
    color: #E7000B;
    font-weight: 500;
}

.nav-dropdown-item-danger:hover {
    background: #FEF2F2;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #364153;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .nav-menu {
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        background: #FFFFFF;
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.10);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }

    .nav-menu.mobile-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
    }

    .nav-login-btn {
        width: 100%;
        justify-content: center;
    }

    .nav-user-dropdown {
        width: 100%;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        outline: none;
        padding: 0 0 0 32px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }

    .nav-dropdown-menu.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        padding: 0 16px;
    }

    .logo-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 12px;
    }
}
