/* 导航栏整体容器 */
.navbar {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px 30px; /* 保持左右边距 */
    position: relative;
    width: 100%;
    transition: all 0.3s ease;
    z-index: 999;
}

/* 导航栏容器 */
.navbar-container {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}



.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 28px;
    font-weight: 700;
    color: #3b82f6;
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.navbar-brand:hover {
    color: #2563eb; /* 悬停时可以稍微深一点 */
}



.navbar-brand img {
    height: 38px;
    margin-right: 10px;
    transition: filter 0.3s ease;
    flex-shrink: 0;
}

.navbar-brand:hover img {
    filter: brightness(0) saturate(100%) invert(29%) sepia(83%) saturate(3586%) hue-rotate(270deg) brightness(89%) contrast(98%);
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    list-style: none;
    gap: 0px;
    align-items: center;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto; /* 推到右边 */
}


.navbar-nav > li {
    flex-shrink: 0;
}



.content {
    flex: 1;
    min-width: 0;
}

/* 容器样式 - 改为全自适应 */
.container {
    max-width: 1600px; /* 或 1200px、1600px */
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}


/* 页面布局 - 移除padding，让内容真正铺满 */
.page-layout {
    display: flex;
    gap: 0; /* 移除gap，让主内容完全靠左 */
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100%;
    /* 移除padding: 0 30px */
}

/* 主内容区域 - 完全靠左铺满 */
.main {
    flex: 1;
    min-width: 0;
    padding: 0 30px; /* 只给主内容添加左右内边距 */
    padding-top: 0;
    min-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}



.footer {
    background-color: white;
    padding: 20px 0;
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    width: 100%;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}


/* 搜索框 - 紧跟在logo后面 */
.unified-search-form {
    display: flex;
    max-width: 400px;
    min-width: 200px;
    width: 300px; /* 固定宽度或使用flex: 1 */
    position: relative;
    flex-shrink: 1; /* 允许在小屏幕时缩小 */
}

.search-type-selector {
    position: relative;
    flex-shrink: 1; /* 允许缩小 */
}

.search-type-selector select {
    height: 38px;
    border: 1px solid #e5e7eb;
    border-right: none;
    border-radius: 20px 0 0 20px;
    padding: 0 15px;
    background-color: #f9f9f9;
    color: #333;
    font-size: 0.8rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    padding-right: 20px;
    min-width: 50px; /* 最小宽度 */
    width: 70px;
}

.search-type-selector::after {
    content: '\f0d7';
    font-family: 'FontAwesome';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
    font-size: 11px;
}

/* 确保选项在Windows上正常显示 */
.search-type-selector select option {
    background-color: #ffffff;
    color: #333333;
    padding: 8px;
}

.unified-search-form .search-form {
    flex: 1;
    display: flex;
    width: auto;
    position: relative;
    max-width: none;
    min-width: 60px; /* 搜索输入框最小宽度 */
}

.search-input {
    flex: 1;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-radius: 0 20px 20px 0;
    background-color: #f9f9f9;
    font-size: 0.8rem;
    outline: none;
    transition: all 0.3s ease;
    padding-right: 32px;
    min-width: 40px; /* 最小宽度 */
}

.search-input:focus {
    background-color: #fff;
}

