/* 公共样式 - AI编程教育主题设计系统 */
:root {
    /* AI科技主题色彩系统 */
    --primary-color: #6366F1; /* 智能紫 - 主品牌色 */
    --secondary-color: #8B5CF6; /* 深紫 - 辅助色 */
    --accent-color: #06B6D4; /* 科技蓝 - 强调色 */
    --success-color: #10B981; /* 智能绿 - 成功色 */
    --warning-color: #F59E0B; /* 警告橙 */
    --danger-color: #EF4444; /* 错误红 */

    /* AI渐变系统 */
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #06B6D4 100%);
    --gradient-secondary: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
    --gradient-accent: linear-gradient(135deg, #06B6D4 0%, #10B981 100%);
    --gradient-neural: linear-gradient(45deg, #6366F1, #8B5CF6, #06B6D4, #10B981);

    /* 字体系统 */
    --font-family: 'Inter', 'SF Pro Display', 'Segoe UI', 'Microsoft YaHei', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* 布局系统 */
    --container-max-width: 1200px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 24px;

    /* 阴影系统 */
    --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.08);
    --shadow-md: 0 8px 24px rgba(99, 102, 241, 0.12);
    --shadow-lg: 0 16px 40px rgba(99, 102, 241, 0.16);
    --shadow-xl: 0 24px 60px rgba(99, 102, 241, 0.20);
    --box-shadow: var(--shadow-md);

    /* 动画系统 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* 间距系统 */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;

    /* 文本颜色 */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --text-inverse: #FFFFFF;

    /* 背景色 */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-muted: #F3F4F6;
}

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

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 性能优化 - 减少重绘 */
* {
    will-change: auto;
}

.card, .course-card, .btn {
    will-change: transform, box-shadow;
}

/* 可访问性增强 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
        --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.6);
    }
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--space-lg);
    position: relative;
}

/* AI主题区域样式 */
section {
    margin-bottom: var(--space-2xl);
    position: relative;
}

/* AI主题标题系统 */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    font-size: clamp(2rem, 4vw, 2.5rem);
    position: relative;
    padding-bottom: var(--space-md);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-secondary);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.section-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto var(--space-xl);
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    line-height: 1.7;
    color: var(--text-secondary);
    font-weight: 400;
}

/* AI主题按钮系统 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-align: center;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

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

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 可访问性 - 焦点状态 */
.btn:focus,
.course-card:focus,
a:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.btn:focus:not(:focus-visible) {
    outline: none;
}

.btn:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* AI主题卡片系统 */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    transition: var(--transition);
    position: relative;
    border: 1px solid rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
}

/* 通用标题样式 */
h1, h2, h3, h4, h5, h6 {
    color: #333;
    margin-bottom: 15px;
}

h2 {
    text-align: center;
    color: #444;
    margin-bottom: 40px;
    font-size: 36px;
    position: relative;
    padding-bottom: 15px;
}

h2:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-secondary);
    border-radius: 2px;
}

/* 通用段落样式 */
.section-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 50px;
    font-size: 18px;
    line-height: 1.6;
    color: #555;
}

/* 通用网格布局 */
.grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.grid-item {
    flex: 1;
    min-width: 250px;
}

/* 通用图标样式 */
.icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
}

/* 通用加载样式 */
.loading {
    text-align: center;
    padding: 50px;
    color: #666;
    font-size: 16px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* iframe容器样式 */
.iframe-container {
    width: 100%;
    border: none;
    overflow: hidden;
    display: block;
}

/* AI主题响应式设计系统 */
@media (max-width: 1024px) {
    .container {
        padding: var(--space-md);
    }

    h2 {
        font-size: clamp(1.75rem, 4vw, 2.25rem);
    }
}

@media (max-width: 768px) {
    :root {
        --space-xs: 0.375rem;
        --space-sm: 0.75rem;
        --space-md: 1.25rem;
        --space-lg: 1.5rem;
        --space-xl: 2rem;
        --space-2xl: 2.5rem;
    }

    .container {
        padding: var(--space-md);
    }

    h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin-bottom: var(--space-lg);
    }

    .section-intro {
        font-size: clamp(1rem, 3vw, 1.125rem);
        margin-bottom: var(--space-lg);
    }

    .grid {
        flex-direction: column;
        gap: var(--space-md);
    }

    .grid-item {
        min-width: 100%;
    }

    .btn {
        padding: var(--space-md) var(--space-lg);
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--space-sm);
    }

    h2 {
        font-size: clamp(1.25rem, 6vw, 1.75rem);
    }

    .section-intro {
        font-size: 0.9rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
