/* ====================================================================
 * 荣州老柯 - 首页样式（main_index.css）
 * 版本：2026.10.03 v4.0
 * ==================================================================== */

:root {
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --accent-blue: #60a5fa;
    --accent-color: #60a5fa;
    --fitness-green: #10b981;
    --tech-purple: #8b5cf6;

    --dark-gray: #1f2937;
    --medium-gray: #4b5563;
    --light-gray: #9ca3af;
    --lighter-gray: #f3f4f6;
    --white: #ffffff;

    --warning: #f59e0b;
    --success: #10b981;
    --error: #ef4444;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s ease;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;

    --container-max-width: 1920px;
    --card-min-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.5;
    color: var(--dark-gray);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.user-name a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}
/* ==================== 头部 ==================== */
.header {
    background: linear-gradient(135deg, var(--dark-gray) 0%, var(--primary-blue) 100%);
    color: var(--white);
    padding: var(--space-sm) 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}
.site-brand { display: flex; align-items: center; gap: var(--space-sm); }
.logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--fitness-green), var(--primary-blue));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: white; font-size: 1rem; flex-shrink: 0;
}
.site-title { font-size: 1.25rem; font-weight: 600; white-space: nowrap; }
.top-right-info { display: flex; align-items: center; gap: var(--space-sm); }
.time-display {
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    white-space: nowrap;
}

/* 用户信息 */
.user-welcome {
    position: relative;
    display: flex; align-items: center; gap: var(--space-xs);
    cursor: pointer;
}
.user-tooltip {
    position: absolute;
    top: 100%; right: 0;
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    color: white;
    border-radius: 10px;
    padding: 12px 16px;
    min-width: 260px; max-width: 320px;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    font-size: 12px; line-height: 1.6;
    border: 1px solid rgba(255,255,255,0.15);
    pointer-events: none;
}
.user-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%; right: 20px;
    border-width: 8px; border-style: solid;
    border-color: transparent transparent rgba(0,0,0,0.92) transparent;
}
.tooltip-content div {
    margin: 6px 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tooltip-content i { width: 22px; color: var(--accent-blue); margin-right: 6px; }
.tooltip-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 0; }

.user-avatar {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--accent-blue), var(--tech-purple));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 0.75rem;
}
.user-name {
    font-size: 0.75rem; max-width: 100px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.btn {
    padding: var(--space-xs) var(--space-sm);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500; font-size: 0.75rem;
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: var(--space-xs);
    border: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--primary-blue); color: white; }
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-success { background: var(--fitness-green); color: white; }
.btn-primary:hover, .btn-secondary:hover, .btn-success:hover {
    transform: translateY(-1px); filter: brightness(1.05);
}

/* ==================== 主体 ==================== */
.main-content {
    flex: 1;
    max-width: var(--container-max-width);
    margin: var(--space-md) auto;
    padding: 0 var(--space-md);
    width: 100%;
}

.hero-banner {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--tech-purple) 100%);
    color: white;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-lg);
    position: relative; overflow: hidden;
}
.hero-title { font-size: 1.5rem; font-weight: 700; margin-bottom: var(--space-xs); line-height: 1.3; }
.hero-subtitle { font-size: 0.875rem; opacity: 0.9; margin-bottom: var(--space-sm); }
.hero-tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.hero-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 20px; font-size: 0.7rem;
}

/* ==================== 标签页 ==================== */
/*.section-tabs {*/
/*    display: flex; gap: var(--space-xs);*/
/*    margin-bottom: var(--space-md);*/
/*    overflow-x: auto; padding-bottom: var(--space-xs);*/
/*    scrollbar-width: thin;*/
/*    position: relative;*/
/*}*/
.section-tabs {
    display: flex;
    flex-wrap: wrap;        /* ← 改这里 */
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    position: relative;
    /* 删掉 overflow-x: auto */
}
.tab-btn {
    padding: var(--space-xs) var(--space-md);
    background: var(--white);
    border: 1px solid var(--lighter-gray);
    border-radius: 30px;
    font-weight: 500; font-size: 0.8rem;
    color: var(--medium-gray);
    cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.tab-btn.active { background: var(--primary-blue); color: white; border-color: var(--primary-blue); }

/* 医疗下拉 */
.tab-dropdown { position: relative; }
.tab-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%; left: 0;
    margin-top: 6px;
    background: #fff;
    border: 1px solid var(--lighter-gray);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    min-width: 140px;
    overflow: hidden;
    /* 关键：让它在父级 overflow 外也能显示 */
    pointer-events: auto;
}
.tab-dropdown-menu a {
    display: block;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: var(--medium-gray);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}
.tab-dropdown-menu a:hover { background: var(--lighter-gray); color: var(--primary-blue); }
.tab-dropdown.open .tab-dropdown-menu { display: block; }

