/* 青少年人工智能训练营 - 主样式表 */

/* 重置和基础样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #1f2937;
    --text-muted: #6b7280;
    --bg: #f3f4f6;
    --bg-white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* 顶部栏 */
.top-bar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-right { display: flex; align-items: center; gap: 16px; }
.top-bar a { color: var(--text-muted); }
.top-bar a:hover { color: var(--primary); }

.vip-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 主导航 */
.main-header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 700;
    font-size: 18px;
}

.logo:hover { color: var(--text); }
.logo-img { height: 40px; width: auto; }

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.logo-text { color: var(--text); }

.main-nav { display: flex; align-items: center; gap: 4px; }

.main-nav a {
    padding: 10px 16px;
    color: var(--text);
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.main-nav a:hover, .main-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.header-right { display: flex; align-items: center; gap: 12px; }

/* 用户下拉菜单 */
.user-dropdown { position: relative; }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-info:hover { background: var(--border); }

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.user-info span { font-size: 14px; color: var(--text); }
.user-info i { font-size: 12px; color: var(--text-muted); }

.dropdown-menu-custom {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 8px 0;
    display: none;
    z-index: 1000;
}

.dropdown-menu-custom.show { display: block; }

.dropdown-menu-custom a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
}

.dropdown-menu-custom a:hover { background: var(--bg); }
.dropdown-menu-custom .vip-link { color: var(--warning); }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* 轮播图 */
.banner-section { position: relative; overflow: hidden; width: 100%; }
.banner-slider { position: relative; width: 100%; height: 400px; }
.banner-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.5s ease-in-out; }
.banner-slide.active { opacity: 1; z-index: 1; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-slide a { display: block; width: 100%; height: 100%; }
.banner-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 10; }
.banner-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s; }
.banner-dot.active { background: #fff; transform: scale(1.2); }

.banner-placeholder {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 20px;
}

.banner-placeholder h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.banner-placeholder p { font-size: 16px; opacity: 0.9; }

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

/* 栏目导航 */
.category-nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 30px; }

.category-item {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    transition: all 0.3s;
    border: 1px solid var(--border);
    text-decoration: none;
    display: block;
}

.category-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }

.category-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.category-name { font-size: 15px; font-weight: 600; color: var(--text); }

/* 区块标题 */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before { content: ''; width: 4px; height: 22px; background: var(--primary); border-radius: 2px; }
.section-more { color: var(--text-muted); font-size: 14px; display: flex; align-items: center; gap: 4px; }
.section-more:hover { color: var(--primary); }

/* 内容卡片 */
.content-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.content-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.content-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.content-card-img {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    overflow: hidden;
}

.content-card-img img { width: 100%; height: 100%; object-fit: cover; }
.content-card-body { padding: 16px; }

.content-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-card-title a { color: inherit; }
.content-card-title a:hover { color: var(--primary); }

.content-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-muted); }
.content-card-price { font-size: 18px; font-weight: 700; color: var(--warning); }
.content-card-price.free { color: var(--success); font-size: 14px; }

/* 直播状态 */
.live-card { position: relative; }

.live-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
}

