/* 导航栏样式 */
.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 0;
    position: relative; /* 从fixed改为relative，使导航栏随页面滚动 */
    width: 100%;
    z-index: 1;
    transition: all 0.3s ease;
}

.navbar-container {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 23px;
    font-weight: 700;
    background: linear-gradient(90deg, #1998ff, #8a2be2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    justify-self: start;
    grid-column: 1;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    background: linear-gradient(90deg, #8a2be2, #1998ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

.navbar-brand::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: sweep 3s infinite;
}

@keyframes sweep {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: -100%;
    }
}


.navbar-brand img {
    height: 36px;
    margin-right: 10px;
    transition: filter 0.3s ease;
}

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

.search-form {
    grid-column: 2;
    justify-self: center;
    display: flex;
    width: 100%;
    max-width: 300px;
    position: relative;
}

.navbar-nav {
    grid-column: 3;
    justify-self: end;
    display: flex;
    flex-direction: row;
    list-style: none;
    gap: 15px;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* 确保主内容区域也有合适的样式 */
.content {
    flex: 1; /* 让内容区域占据剩余空间 */
    min-width: 0; /* 防止内容溢出 */
}

/* 主体内容区域 - 不再需要为固定导航栏留空间 */
.main {
    padding-top: 0; /* 移除顶部间距，因为导航栏不再固定 */
    min-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

/* 三栏布局容器 */
.page-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 40px;
}

/* 页脚 */
.footer {
    background-color: white;
    padding: 20px 0;
    margin-top: auto;
    border-top: 1px solid var(--border);
    width: 100%;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
    color: var(--gray);
    text-align: center;
}

/* 搜索框样式增强 */
.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(25, 152, 255, 0.15);
    outline: none;
}

.search-input.error {
    box-shadow: 0 0 0 2px var(--danger);
    animation: shake 0.5s ease-in-out;
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
}

@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 var(--border-radius) var(--border-radius);
    box-shadow: var(--box-shadow);
    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: var(--light);
    font-size: 12px;
    color: var(--gray);
    border-bottom: 1px solid var(--border);
}

.clear-history {
    background: none;
    border: none;
    color: var(--primary);
    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: var(--light);
}

.history-item i {
    color: var(--gray);
    font-size: 12px;
}

