/* 基础样式 */
:root {
    /* 主题色 */
    --primary-color: #D2691E;
    --primary-dark: #8B4513;
    --primary-light: #ffe8d5;
    
    /* 文字颜色 */
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --text-light: #bbb;
    
    /* 背景色 */
    --bg-primary: #f5f7fa;
    --bg-white: #ffffff;
    --bg-hover: #f8f9fa;
    
    /* 边框颜色 */
    --border-color: #ddd;
    --border-light: #e0e0e0;
    --border-lighter: #e8e8e8;
    --border-lightest: #f0f0f0;
    
    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 15px;
    --spacing-xl: 20px;
    --spacing-2xl: 30px;
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 15px;
    --radius-full: 25px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 40px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; }
body { background-color: var(--bg-primary); color: var(--text-primary); line-height: 1.4; padding-bottom: var(--spacing-lg); }

/* 主容器 */
.container { 
    max-width: 1200px;
    margin: 0 auto; 
    padding: 0 18px; 
}

/* 顶部区域 */
.top-section {
    background: #ffffff;
    color: #000000;
    padding-top: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 头部内容区 */
.header-content-wrapper {
    padding: 15px 0;
}

/* 顶部导航栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8e8e8;
    gap: 4px;
}

/* 左侧导航 */
.left-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    flex-shrink: 1;
    height: auto;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
}

.left-nav::-webkit-scrollbar {
    display: none;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-size: 0.75rem;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    white-space: nowrap;
    text-align: center;
    flex: 0 0 auto;
    min-width: fit-content;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nav-link i,
.nav-link svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    vertical-align: middle;
}

.nav-link:hover {
    background: rgba(210, 105, 30, 0.15);
    transform: translateY(-2px);
    color: #D2691E;
}

/* 时间显示 */
.time-display {
    color: #333;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 150px;
    gap: 2px;
}

.time-display #currentDate {
    font-weight: bold;
    font-size: 0.75rem;
    color: #333;
}

.time-highlight {
    font-weight: bold !important;
    color: #D2691E !important;
    font-size: 0.95rem !important;
    padding: 0 4px;
}

.time-display #currentTime {
    font-size: 1rem;
    font-weight: bold;
    color: #D2691E;
}

/* 农历显示 */
.lunar-date {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-top: 2px;
}

/* 头部主体内容 */
.header-main {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    width: 180px;
    height: 50px;
}

.logo-section img {
    height: 40px;
    border-radius: 6px;
}

.logo-section i {
    font-size: 2rem;
    color: #D2691E;
}

.site-title-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.site-title-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.site-title {
    font-size: 20px;
    font-weight: bold;
    color: #D2691E;
    white-space: nowrap;
}

.site-subtitle {
    font-size: 0.65rem;
    color: #666;
    margin-top: 0px;
}

/* 搜索框 */
.search-wrapper {
    flex: 1;
    max-width: 750px;
    min-width: 300px;
    margin: 0 auto;
    position: relative;
}

.search-box {
    display: flex;
    gap: 0;
    position: relative;
}

#searchInput {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 25px 0 0 25px;
    outline: none;
    font-size: 1rem;
    background: #fff;
    transition: all 0.3s;
}

#searchInput:focus {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.baidu-search-btn {
    padding: 12px 25px;
    background: #D2691E;
    color: #ffffff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.baidu-search-btn:hover {
    background: #B8560F;
}

.site-search-btn {
    padding: 12px 20px;
    background: #f5f7fa;
    color: #D2691E;
    border: 2px solid #ddd;
    border-left: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.site-search-btn:hover {
    background: #e8eaed;
    border-color: #ccc;
}

/* 搜索联想词 */
.search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: -1px;
    overflow: hidden;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #333;
}

.suggestion-item:hover {
    background: linear-gradient(to right, #ffe8d5, #fff);
    color: #D2691E;
}

.hot-icon {
    color: #ff4757;
    font-size: 0.8rem;
}

/* 搜索结果提示 */
#searchResultHint {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 10px 15px;
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
    z-index: 999;
    border-top: 1px solid #f0f0f0;
}

/* 天气和节日组合模块 */
.weather-festival-combo {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weather-city-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.weather-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.weather-day-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    min-width: 50px;
}

.weather-day-label-mini {
    font-size: 0.7rem;
    color: #666;
}

.weather-icon-mini {
    font-size: 1.2rem;
    color: #333;
}

.weather-temp-mini {
    font-size: 0.75rem;
    color: #333;
    font-weight: bold;
}

.city-name {
    background: rgba(210, 105, 30, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #D2691E;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.festival-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.festival-item-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(210, 105, 30, 0.08);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: #D2691E;
    white-space: nowrap;
}

.festival-icon-mini {
    font-size: 1rem;
    color: #D2691E;
}

.festival-name-mini {
    font-weight: bold;
}

.festival-days-mini {
    opacity: 0.9;
    font-size: 0.75rem;
}

/* 主体内容区 */
.main-content {
    margin-top: 25px;
}

/* 分类区域 */
.category {
    margin-bottom: 30px;
}

.category h2 {
    font-size: 1.3rem;
    color: #8B4513;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.category h2 i,
.category h2 svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.category-tooltip {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #3498db;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: normal;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    margin-left: 10px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    z-index: 100;
}

.category h2:hover .category-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(5px);
}

/* 链接网格 */
.links {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    position: relative; /* 为子元素的绝对定位提供参考 */
}

.link-card {
    background: white;
    padding: 10px 6px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    position: relative;
    overflow: visible; /* 改为 visible，让 tooltip 可以显示在外面 */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    z-index: 1; /* 基础层级 */
}

.link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-left-color: #3498db;
    background: linear-gradient(to bottom, #f8f9fa, white);
    z-index: 10; /* 悬停时提高层级 */
}

.link-card i,
.link-card svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: #3498db;
}