/* ==================== 通用卡片（方案 A）==================== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width), 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex; flex-direction: column; height: 100%;
    border: 1px solid rgba(0,0,0,0.05);
    content-visibility: auto;
    contain-intrinsic-size: 120px;
}
#sports-section .card { contain-intrinsic-size: 60px; }
.section-compact .card { contain-intrinsic-size: 50px; }

.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card.clickable { cursor: pointer; }

.card-header {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--lighter-gray);
    display: flex; align-items: center; gap: var(--space-xs);
}
.card-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; flex-shrink: 0;
}
.card-icon.sports  { background: linear-gradient(135deg, var(--fitness-green), #34d399); color: white; }
.card-icon.tools   { background: linear-gradient(135deg, var(--tech-purple), #a78bfa); color: white; }
.card-icon.ai      { background: linear-gradient(135deg, #8B5CF6, #EC4899); color: white; }
.card-icon.general { background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue)); color: white; }

.card-title { font-size: 0.95rem; font-weight: 600; color: var(--dark-gray); line-height: 1.3; flex: 1; }

.more-btn {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--lighter-gray);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition);
    color: var(--medium-gray); font-size: 0.75rem;
    border: none; flex-shrink: 0;
}
.more-btn:hover { background: var(--primary-blue); color: white; }

.card-expand {
    display: none;
    padding: var(--space-sm);
    background: var(--lighter-gray);
    border-top: 1px dashed var(--light-gray);
    font-size: 0.8rem; color: var(--medium-gray); line-height: 1.5;
    max-height: 150px; overflow-y: auto;
}
.card-expand.show { display: block; }

.card-body {
    padding: var(--space-sm);
    flex: 1; display: flex; flex-direction: column;
}
.card-description {
    color: var(--medium-gray);
    margin-bottom: var(--space-sm);
    font-size: 0.8rem; line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-tags { display: none; flex-wrap: wrap; gap: var(--space-xs); margin-top: auto; }
.card.expanded .card-tags { display: flex; }

.tag {
    font-size: 0.6rem;
    padding: 2px 6px;
    background: var(--lighter-gray);
    border-radius: 4px;
    color: var(--medium-gray);
}
.card-footer {
    padding: var(--space-sm);
    border-top: 1px solid var(--lighter-gray);
    background: var(--lighter-gray);
}
.card-footer .btn { width: 100%; }

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.55rem; font-weight: 600;
    border-radius: 4px;
    margin-left: var(--space-xs);
}
.badge.new  { background: var(--fitness-green); color: white; }
.badge.ai   { background: var(--tech-purple); color: white; }
.badge.hot  { background: #ef4444; color: white; }
.badge.more { background: var(--light-gray); color: white; }

/* ==================== 老柯专区：列表化（方案 A）==================== */
/* ==================== 老柯专区：小卡片网格 ==================== */
#sports-section .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

#sports-section .card {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow-sm);
    background: #fff;
    transition: var(--transition);
    content-visibility: auto;
    contain-intrinsic-size: 130px;
}

#sports-section .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(37, 99, 235, 0.2);
}

#sports-section .card-header {
    border: none;
    padding: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

#sports-section .card-title {
    font-size: 0.9rem;
    font-weight: 600;
}

#sports-section .card-body {
    flex: 1;
    padding: 0 0 10px 0;
}

#sports-section .card-description {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 老柯专区：卡片内标签默认隐藏，展开时显示 */
#sports-section .card-tags {
    display: none;
}
#sports-section .card.expanded .card-tags {
    display: flex;
    margin-top: 6px;
}

#sports-section .card-expand {
    width: 100%;
    margin-top: 6px;
    font-size: 0.75rem;
    padding: 8px;
    border-radius: 6px;
}

#sports-section .card-footer {
    border: none;
    background: transparent;
    padding: 0;
}

#sports-section .card-footer .btn {
    width: 100%;
    justify-content: center;
}

/* ==================== 其它分类：紧凑列表（方案 C）==================== */
/* ==================== 其它分类：列表流 + 多列自适应 ==================== */
.section-compact .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 4px;
}

.section-compact .card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: none;
    background: #fff;
    transition: var(--transition);
    content-visibility: auto;
    contain-intrinsic-size: 48px;
}

.section-compact .card:hover {
    transform: none;
    background: #fafbff;
    border-color: rgba(37, 99, 235, 0.25);
}

.section-compact .card-header {
    border: none;
    padding: 0;
    flex: 0 0 auto;
}

