/* 基础样式和CSS变量 */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white: #ffffff;
    --black: #171D38;
    
    /* 浅色主题 */
    --bg-color: rgba(255, 255, 255, 0.95);
    --text-color: #333333;
    --card-bg: rgba(255, 255, 255, 0.8);
    --nav-bg: rgba(255, 255, 255, 0.95);
    --search-bg: rgba(255, 255, 255, 0.9);
    --news-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --overlay-color: rgba(0, 0, 0, 0);
}

/* 暗黑主题 */
[data-theme="dark"] {
    --bg-color: rgba(30, 30, 30, 0.95);
    --text-color: #ffffff;
    --card-bg: rgba(40, 40, 40, 0.8);
    --nav-bg: rgba(30, 30, 30, 0.95);
    --search-bg: rgba(40, 40, 40, 0.9);
    --news-bg: rgba(35, 35, 35, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --overlay-color: rgba(0, 0, 0, 0.3);
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: url('https://baotangguo.cn:8081/') center/cover fixed;
    min-height: 100vh;
    overflow-x: hidden;
    transition: all 0.3s ease;
    width: 100%;
}

/* 背景遮罩层 */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-color);
    transition: background 0.5s ease;
    z-index: -1;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

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

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo i {
    color: var(--primary-color);
    font-size: 2.2rem;
    transition: transform 0.3s ease;
}

.nav-logo i:hover {
    transform: scale(1.1) rotate(5deg);
}

.nav-logo h2 {
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-logo:hover h2 {
    color: var(--info-color);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

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

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

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

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle, .mobile-menu-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover, .mobile-menu-toggle:hover {
    background: var(--primary-color);
    color: white;
}

.mobile-menu-toggle {
    display: none;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border-color);
    z-index: 1001;
    transition: right 0.3s ease;
    padding: 20px;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-links a:hover {
    background: var(--primary-color);
    color: white;
}

/* 主要内容 */
.main-content {
    margin-top: 60px;
    padding: 40px 20px;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* 搜索区域 */
.search-section {
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

#search-placeholder {
    transition: height 0.3s ease;
}

.search-section.sticky {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--search-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    padding: 20px;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.search-engine-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.search-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 60px;
}

.search-tab:hover {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.search-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.search-box {
    flex: 1;
    position: relative;
    display: flex;
    width: 80%;
}

.search-box input {
    flex: 1;
    padding: 12px 50px 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

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

.search-btn:hover {
    background: #0056b3;
    transform: translateY(-50%) scale(1.05);
}

/* 热点资讯 */
.news-section {
    background: var(--news-bg);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px var(--shadow-color);
    max-width: 900px;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 40px;
}

.news-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
}

.news-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 0 auto;
}

.news-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    width: calc(33.33% - 10px);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item:hover {
    transform: translateX(5px);
}

.news-tag {
    background: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.news-tag.hot {
    background: var(--danger-color);
}

.news-tag.new {
    background: var(--success-color);
}

/* 热搜排名 */
.news-rank {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--secondary-color);
    color: white;
    font-weight: bold;
    font-size: 14px;
    padding: 0 5px;
}

.news-rank-1 {
    background: #ff4d4f; /* 第一名红色 */
}

.news-rank-2 {
    background: #ff7a45; /* 第二名橙色 */
}

.news-rank-3 {
    background: #ffa940; /* 第三名黄色 */
}

/* 热搜热度标签 */
.news-hot {
    font-size: 12px;
    color: #ff4d4f;
    margin-left: 5px;
}

.news-item a {
    color: var(--text-color);
    text-decoration: none;
    flex: 1;
    transition: color 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-item a:hover {
    color: var(--primary-color);
}

/* 加载动画 */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    font-size: 16px;
    color: var(--text-color);
}

.loading-spinner i {
    font-size: 20px;
    color: var(--primary-color);
}

/* 错误消息 */
.error-message {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    font-size: 16px;
    color: var(--danger-color);
}

.error-message i {
    font-size: 20px;
}

/* 卡片区域 */
.cards-section {
    position: relative;
    padding: 20px 0;
}

.cards-grid {
    column-count: 2;
    column-gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.card {
    position: relative;
    display: inline-block;
    width: 100%;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.5s ease;
    break-inside: avoid;
}

.card-content {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.card:hover .card-content::before {
    left: 100%;
}

.card-content h3 {
    color: var(--text-color);
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: left;
    margin-left: 10px;
}

.card-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.card-link {
    min-width: 45%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-link i, 
.card-link img,
.card-link svg {
    font-size: 1.2rem;
    margin-right: 10px;
    color: var(--accent-color);
    min-width: 20px;
    max-width: 20px;
    max-height: 20px;
    object-fit: contain;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-link svg {
    fill: var(--primary-color);
    width: 20px;
    height: 20px;
}

.card-link:hover svg {
    fill: var(--info-color);
    transform: scale(1.1);
}

.card-link span {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    width: calc(100% - 30px); /* 减去图标宽度和右边距 */
    display: inline-block;
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.card:hover .card-content {
    transform: translateY(-10px);
    box-shadow: 0 12px 40px var(--shadow-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .search-container {
        flex-direction: column;
        width: 100%;
    }
    
    .search-engine-tabs {
        justify-content: center;
        gap: 6px;
    }
    
    .search-tab {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 50px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .cards-grid {
        column-count: 1;
        column-gap: 20px;
        padding: 0 1px;
    }
    
    .card {
        /* min-height: 350px; */
        padding: 15px;
    }
    
    .card-content {
        padding: 30px 20px;
    }
    
    .card-content h3 {
        font-size: 1.2rem;
        margin-left: 5px;
    }
    
    .card-content p {
        font-size: 1rem;
    }
    
    .card-icon {
        font-size: 2.5rem;
    }
    
    .news-section {
        padding: 20px;
        width: 100%;
    }
    
    .news-list {
        gap: 10px;
    }
    
    .news-item {
        width: 100%;
    }
    
    .card-links {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .card-link {
        padding: 10px 14px;
    }
    
    .card-link i {
        font-size: 1.1rem;
        margin-right: 8px;
    }
    
    .card-link span {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-logo h2 {
        font-size: 1.2rem;
    }
    
    .card-content {
        padding: 25px 15px;
    }
    
    .card-content h3 {
        font-size: 1.3rem;
    }
    
    .card-icon {
        font-size: 2rem;
    }
}

/* 滚动动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 加载动画 */
.loading {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.loading.loaded {
    opacity: 1;
    transform: translateY(0);
}
