/* AI兴趣课程App - 统一样式文件 */

/* ========== 颜色变量 ========== */
:root {
    --color-primary-blue: #007AFF;
    --color-primary-purple: #7C3AED;
    --color-primary-cyan: #06B6D4;
    --color-light-blue: #E3F2FD;
    --color-light-purple: #F3E8FF;
    --color-light-cyan: #CFFAFE;
    --color-bg-light: #F8F9FB;
    --color-surface: #FFFFFF;
    --color-text-primary: #1F2937;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-border: #E5E7EB;
    --color-divider: #F3F4F6;
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-bg-light);
    color: var(--color-text-primary);
    line-height: 1.5;
}

/* ========== 文本样式 ========== */
.text-display-1 {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
}

.text-display-2 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}

.text-heading-1 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.text-heading-2 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

.text-heading-3 {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
}

.text-body-large {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.text-body {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.text-body-small {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
}

.text-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.text-caption {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
}

.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

/* ========== 卡片组件 ========== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-gradient {
    background: linear-gradient(135deg, var(--color-primary-blue) 0%, var(--color-primary-purple) 100%);
    color: white;
}

/* ========== 按钮 ========== */
.btn {
    height: 44px;
    padding: 0 20px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    user-select: none;
}

.btn-primary {
    background: var(--color-primary-blue);
    color: white;
}

.btn-primary:active {
    background: #0051D5;
    transform: scale(0.95);
}

.btn-primary:disabled {
    background: #B3D9F2;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-light-blue);
    color: var(--color-primary-blue);
    border: 1px solid #BFDBFE;
}

.btn-secondary:active {
    background: #BBEBFF;
}

.btn-text {
    background: transparent;
    color: var(--color-primary-blue);
    padding: 0 12px;
}

.btn-text:active {
    background: var(--color-light-blue);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: var(--color-light-blue);
    color: var(--color-primary-blue);
}

.btn-icon:active {
    background: #BBEBFF;
}

.btn-small {
    height: 32px;
    padding: 0 12px;
    font-size: 14px;
}

.btn-large {
    height: 50px;
    font-size: 18px;
}

/* ========== 输入框 ========== */
.input,
.textarea,
.select {
    width: 100%;
    height: 44px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 16px;
    font-family: inherit;
    transition: all var(--transition-fast);
    color: var(--color-text-primary);
}

.textarea {
    height: auto;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--color-primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input::placeholder {
    color: var(--color-text-tertiary);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 12px;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.input-group input {
    padding-left: 40px;
}

/* ========== 徽章与标签 ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-primary {
    background: var(--color-light-blue);
    color: var(--color-primary-blue);
}

.badge-purple {
    background: var(--color-light-purple);
    color: var(--color-primary-purple);
}

.badge-cyan {
    background: var(--color-light-cyan);
    color: var(--color-primary-cyan);
}

.badge-success {
    background: #D1FAE5;
    color: #047857;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-error {
    background: #FEE2E2;
    color: #991B1B;
}

/* ========== 进度条 ========== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-divider);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-primary-blue);
    transition: width var(--transition-normal);
    border-radius: 3px;
}

.progress-bar-gradient {
    background: linear-gradient(90deg, var(--color-primary-blue) 0%, var(--color-primary-purple) 100%);
}

/* ========== 列表 ========== */
.list-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-divider);
    transition: background var(--transition-fast);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:active {
    background: var(--color-divider);
}

.list-item-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.list-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.list-item-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* ========== 弹窗与模态框 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    z-index: 1000;
    animation: fadeIn var(--transition-fast);
}

.modal-content {
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 16px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp var(--transition-normal);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ========== Toast通知 ========== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    animation: slideUp 250ms ease;
}

/* ========== 加载动画 ========== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-skeleton {
    background: linear-gradient(90deg, var(--color-divider) 25%, var(--color-border) 50%, var(--color-divider) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== 动画效果 ========== */
.fade-in {
    animation: fadeIn var(--transition-normal);
}

.scale-up {
    animation: scaleUp var(--transition-normal);
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== 间距工具类 ========== */
.p-xs { padding: 4px; }
.p-sm { padding: 8px; }
.p-md { padding: 12px; }
.p-lg { padding: 16px; }
.p-xl { padding: 24px; }
.p-2xl { padding: 32px; }

.m-xs { margin: 4px; }
.m-sm { margin: 8px; }
.m-md { margin: 12px; }
.m-lg { margin: 16px; }
.m-xl { margin: 24px; }
.m-2xl { margin: 32px; }

.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.gap-xl { gap: 24px; }

/* ========== 弹性布局 ========== */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

/* ========== 响应式网格 ========== */
.grid {
    display: grid;
    gap: 12px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* ========== 圆形头像 ========== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-divider);
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
}

.avatar-xl {
    width: 80px;
    height: 80px;
}

/* ========== 图片 ========== */
.image-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========== 文本截断 ========== */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 对齐与定位 ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.absolute { position: absolute; }
.relative { position: relative; }
.fixed { position: fixed; }

/* ========== 可见性 ========== */
.hidden { display: none !important; }
.visible { display: block !important; }

/* ========== 渐变 ========== */
.gradient-blue-purple {
    background: linear-gradient(135deg, var(--color-primary-blue) 0%, var(--color-primary-purple) 100%);
}

.gradient-text {
    background: linear-gradient(135deg, var(--color-primary-blue) 0%, var(--color-primary-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 媒体查询 ========== */
@media (max-width: 640px) {
    .text-display-1 { font-size: 24px; }
    .text-display-2 { font-size: 20px; }
    .btn { height: 40px; font-size: 14px; }
}

/* ========== 打印样式 ========== */
@media print {
    .no-print { display: none !important; }
}