.live-status-badge.upcoming { background: var(--primary); color: #fff; }
.live-status-badge.live { background: #dc2626; color: #fff; animation: pulse 2s infinite; }
.live-status-badge.ended { background: #6b7280; color: #fff; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* 内容详情 */
.content-detail {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

.content-detail h1 { font-size: 26px; font-weight: 700; margin-bottom: 16px; line-height: 1.4; }

.content-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.content-meta span { display: flex; align-items: center; gap: 6px; }
.content-body { line-height: 1.8; font-size: 16px; }
.content-body img { max-width: 100%; border-radius: var(--radius); margin: 16px 0; }
.content-body p { margin-bottom: 16px; }

/* 详情页两栏布局 */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

/* 侧边栏 */
.sidebar { position: sticky; top: 90px; }

.sidebar-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.sidebar-card h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.price-display { text-align: center; padding: 20px 0; }
.price-display .price { font-size: 36px; font-weight: 700; color: var(--warning); }
.price-display .price.free { color: var(--success); font-size: 24px; }

.download-box { background: var(--bg); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.download-box label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; display: block; }

/* 页脚 */
.main-footer { background: #1f2937; color: #9ca3af; padding: 50px 0 30px; margin-top: 50px; }
.footer-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 30px; }
.footer-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer-logo-text { font-size: 18px; font-weight: 700; color: #fff; }
.footer-desc { font-size: 14px; line-height: 1.7; }
.footer-title { font-size: 16px; font-weight: 600; color: #fff; margin-bottom: 16px; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: #9ca3af; font-size: 14px; }
.footer-links a:hover { color: #fff; }
.footer-bottom { padding-top: 20px; border-top: 1px solid #374151; text-align: center; font-size: 13px; }

/* AI助手 */
.ai-assistant { position: fixed; bottom: 24px; right: 24px; z-index: 1000; }

.ai-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s;
}

.ai-toggle-btn:hover { transform: scale(1.1); }

.ai-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.ai-header {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-messages { height: 320px; overflow-y: auto; padding: 16px; }
.ai-input { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--border); }
.ai-input input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.ai-input button { padding: 10px 16px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 30px; }

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text);
    font-size: 14px;
    border: 1px solid var(--border);
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 表单 */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 500; margin-bottom: 8px; color: var(--text); }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.2s;
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f8fafc; padding: 12px 16px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: #f8fafc; }

/* 徽章 */
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-secondary { background: #f1f5f9; color: #64748b; }

/* 响应式 - 平板 */
@media (max-width: 1024px) {
    .content-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 响应式 - 手机 */
@media (max-width: 768px) {
    body { font-size: 14px; }
    .top-bar-inner { padding: 6px 16px; }
    .top-bar-right { gap: 10px; font-size: 12px; }
    .header-container { height: 56px; padding: 0 16px; }
    .logo { font-size: 16px; }
    .logo-icon { width: 36px; height: 36px; font-size: 14px; }
    .logo-text { display: none; }
    .main-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .header-right { display: none; }
    
    .banner-slider { height: 0; padding-bottom: 30%; }
    .banner-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
    .banner-placeholder { height: 0; padding-bottom: 56.25%; }
    .banner-placeholder h1 { font-size: 20px; }
    .banner-placeholder p { font-size: 14px; }
    .banner-dots { bottom: 12px; }
    .banner-dot { width: 8px; height: 8px; }
    
    .main-container { padding: 20px 16px; }
    .category-nav { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
    .category-item { padding: 14px 10px; border-radius: 8px; }
    .category-icon { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; margin-bottom: 8px; }
    .category-name { font-size: 13px; }
    
    .section-header { margin-bottom: 16px; }
    .section-title { font-size: 18px; }
    .section-title::before { height: 18px; }
    .section-more { font-size: 13px; }
    
    .content-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .content-card { border-radius: 8px; }
    .content-card-img { height: 100px; }
    .content-card-body { padding: 12px; }
    .content-card-title { font-size: 13px; margin-bottom: 6px; }
    .content-card-meta { font-size: 12px; }
    .content-card-price { font-size: 15px; }
    
    .content-detail { padding: 16px; border-radius: 8px; }
    .content-detail h1 { font-size: 20px; }
    .content-meta { gap: 12px; font-size: 13px; }
    .content-body { font-size: 14px; line-height: 1.7; }
    
    /* 详情页手机端单列布局：主内容在上，侧边栏在下 */
    .detail-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    .detail-layout .content-detail {
        order: 1;
        width: 100% !important;
    }
    .detail-layout .sidebar {
        order: 2;
        width: 100% !important;
        position: static !important;
    }
    
    .sidebar { position: static; }
    .sidebar-card { padding: 16px; border-radius: 8px; }
    .sidebar-card h4 { font-size: 16px; }
    .price-display .price { font-size: 28px; }
    
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .main-footer { padding: 30px 0 20px; }
    
    .ai-panel { width: calc(100vw - 32px); right: -8px; }
    .ai-messages { height: 280px; }
    
    .table { font-size: 12px; }
    .table th, .table td { padding: 10px 12px; }
    
    .btn { padding: 8px 16px; font-size: 13px; }
    .btn-lg { padding: 12px 24px; font-size: 14px; }
}

/* 超小屏幕 */
@media (max-width: 375px) {
    .category-nav { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
    .content-card-img { height: 150px; }
}

/* 移动端导航菜单面板 */
.mobile-nav-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
}

.mobile-nav-panel.show {
    display: block;
}

.mobile-nav-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.mobile-nav-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: var(--bg-white);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.mobile-nav-panel.show .mobile-nav-content {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.mobile-nav-header span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.mobile-nav-links {
    padding: 12px 0;
}

.mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.mobile-nav-links a i {
    font-size: 18px;
    color: var(--text-muted);
    width: 24px;
    text-align: center;
}

.mobile-nav-links a:hover i,
.mobile-nav-links a.active i {
    color: var(--primary);
}

.mobile-nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 20px;
}

.mobile-nav-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.mobile-nav-user a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
}

.mobile-nav-user a i {
    font-size: 16px;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}