.link-card svg {
    width: 27px;
    height: 27px;
}

.link-card h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* 链接 tooltip */
.link-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: #ffffff;              /* 纯白色背景 */
    color: #333333;                   /* 黑色文字 */
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;                   /* 超高层级，确保在所有元素之上 */
    width: 400px;                     /* 固定宽度 400px */
    max-width: calc(100vw - 40px);    /* 最大宽度为屏幕宽 -40px，防止超出 */
    word-wrap: break-word;            /* 自动换行 */
    word-break: break-all;            /* 中英文混合换行 */
    white-space: normal;              /* 允许换行 */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), /* 柔和阴影 */
                0 0 0 1px rgba(0, 0, 0, 0.08);  /* 细边框效果 */
    height: auto;                     /* 高度自动 */
    max-height: none;                 /* 不限制最大高度 */
    pointer-events: none;             /* 不响应鼠标事件，避免遮挡 */
}

/* 当卡片在右侧时，tooltip 向左对齐 */
.link-card:nth-child(8n):hover .link-tooltip,
.link-card:nth-child(8n-1):hover .link-tooltip {
    left: auto;
    right: 0;
    transform: translateY(8px);
}

/* 当卡片在左侧时，tooltip 向右对齐 */
.link-card:nth-child(8n+1):hover .link-tooltip {
    left: 0;
    transform: translateY(8px);
}

.link-tooltip .tooltip-text {
    display: block;
    width: 100%;              /* 占满父容器 */
    overflow: visible;        /* 内容可见 */
    font-weight: 500;         /* 中等字重，更易读 */
}

.link-card:hover .link-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(12px); /* 悬停时稍微向下移动 */
}

/* 文章区域 */
.article-scroll-container {
    overflow-x: auto;
    padding-bottom: 10px;
}

.article-list-compact {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5列布局 */
    gap: 15px; /* 合理的间距 */
    min-width: 100%;
}

.article-item-compact {
    background: transparent;
    padding: 6px 10px;
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
    line-height: 1.5;
    border-bottom: 1px dashed #e0e0e0;
    transition: color 0.2s;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-item-compact:hover {
    color: #D2691E;
    text-decoration: underline;
}

/* 更多按钮样式 */
.article-more-btn-wrapper {
    text-align: center;
    margin-top: 15px;
}

.article-more-btn {
    background: linear-gradient(135deg, #8B4513, #D2691E);
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.article-more-btn:hover {
    background: linear-gradient(135deg, #D2691E, #8B4513);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.article-more-btn i {
    margin-right: 5px;
    transition: transform 0.3s;
}

.article-more-btn.expanded i {
    transform: rotate(180deg);
}

/* 视频区域 */
.video-section {
    margin-top: 30px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.video-thumbnail-item {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #8B4513, #D2691E);
}

.video-thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.video-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

.video-thumbnail-item:hover .video-play-icon {
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 30px 12px 10px;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: left;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 30px 0 20px;
    color: #999;
    margin-top: 40px;
}

footer p {
    margin: 8px 0;
    font-size: 0.9rem;
}

.hint {
    font-size: 0.8rem;
    color: #bbb;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .links {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .article-list-compact {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* 顶部导航栏优化 */
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .left-nav {
        flex-wrap: wrap;
        justify-content: center;
        order: 2;
    }
    
    .time-display {
        width: 100%;
        align-items: center;
        text-align: center;
        justify-content: center;
        order: 1;
        margin-left: 0 !important;
        padding-right: 0 !important;
        min-width: auto !important;
    }
    
    /* 头部内容区优化 */
    .header-content {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .logo-section {
        width: 100% !important;
        justify-content: center;
        height: auto !important;
    }
    
    .search-wrapper {
        width: 100% !important;
        max-width: none !important;
        min-width: auto !important;
        order: 2;
    }
    
    .search-box {
        flex-wrap: wrap;
    }
    
    #searchInput {
        border-radius: 25px;
        margin-bottom: 8px;
    }
    
    .baidu-search-btn {
        border-radius: 25px;
        flex: 1;
    }
    
    .site-search-btn {
        border-radius: 25px;
        border-left: 2px solid #ddd;
        flex: 1;
    }
    
    .weather-festival-combo {
        width: 100%;
        order: 3;
    }
    
    .weather-city-row {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .festival-section {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* 链接网格优化 */
    .links {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .link-card {
        padding: 8px 4px;
    }
    
    .link-card h3 {
        font-size: 0.75rem;
    }
    
    /* 文章列表优化 */
    .article-list-compact {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .popup-articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 视频网格优化 */
    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* 超小屏幕优化（手机竖屏） */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .nav-link {
        font-size: 0.7rem;
        padding: 4px 6px;
    }
    
    .links {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .link-card {
        padding: 6px 3px;
    }
    
    .link-card i,
    .link-card svg {
        width: 18px;
        height: 18px;
    }
    
    .link-card h3 {
        font-size: 0.7rem;
    }
    
    .article-list-compact {
        grid-template-columns: 1fr;
    }
    
    .popup-articles-grid {
        grid-template-columns: 1fr;
    }
    
    .weather-day-mini {
        min-width: 40px;
        padding: 4px 6px;
    }
    
    .weather-icon-mini {
        font-size: 1rem;
    }
    
    .festival-item-mini {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* 弹窗动画 */
@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes highlightPulse {
    0%, 100% {
        background-color: #fff3cd;
    }
    50% {
        background-color: #ffeb3b;
    }
}

/* 打印机弹窗特殊样式 */
.printer-modal-content {
    max-height: 70vh;
    overflow-y: auto;
}