.search-input.error {
    box-shadow: 0 0 0 2px #ef4444;
    animation: shake 0.5s ease-in-out;
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background-color: #3b82f6;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-btn:hover {
    background-color: #2563eb;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

/* 搜索历史下拉菜单 */
.search-history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    margin-top: 5px;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.history-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    font-size: 12px;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.clear-history {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.clear-history:hover {
    text-decoration: underline;
}

.history-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item:hover {
    background: #f8f9fa;
}

.history-item i {
    color: #6b7280;
    font-size: 12px;
}

/* 导航链接样式 */
.nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 8px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 14px;
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 5px;
    left: 10px;
    background-color: #3b82f6;
    transition: width 0.3s ease;
}

.nav-link:hover:after {
    width: calc(100% - 20px);
}

.nav-link:hover {
    color: #2563eb;
    text-decoration: none;
}

.nav-link i {
    font-size: 13px;
    flex-shrink: 0;
}

/* JS控制的下拉菜单样式 */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    user-select: none;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    padding: 8px 0;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 6px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

/* 当JS添加show类时显示下拉菜单 */
.dropdown.show .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover, .dropdown-item:focus {
    color: #2563eb;
    text-decoration: none;
    background-color: #f3f4f6;
}

.dropdown-item i {
    margin-right: 1px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    margin: 5px 0;
    background-color: #e5e7eb;
}

.badge {
    display: inline-block;
    padding: 0.2em 0.5em;
    font-size: 0.7em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.2rem;
}

.badge-light {
    color: #212529;
    padding: 3px 6px;
    background-color: #f8f9fa;
}

/* 搜索结果中的关键词高亮 */
mark {
    background-color: rgba(25, 152, 255, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* 用户信息下拉菜单样式 - 次要被挤压 */
.user-dropdown {
    position: relative;
}

.user-info-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 20px;
    transition: all 0.3s ease;
    max-width: 150px; /* 初始最大宽度 */
    min-width: 80px; /* 最小宽度 */
    text-decoration: none; /* 确保没有下划线 */
}

/* 重要：覆盖通用nav-link的after伪元素效果 */
.user-info-toggle:after {
    display: none !important; /* 完全隐藏下划线效果 */
}

.user-info-toggle:hover {
    background-color: #f0f0f0;
    text-decoration: none; /* 悬停时也不显示下划线 */
}

.user-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    flex-shrink: 0; /* 头像不缩小 */
}

.user-name {
    font-weight: 500;
    color: #333;
    max-width: 100px; /* 用户名最大宽度 */
    min-width: 30px; /* 用户名最小宽度 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    flex-shrink: 1; /* 允许用户名被挤压 */
}

.user-dropdown-menu {
    right: 0;
    left: auto;
    min-width: 160px;
}

/* 登录/注册按钮样式 */
.auth-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0; /* 登录注册按钮不被挤压 */
}

.nav-btn {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 13px;
    white-space: nowrap;
}

.nav-btn-login {
    background-color: transparent;
    color: #333;
    border-color: #e5e7eb;
}

.nav-btn-login:hover {
    background-color: #f5f5f5;
    color: #3b82f6;
    text-decoration: none;
}

.nav-btn-register {
    background-color: #3b82f6;
    color: white;
}

.nav-btn-register:hover {
    background-color: #2563eb;
    text-decoration: none;
}

/* 消息通知样式 */
.notification-dropdown {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    background: #ff4d4f;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out 0.2s forwards;
}

.notification-menu {
    width: 320px;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    position: absolute;
    right: 0;
    left: auto;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-weight: bold;
}

.read-all {
    font-size: 12px;
    text-decoration: none;
}

.read-all:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out 0.2s forwards;
}


.notification-icon {
    margin-right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1890ff;
    flex-shrink: 0;
}


/* 修改通知菜单中的图标样式 */
.notification-item.unread .notification-icon {
    /* 移除统一的蓝色样式 */
    background-color: #f5f5f5;
    color: #666;
}

.notification-item:hover {
    background-color: #f7f7f7;
    text-decoration: none;
}

.notification-item.unread:hover {
    background-color: #d6eeff;
}


/* 按消息类型设置不同的通知图标颜色 */
.notification-item.unread[data-msgtype="1"] .notification-icon {
    background-color: #fff7e6;
    color: #fa8c16; /* 系统通知 - 橙色图标 */
}

.notification-item.unread[data-msgtype="2"] .notification-icon {
    background-color: #f6ffed;
    color: #52c41a; /* 点赞消息 - 绿色图标 */
}

.notification-item.unread[data-msgtype="3"] .notification-icon {
    background-color: #f9f0ff;
    color: #722ed1; /* 评论消息 - 紫色图标 */
}

.notification-item.unread[data-msgtype="4"] .notification-icon {
    background-color: #fff0f6;
    color: #eb2f96; /* 站内消息 - 粉色图标 */
}

/* 同时修改消息类型标签的颜色 */
.notification-item.unread[data-msgtype="1"] .notification-type {
    background-color: #fff7e6;
    color: #fa8c16;
}

.notification-item.unread[data-msgtype="2"] .notification-type {
    background-color: #f6ffed;
    color: #52c41a;
}

.notification-item.unread[data-msgtype="3"] .notification-type {
    background-color: #f9f0ff;
    color: #722ed1;
}

.notification-item.unread[data-msgtype="4"] .notification-type {
    background-color: #fff0f6;
    color: #eb2f96;
}


.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.notification-item.unread .notification-title {
    font-weight: 600;
}