.section-compact .card-icon {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.section-compact .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-compact .card-body {
    flex: 1;
    padding: 0 10px;
    min-width: 0;
}

.section-compact .card-description {
    margin: 0;
    font-size: 0.73rem;
    color: var(--medium-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.section-compact .card-footer {
    border: none;
    background: transparent;
    padding: 0;
    flex: 0 0 auto;
}

.section-compact .card-footer .btn {
    width: auto;
    padding: 3px 10px;
    font-size: 0.7rem;
    white-space: nowrap;
}

/* 紧凑列表内，展开区占满整行 */
.section-compact .card-expand {
    width: 100%;
    margin-top: 6px;
    font-size: 0.75rem;
    padding: 8px;
    border-radius: 6px;
}

.section-compact .card.expanded {
    flex-wrap: wrap;
}

/* ==================== 分组折叠（方案 B）==================== */
.section-expand-btn {
    margin-left: auto;
    background: var(--white);
    border: 1px solid var(--lighter-gray);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.7rem;
    color: var(--medium-gray);
    cursor: pointer;
    transition: var(--transition);
}
.section-expand-btn:hover { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); }

/* ==================== 区块外框 ==================== */
.ai-agents-section, .tools-section {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    border-radius: var(--border-radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid rgba(139, 92, 246, 0.1);
}
.section-header {
    margin-bottom: var(--space-sm);
    display: flex; align-items: center; gap: var(--space-xs);
}
.section-title { font-size: 1.1rem; font-weight: 600; color: var(--dark-gray); }

/* ==================== 登录提示按钮 ==================== */
.login-prompt {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 6px;
    cursor: pointer; transition: var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.login-prompt:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4); }
.login-prompt-content {
    padding: 10px 16px;
    color: white; font-weight: 600; font-size: 0.85rem;
    display: flex; align-items: center; gap: 8px;
}

/* ==================== 快速链接 ==================== */
.quick-links-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
}
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-xs);
}
.link-item {
    display: flex; align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--white);
    border-radius: 6px;
    text-decoration: none;
    color: var(--dark-gray);
    transition: var(--transition);
    font-size: 0.75rem;
    border: 1px solid rgba(0,0,0,0.05);
}
.link-item:hover { background: var(--primary-blue); color: white; transform: translateY(-1px); }
.link-icon { margin-right: var(--space-xs); font-size: 0.8rem; }

/* ==================== 页脚 ==================== */
.footer {
    background: var(--dark-gray);
    color: var(--white);
    padding: var(--space-lg) 0 var(--space-md);
    margin-top: auto;
}
.footer-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-lg);
}
.footer-section h3 {
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    color: var(--light-gray);
}
.footer-links { list-style: none; }
.footer-links li { margin-bottom: var(--space-xs); }
.footer-links a {
    color: var(--light-gray);
    text-decoration: none;
    font-size: 0.75rem;
    transition: var(--transition);
}
.footer-links a:hover { color: var(--white); padding-left: var(--space-xs); }
.legal-link {
    color: var(--light-gray);
    text-decoration: none;
    font-size: 0.7rem;
    display: flex; align-items: center; gap: var(--space-xs);
}
.copyright {
    text-align: center;
    padding-top: var(--space-md);
    margin-top: var(--space-md);
    border-top: 1px solid var(--medium-gray);
    color: var(--light-gray);
    font-size: 0.7rem;
    grid-column: 1 / -1;
}
.contact-info { color: var(--light-gray); font-size: 0.75rem; line-height: 1.6; }

.scroll-to-top {
    position: fixed;
    bottom: 60px; right: 10px;
    width: 36px; height: 36px;
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    z-index: 999;
    opacity: 0; transform: translateY(10px);
    border: none; cursor: pointer;
}
.scroll-to-top.visible { opacity: 1; transform: translateY(0); }

/* 登录弹窗按钮 hover */
.login-overlay-btn-primary:hover { background: #3b82f6 !important; transform: translateY(-2px); }
.login-overlay-btn-secondary:hover { background: #e5e7eb !important; }

/* ==================== 响应式 ==================== */
@media (min-width: 1440px) {
    :root { --card-min-width: 280px; --space-md: 1rem; }
}
@media (min-width: 2560px) {
    :root { --card-min-width: 320px; --space-md: 1.25rem; }
    .main-content { max-width: 2400px; }
}
@media (max-width: 768px) {
    :root { --card-min-width: 240px; --space-md: 0.75rem; }

    .header-content { flex-wrap: wrap; justify-content: center; }
    .site-brand { width: 100%; justify-content: center; }
    .hero-title { font-size: 1.25rem; }
    .card-expand { max-height: 120px; }

    /* 所有网格区域强制单列 */
    #sports-section .grid-container,
    .section-compact .grid-container {
        grid-template-columns: 1fr;
    }

    /* 紧凑列表卡片：换行布局，按钮换行 */
    .section-compact .card {
        flex-wrap: wrap;
    }
    .section-compact .card-body {
        flex: 1 1 100%;
        order: 3;
        padding: 6px 0 0 0;
    }
    .section-compact .card-footer {
        order: 4;
        flex: 1 1 100%;
        margin-top: 6px;
    }
    .section-compact .card-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    :root { --space-md: 0.5rem; --card-min-width: 100%; }
    .hero-title { font-size: 1.1rem; }
    .hero-tag { font-size: 0.6rem; }
    .btn { padding: 4px 8px; font-size: 0.7rem; }
    .user-name { max-width: 60px; }
    .link-grid { grid-template-columns: repeat(2, 1fr); }
    .user-tooltip { min-width: 220px; right: -20px; }
    .tooltip-content div { white-space: normal; word-break: break-all; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}