/**
 * 头部导航样式
 */

.main-header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 500;
    color: #333;
}

.logo img {
    height: 32px;
}

/* 主导航 */
.main-nav {
    display: flex;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    transition: all 0.3s;
}

.nav-item:hover {
    background: #f5f5f5;
    color: #333;
}

.nav-item.active {
    background: #f0f7e6;
    color: #b1ce48;
}

.nav-item i {
    font-size: 20px;
}

/* 搜索框 */
.header-search {
    flex: 1;
    max-width: 320px;
    margin: 0 24px;
}

.header-search form {
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    transition: all 0.3s;
}

.header-search input:focus {
    outline: none;
    border-color: #b1ce48;
}

.header-search button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #999;
}

/* 右侧操作区 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-login,
.btn-register {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-login {
    color: #666;
}

.btn-login:hover {
    color: #333;
}

.btn-register {
    background: #b1ce48;
    color: #fff;
}

.btn-register:hover {
    background: #9ab73a;
}

/* 发布下拉菜单 */
.publish-dropdown {
    position: relative;
}

.btn-publish {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #b1ce48;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.btn-publish i {
    font-size: 18px;
}

.btn-publish .arrow {
    font-size: 16px;
    transition: transform 0.2s;
}

.publish-dropdown:hover .btn-publish .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0;
    padding-top: 8px;
    background: transparent;
    border-radius: 12px;
    min-width: 160px;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.dropdown-menu-inner {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 8px 0;
}

.publish-dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.publish-dropdown .dropdown-menu {
    transition-delay: 0.15s;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    transition: all 0.2s;
}

.dropdown-menu a:hover {
    background: #f5f5f5;
    color: #b1ce48;
}

.dropdown-menu a i {
    font-size: 20px;
    color: #666;
}

.dropdown-menu a:hover i {
    color: #b1ce48;
}

/* 通知按钮 */
.header-actions .action-btn.notification-btn {
    position: relative;
    padding: 8px;
    color: #666;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions .action-btn.notification-btn:hover {
    background: #f5f5f5 !important;
}

.notification-btn i {
    font-size: 24px;
}

.notification-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ff6b6b;
    border-radius: 50%;
}

/* 通知角标 */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ff4757;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
}

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

.user-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    cursor: pointer;
    display: block;
}

.user-dropdown .dropdown-menu {
    right: 0;
    min-width: 200px;
}

.user-dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.user-dropdown .dropdown-menu {
    transition-delay: 0.15s;
}

.user-info {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.user-info strong {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #b1ce48;
}

.verified-badge i {
    font-size: 14px;
}

.user-dropdown .dropdown-menu .divider {
    height: 1px;
    background: #f0f0f0;
    margin: 8px 0;
}

.user-dropdown .dropdown-menu a.logout {
    color: #ff6b6b;
}

.user-dropdown .dropdown-menu a.logout i {
    color: #ff6b6b;
}

/* Tooltip 样式 */
.user-avatar-wrapper {
    position: relative;
    display: inline-block;
}

.user-tooltip {
    position: absolute;
    bottom: -30px;
    left: 0;
    transform: translateX(-10%);
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
    z-index: 10000;
    pointer-events: none;
}

.user-tooltip::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 20%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.75);
}

/* 悬停头像时显示 tooltip */
.user-avatar-wrapper:hover .user-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ==================== 移动端响应式适配 ==================== */

/* 平板 */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 16px;
    }

    .main-nav {
        gap: 4px;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    .nav-item i {
        font-size: 18px;
    }

    .header-search {
        max-width: 240px;
        margin: 0 16px;
    }
}

/* 手机端 */
@media (max-width: 768px) {
    .main-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    .header-container {
        height: 56px;
        padding: 0 12px;
    }

    .logo {
        font-size: 18px;
    }

    .logo img {
        height: 28px;
    }

    /* 主导航简化 - 只显示图标 */
    .main-nav {
        gap: 2px;
    }

    .nav-item {
        padding: 8px;
        border-radius: 50%;
    }

    .nav-item span {
        display: none;
    }

    .nav-item i {
        font-size: 22px;
        margin: 0;
    }

    /* 搜索框隐藏 */
    .header-search {
        display: none;
    }

    /* 右侧操作区调整 */
    .header-actions {
        gap: 8px;
    }

    .btn-login,
    .btn-register {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* 发布按钮简化 */
    .btn-publish {
        padding: 6px 10px;
        border-radius: 50%;
    }

    .btn-publish span,
    .btn-publish .arrow {
        display: none;
    }

    /* 下拉菜单全宽 */
    .dropdown-menu {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        min-width: auto;
        padding-top: 0;
    }

    .dropdown-menu-inner {
        border-radius: 0 0 12px 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    /* 通知按钮调整 */
    .header-actions .action-btn.notification-btn {
        width: 36px;
        height: 36px;
    }

    .notification-btn i {
        font-size: 22px;
    }

    /* 用户头像调整 */
    .user-avatar {
        width: 32px !important;
        height: 32px !important;
    }

    /* 隐藏 tooltip */
    .user-tooltip {
        display: none;
    }

    /* 页面内容增加顶部间距 */
    body {
        padding-top: 56px;
    }

    .page-content {
        min-height: calc(100vh - 56px - 200px);
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .header-container {
        padding: 0 10px;
    }

    .logo-text {
        display: none;
    }

    .nav-item {
        padding: 6px;
    }

    .nav-item i {
        font-size: 20px;
    }

    .header-actions {
        gap: 6px;
    }
}
