/* 综合站主页样式 - 参考设计 */

/* 隐藏原有header和底部导航 */
.home-portal ~ .header,
.home-portal ~ .bottom-nav {
    display: none !important;
}

/* ===== Hero 区域 ===== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.hero p {
    margin: 0 auto;
}

.hero-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-desc {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-search {
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 20px auto;
    background: white;
    border-radius: 50px;
    padding: 0.3rem 0.6rem 0.3rem 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: #999;
    margin-right: 0.8rem;
    flex-shrink: 0;
}

.hero-search input {
    flex: 1;
    border: none;
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
    background: transparent;
}

/* 搜索按钮 */
.search-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.search-button:active {
    transform: translateY(0);
}

.search-button-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ===== 移动端搜索头部 ===== */
.hero-search-header {
    display: none;
}

/* 桌面端隐藏 page-title */
.hero-search-header .page-title {
    display: none;
}

/* 确保首页的 page-header 和全局样式一致 */
.hero-search-header .page-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 20px 20px;
    text-align: center;
    position: relative;
}

/* 桌面端搜索框默认显示 */
.hero-search {
    display: flex;
}

/* 确保首页的 search-box 和搜索页一致 */
.hero-search-header .search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto 1rem auto;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.hero-search-header .search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.hero-search-header .search-box input:focus {
    border-color: #007bff;
}

.hero-search-header .search-box button {
    flex-shrink: 0;
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.hero-search-header .search-box button:hover {
    background: #0056b3;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.hero-stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* ===== 主导航 ===== */
.main-nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.nav-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG 图标样式 */
.nav-icon-svg {
    width: 1.8rem;
    height: 1.8rem;
    color: #667eea;
}

.nav-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.3rem 0;
}

.nav-content p {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
}

/* ===== 内容布局 ===== */
.content-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
}

.main-content {
    min-width: 0;
}

