/* === Learn.zhangwen.site — Shared Styles === */

:root {
    --bg: #f8f9fb;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #5a5f6e;
    --text-muted: #8e94a2;
    --border: #e2e5eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --radius: 10px;
    --radius-sm: 6px;
    --max-width: 960px;
}

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

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;
}

/* === Header === */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.header-logo .icon { font-size: 22px; }

.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border); }

/* === Container === */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

/* === Topic Cards (Homepage) === */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.topic-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
    display: block;
}

.topic-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.topic-card .topic-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.topic-card .topic-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.topic-card .topic-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.topic-card .topic-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Progress Bar === */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar .fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

/* === Section Cards === */
.section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.section-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.section-header:hover { background: #f9fafb; }

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header .arrow {
    transition: transform 0.2s;
    font-size: 12px;
    color: var(--text-muted);
}

.section.open .section-header .arrow { transform: rotate(90deg); }

.section-body {
    display: none;
    padding: 0 20px 20px;
    border-top: 1px solid var(--border);
}

.section.open .section-body { display: block; }

.section-stats {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

/* === Checkable Items === */
.item-list { list-style: none; }

.item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.item input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.item.completed .item-label {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-label {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.item-label a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.item-label a:hover { text-decoration: underline; }

.item-label .tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
}

.tag-video { background: #fef2f2; color: #dc2626; }
.tag-slides { background: #eff6ff; color: #2563eb; }
.tag-code { background: #f0fdf4; color: #16a34a; }
.tag-paper { background: #fffbeb; color: #d97706; }
.tag-blog { background: #f5f3ff; color: #7c3aed; }
.tag-community { background: #fdf2f8; color: #db2777; }
.tag-gpu { background: #ecfeff; color: #0891b2; }

.item-meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* === Page Title === */
.page-title {
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-title p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.page-title .info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.info-row span { display: flex; align-items: center; gap: 4px; }

/* === Overall Progress === */
.overall-progress {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.overall-progress .ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    border: 3px solid var(--success);
    color: var(--success);
}

.overall-progress .info {
    flex: 1;
}

.overall-progress .info .label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.overall-progress .info .sub {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-reset {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.btn-reset:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* === Course Overview Box === */
.overview-box {
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.overview-box h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #3730a3;
}

.overview-box .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.overview-box .stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-card .num {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* === Responsive === */
@media (max-width: 640px) {
    .container { padding: 16px; }
    .topics-grid { grid-template-columns: 1fr; }
    .page-title h1 { font-size: 22px; }
    .overview-box .grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* === Back to top === */
.back-top {
    display: flex;
    justify-content: center;
    padding: 16px 0 32px;
}

.back-top a {
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
}

.back-top a:hover { color: var(--accent); }

/* === Badge === */
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-new {
    background: var(--success-light);
    color: var(--success);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 999;
}

.toast.show {
    opacity: 1;
}