.notification-type {
    background-color: #e6f7ff;
    padding: 2px 8px;
    border-radius: 10px;
    color: #1890ff;
    font-size: 12px;
    margin-right: 5px;
}

.notification-detail {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.notification-time {
    font-size: 12px;
    color: #999;
}

.notification-text {
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notification-footer {
    padding: 10px 15px;
    text-align: center;
    border-top: 1px solid #eee;
}

.notification-footer a {
    color: #666;
    font-size: 13px;
    text-decoration: none;
}

.notification-footer a:hover {
    color: #2563eb;
}

.empty-notification {
    padding: 30px 0;
    text-align: center;
    color: #999;
}

.empty-notification i {
    font-size: 36px;
    margin-bottom: 10px;
}


/* 移动端菜单样式 */
.mobile-menu-toggle {
    display: none;
}

#mobileMenuBtn {
    background: transparent;
    border: none;
    color: #3b82f6;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#mobileMenuBtn:hover {
    color: #2563eb;
}

/* 移动端侧边栏 */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 280px;
    height: 100%;
    background-color: #fff;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-sidebar.active {
    right: 0;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.mobile-brand {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: #3b82f6;
    text-decoration: none;
}


.mobile-brand img {
    height: 30px;
    margin-right: 8px;
}

.mobile-sidebar-close {
    background: transparent;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.mobile-nav {
    flex: 1;
    overflow-y: auto;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 15px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-nav-link:hover, .mobile-nav-link:active {
    background-color: #f5f5f5;
    color: #2563eb;
}

.mobile-nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-nav-toggle i:first-child {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.toggle-icon {
    transition: transform 0.3s ease;
    margin-left: auto;
}

.mobile-nav-toggle.active {
    color: #3b82f6;
}

.mobile-nav-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.mobile-subnav {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #f9f9f9;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-subnav.active {
    max-height: 500px;
}

.mobile-subnav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px 12px 45px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.mobile-subnav-link:hover {
    background-color: #f0f0f0;
    color: #2563eb;
}

.mobile-subnav-link .badge {
    font-size: 12px;
    background-color: #f0f0f0;
    color: #666;
    padding: 2px 6px;
    border-radius: 10px;
}

.mobile-sidebar-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mobile-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-btn-login {
    background-color: #f0f0f0;
    color: #333;
}

.mobile-btn-login:hover {
    background-color: #e5e5e5;
}

.mobile-btn-register {
    background-color: #3b82f6;
    color: white;
}

.mobile-btn-register:hover {
    background-color: #2563eb;
}

.mobile-btn-logout {
    background-color: #f5f5f5;
    color: #666;
    width: 100%;
}

.mobile-btn-logout:hover {
    background-color: #e5e5e5;
}

.mobile-user-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.mobile-user-link:hover {
    background-color: #f0f0f0;
}

.mobile-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.mobile-badge {
    background-color: #ff4d4f;
    color: white;
    border-radius: 10px;
    padding: 0px 6px;
    font-size: 12px;
    margin-left: 5px;
}

@media (max-width: 768px) {
    /* 移动端改回grid布局以支持换行 */
    .navbar-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: 10px;
        align-items: center;
    }
    
    /* 导航栏整体容器 */
    .navbar {
        padding: 15px 10px;
    }
    
    .navbar-brand {
        grid-column: 1;
        grid-row: 1;
        font-size: 20px;
        justify-self: start;
    }
    
    /* 搜索框占满第二行 */
    .unified-search-form {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: 100%;
        width: 100%;
        min-width: 200px;
        margin: 10px 0 0 0;
        justify-self: stretch;
    }
    
    .navbar-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        margin-left: 0;
    }
    
    .main {
        padding-top: 0;
        min-height: calc(100vh - 120px);
        display: flex;
        flex-direction: column;
        padding-left: 0;
        padding-right: 0;
        overflow-x: hidden;
    }
}

/* 通用方法 - 隐藏所有下拉相关容器的滚动条 */
.dropdown-menu,
.search-history-dropdown,
.notification-menu,
.notification-list,
.mobile-nav,
.mobile-subnav {
    /* WebKit浏览器 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.dropdown-menu::-webkit-scrollbar,
.search-history-dropdown::-webkit-scrollbar,
.notification-menu::-webkit-scrollbar,
.notification-list::-webkit-scrollbar,
.mobile-nav::-webkit-scrollbar,
.mobile-subnav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

