/* AI Skill Hub - 扁平简洁风格CSS */

/* ===== 基础变量 ===== */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --bg: #f9fafb;
    --bg-white: #ffffff;
    --bg-gray: #f3f4f6;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== 布局容器 ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ===== 导航栏 ===== */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 500;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-light);
}

.btn-ghost:hover {
    background: var(--bg-gray);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ===== 卡片 ===== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-cover {
    aspect-ratio: 16/9;
    background: var(--bg-gray);
    overflow: hidden;
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-lighter);
}

.card-stats {
    display: flex;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== 网格布局 ===== */
.grid {
    display: grid;
    gap: 1.5rem;
}

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

/* ===== 标签 ===== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-gray);
    color: var(--text-light);
    border-radius: 4px;
}

.tag-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.tag-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text);
    transition: var(--transition);
}

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

.form-input::placeholder {
    color: var(--text-lighter);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-lighter);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* ===== 消息提示 ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ===== Hero区域 ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ===== 分类导航 ===== */
.category-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-item {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.category-item:hover,
.category-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 页脚 ===== */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-lighter);
}

/* ===== Auth页面 ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== 详情页 ===== */
.detail-header {
    margin-bottom: 2rem;
}

.detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.detail-cover {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.detail-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* ===== 评论区 ===== */
.comments-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.comments-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.comment-form {
    margin-bottom: 1.5rem;
}

.comment-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gray);
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.comment-author {
    font-weight: 500;
    font-size: 0.9rem;
}

.comment-time {
    font-size: 0.8rem;
    color: var(--text-lighter);
}

.comment-text {
    font-size: 0.9rem;
    color: var(--text);
}

/* ===== 用户中心 ===== */
.profile-header {
    display: flex;
    gap: 2rem;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-gray);
}

.profile-info h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.profile-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.profile-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

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

.profile-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.profile-stat-label {
    font-size: 0.8rem;
    color: var(--text-lighter);
}

/* ===== 作品提交 ===== */
.submit-form {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.empty-state-desc {
    font-size: 0.9rem;
}

/* ===== 加载状态 ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@media (max-width: 768px) {
    .hero-title { font-size: 1.75rem; }
    .hero-subtitle { font-size: 1rem; }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .navbar-inner { height: 56px; }
    .nav-links { display: none; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-stats { justify-content: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 0.75rem; }
    .hero { padding: 2rem 0.5rem; }
    .hero-title { font-size: 1.5rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .card-body { padding: 0.75rem; }
    .auth-card { padding: 1.5rem; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .detail-meta { flex-direction: column; gap: 0.5rem; }
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-lighter); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none; }