/* 导航链接 */
.nav-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover:after {
    width: 100%;
}

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

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

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    display: none;
    min-width: 160px;
    padding: 5px 0;
    margin: 12px 0 0;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-item {
    display: block;
    padding: 8px 20px;
    clear: both;
    font-weight: 400;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item:hover, .dropdown-item:focus {
    color: #262626;
    text-decoration: none;
    background-color: #f5f5f5;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .navbar-container {
        grid-template-columns: auto 1fr auto;
    }
    
    .search-form {
        grid-column: 2;
        justify-self: center;
        max-width: 250px;
    }
    
    .page-layout {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }
    
    .navbar-nav {
        display: none;
    }
    
    .search-form {
        max-width: 100%;
    }
    
    .dropdown-menu {
        position: static;
        float: none;
        width: auto;
        margin-top: 0;
        background-color: transparent;
        border: 0;
        box-shadow: none;
        max-height: none;
    }
    
    .dropdown-item {
        padding-left: 35px;
    }
    
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 576px) {
    .search-form {
        max-width: 150px;
    }
    
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* 响应式调整 - 搜索历史 */
@media (max-width: 767px) {
    .search-history-dropdown {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 110px;
        border-radius: var(--border-radius);
    }
}

/* 统一搜索框样式 - 修复版 */
.unified-search-form {
    display: flex;
    max-width: 400px;
    width: 100%;
    position: relative;
    grid-column: 2;
    justify-self: center;
}

.search-type-selector {
    position: relative;
    flex-shrink: 0;
}

.search-type-selector select {
    height: 38px;
    border: 1px solid #e5e7eb;
    border-right: none;
    border-radius: 20px 0 0 20px;
    padding: 0 10px;
    background-color: #f9f9f9;
    color: #333;
    font-size: 0.85rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    padding-right: 25px;
    min-width: 80px;
}

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

.unified-search-form .search-form {
    flex: 1;
    display: flex;
    width: auto;
    position: relative;
    max-width: none;
}

.unified-search-form .search-input {
    flex: 1;
    height: 38px;
    padding: 0 15px;
    border: 1px solid var(--border, #e5e7eb);
    border-left: none;
    border-radius: 0 20px 20px 0;
    background-color: #f9f9f9;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    padding-right: 40px;
}

.unified-search-form .search-input:focus {
    border-color: var(--primary, #1998ff);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(25, 152, 255, 0.1);
}

.unified-search-form .search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary, #1998ff);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unified-search-form .search-btn:hover {
    background-color: #0c7cd5;
}

/* 统一搜索框响应式适配 */
@media (max-width: 992px) {
    .unified-search-form {
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .unified-search-form {
        max-width: 100%;
        margin: 10px 0;
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    .search-type-selector select,
    .unified-search-form .search-input {
        height: 36px;
        font-size: 0.85rem;
    }
    
    .navbar-container {
        grid-template-rows: auto auto;
    }
}

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

/* 下拉菜单分隔线 */
.dropdown-divider {
    height: 1px;
    margin: 5px 0;
    background-color: #e5e7eb;
}

/* 消息通知样式开始 */
/* 消息下拉菜单容器 */
.notification-dropdown {
    position: relative;
}

/* 未读消息红色徽章 - 修正位置 */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -8px; /* 向右调整位置，避免挡住图标 */
    background: #ff4d4f;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
}

/* 消息下拉菜单 - 开始 */
.notification-menu {
    width: 320px;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    position: absolute;
    right: 0; /* 确保菜单从右侧对齐 */
    left: auto; /* 不从左侧对齐 */
    /* 确保在小屏幕上也能显示完整 */
    @media (max-width: 576px) {
        right: -50px; /* 在小屏幕上向左移动 */
        width: 280px; /* 在小屏幕上减小宽度 */
    }
}

/* 消息 */
.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;
    color: #1890ff;
}

.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;
}

/* 未读消息样式 */
.notification-item.unread {
    background-color: #e6f7ff;
}

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

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

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

/* 未读消息图标样式 */
.notification-item.unread .notification-icon {
    background-color: #bae7ff;
    color: #096dd9;
}

.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;
}

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

.empty-notification i {
    font-size: 36px;
    margin-bottom: 10px;
}
/* 添加到您的CSS文件中 */
.notification-badge {
    opacity: 0; /* 初始完全透明 */
    animation: fadeIn 0.3s ease-in-out 0.2s forwards; /* 延迟0.2秒后显示 */
}

.notification-item {
    opacity: 0; /* 初始完全透明 */
    animation: fadeIn 0.3s ease-in-out 0.2s forwards; /* 延迟0.2秒后显示 */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 576px) {
    .notification-detail {
        max-width: 180px;
    }
    
    .notification-icon {
        width: 32px;
        height: 32px;
    }
}
/* 消息下拉菜单 - 结束 */

/* 移动端菜单样式 */
.mobile-menu-toggle {
    display: none; /* 默认隐藏，只在移动端显示 */
}

#mobileMenuBtn {
    background: transparent;
    border: none;
    color: var(--primary, #1998ff);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#mobileMenuBtn:hover {
    color: #0c7cd5;
}

/* 移动端侧边栏 */
.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;
    background: linear-gradient(90deg, #1998ff, #8a2be2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

.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: var(--primary, #1998ff);
}

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

/* 折叠菜单样式 */
.mobile-nav-toggle {
    display: flex;
    align-items: center;
    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;
}

/* 修改折叠菜单布局，使图标不那么分散 */
.mobile-nav-toggle {
    justify-content: space-between;
}

.toggle-icon {
    transition: transform 0.3s ease;
    margin-left: auto; /* 将箭头图标推到右侧 */
}

.mobile-nav-toggle.active {
    color: var(--primary, #1998ff);
}

.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: var(--primary, #1998ff);
}

/* 修改徽章样式 */
.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-register {
    background-color: var(--primary, #1998ff);
    color: white;
}

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

.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;
}

.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) {
    .navbar-container {
        grid-template-columns: auto 1fr auto;
    }
    
    .navbar-brand {
        grid-column: 1;
    }
    
    .navbar-nav {
        display: none; /* 隐藏顶部导航菜单 */
    }
    
    .mobile-menu-toggle {
        display: block; /* 显示移动端菜单按钮 */
        grid-column: 3;
        justify-self: end;
    }
}