/* ===== 内容区块 ===== */
.content-section {
    margin-bottom: 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.section-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.section-link:hover {
    color: #667eea;
}

/* ===== 工具网格 ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.2rem;
    background: white;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.tool-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-name {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.4rem 0;
}

.tool-desc {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== 分类卡片（参考设计风格） ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.category-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.category-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.category-name {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
}

.category-count {
    background: #4F7BFF;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== 模型列表 ===== */
.models-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.model-card {
    display: block;
    padding: 1rem 1rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.model-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.model-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateX(4px);
}

.model-card:hover::before {
    transform: scaleY(1);
}

.model-card__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.model-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.model-card:hover .model-rank {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.model-card__meta {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.model-company {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.model-card:hover .model-company {
    background: rgba(102, 126, 234, 0.15);
}

.model-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-date {
    font-size: 0.85rem;
    color: #6c757d;
    flex-shrink: 0;
}

.model-card__description {
    font-size: 0.875rem;
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.model-card__description .model-date {
    font-weight: 500;
    color: #495057;
    margin-right: 0.5rem;
}

/* ===== 话题网格 ===== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* ===== 侧边栏 ===== */
.sidebar {
    position: sticky;
    top: 2rem;
    align-self: start;
}

.sidebar-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.sidebar-card:last-child {
    margin-bottom: 0;
}

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

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.sidebar-more {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.85rem;
}

.sidebar-more:hover {
    color: #667eea;
}

/* 今日话题（可滚动列表） */
.topics-card-large {
    height: 550px;
    display: flex;
    flex-direction: column;
    border: 1px solid #e9ecef;
}

/* 最新模型卡片 */
.models-card {
    border: 1px solid #e9ecef;
}

.topic-date-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.topics-scroll-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 自定义滚动条 */
.topics-scroll-list::-webkit-scrollbar {
    width: 4px;
}

.topics-scroll-list::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 2px;
}

.topics-scroll-list::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 2px;
}

.topics-scroll-list::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* 话题卡片 - BEM 命名风格 */
.topic-card {
    padding: 1.2rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    height: 100%;
}

.topics-grid .topic-card {
    display: flex;
    flex-direction: column;
}

.topic-card:hover {
    background: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.topic-card:active {
    background: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: scale(0.98);
}

.topic-card:hover .topic-card__title {
    color: #667eea;
}

.topic-card:active .topic-card__title {
    color: #667eea;
}

.topic-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.topic-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.8rem 0;
    line-height: 1.4;
}

.topic-card__summary {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
    /* 使用 CSS 实现省略号效果（可选，目前已在服务端处理） */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-topics {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    padding: 2rem 0;
}

/* 订阅简报卡片 */
.subscribe-card {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

/* 订阅组件在侧边栏的样式适配 */
.subscribe-card .subscription-widget {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #e9ecef;
    margin-bottom: 0;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 0;
    }

    .hero-container {
        padding: 0;
    }

    .hero-desc {
        display: none;
    }

    /* 移动端显示搜索头部 */
    .hero-search-header {
        display: block;
        background: #f8f9fa;
        padding: 0;
    }

    /* 移动端 page-header 样式 - 完整重置桌面端样式 */
    .hero-search-header .page-header {
        max-width: none;
        margin: 0 0 20px 0;
        padding: 0;
        text-align: center;
    }

    /* 移动端 page-title 样式 */
    .hero-search-header .page-title {
        display: block;
        font-size: 1.6rem;
        color: white;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 15px 20px;
        margin: 0 0 20px 0;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
        line-height: 1.2;
    }

    /* 移动端 search-box 样式 */
    .hero-search-header .search-box {
        flex-direction: row;
        gap: 8px;
        width: 100%;
        max-width: none;
        margin: 0 0 1rem 0;
    }

    .hero-search-header .search-box input {
        flex: 1;
        min-width: 0;
        font-size: 16px;
        margin-left: 10px;
    }

    .hero-search-header .search-box button {
        flex-shrink: 0;
        padding: 12px 20px;
        font-size: 14px;
    }

    /* 移动端隐藏桌面端搜索框 */
    .hero-search {
        display: none;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero .search-box {
        display: block;
    }

    .hero-stats {
        gap: 2rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .main-nav {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem 1rem 0.5rem;
        gap: 0.75rem;
    }

    .nav-item {
        padding: 0;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        background: white;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        position: relative;
        min-height: 90px;
        justify-content: center;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
        transition: all 0.2s ease;
    }

    .nav-item:active {
        border-color: #007bff;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
        transform: scale(0.98);
    }

    .nav-icon {
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }

    .nav-content h3 {
        font-size: 0.95rem;
        color: #212529;
        margin: 0;
        font-weight: 600;
    }

    .nav-content p {
        display: none;
    }

    .content-layout {
        padding: 0 1rem 2rem;
    }

    .content-section {
        margin-bottom: 2rem;
    }

    .section-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .section-link {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .category-count {
        padding: 0.2rem 0.3rem;
    }

    .tools-grid,
    .categories-grid,
    .topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tool-card {
        padding: 1rem;
        gap: 0.8rem;
    }

    .tool-icon {
        width: 40px;
        height: 40px;
    }

    .tool-name {
        font-size: 0.95rem;
    }

    .tool-desc {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }

    .category-card {
        padding: 0.5rem 0.8rem;
    }

    .category-name {
        font-size: 0.95rem;
        font-weight: 400;
    }

    .topic-card {
        padding: 1rem;
        /* 移动端优化触摸反馈 */
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    }

    .topic-card:active {
        transform: scale(0.98);
        background: white;
        border-color: #667eea;
    }

    .topic-card__title {
        font-size: 0.95rem;
        transition: color 0.2s ease;
    }

    .topic-card__summary {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
    }

    .sidebar-card {
        padding: 1.2rem;
    }

    .model-card {
        padding: 0.9rem;
    }

    .model-card__header {
        margin-bottom: 0.6rem;
    }

    .model-company {
        font-size: 0.8rem;
        padding: 0.15rem 0.35rem;
    }

    .model-name {
        font-size: 0.85rem;
    }

    .model-date {
        font-size: 0.8rem;
    }

    .model-card__description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 0;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-desc {
        font-size: 0.9rem;
    }

    /* 超小屏幕 search-box 样式 */
    .hero-search-header .search-box {
        gap: 6px;
        width: 100%;
    }

    .hero-search-header .search-box input {
        padding: 10px 12px;
        font-size: 16px;
        margin-left: 10px;
        width: 78%;
    }

    .hero-search-header .search-box button {
        padding: 10px 16px;
        font-size: 13px;
        margin-right: 10px;
    }

    .hero-search {
        max-width: 100%;
    }

    .search-button span {
        display: none;
    }

    .search-button {
        padding: 0.5rem;
    }

    .search-icon {
        width: 18px;
        height: 18px;
        margin-right: 0.5rem;
    }

    .hero-search input {
        font-size: 0.9rem;
    }

    .main-nav {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem 1rem 2rem;
        gap: 0.75rem;
    }

    .nav-item {
        padding: 0 0 8px 0;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        background: white;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        position: relative;
        min-height: 90px;
        justify-content: center;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
        transition: all 0.2s ease;
    }

    .nav-item:active {
        border-color: #007bff;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
        transform: scale(0.98);
    }

    .nav-icon {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .nav-content h3 {
        font-size: 0.95rem;
        color: #212529;
        margin: 0;
        font-weight: 600;
    }

    .nav-content p {
        display: none;
    }

    .tools-grid,
    .categories-grid,
    .topics-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        flex-direction: column;
        padding: 0.9rem;
    }

    .tool-icon {
        width: 36px;
        height: 36px;
    }

    .content-layout {
        padding: 0 0.8rem 1.5rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .section-link {
        font-size: 0.85rem;
    }
}
