/* ==========================================================================
   Linux DevOps 101 - Modern Multi-Theme Design System
   Four Themes: Warm Autumn | Serene Forest | Cyber Dark | Elegant Modern
   ========================================================================== */

/* 1. Theme Variables & Color Tokens */
:root, [data-theme="warm-autumn"] {
    --theme-name: "温暖秋日";
    --bg-page: #F6F0ED;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-subtle: #EAD6BD;
    --border-color: rgba(184, 90, 56, 0.18);
    --border-card: rgba(45, 42, 42, 0.08);
    --text-primary: #2D2A2A;
    --text-secondary: #756A63;
    --text-muted: #9E9289;
    --accent-primary: #B85A38;
    --accent-hover: #9E4627;
    --accent-secondary: #E28743;
    --accent-tertiary: #EAB676;
    --accent-badge-bg: #EAB676;
    --accent-badge-text: #2D2A2A;
    --player-bg: #FFFFFF;
    --player-border: rgba(184, 90, 56, 0.25);
    --player-progress: #B85A38;
    --card-shadow: 0 4px 16px rgba(184, 90, 56, 0.06);
    --glow: none;
}

[data-theme="serene-forest"] {
    --theme-name: "静谧自然";
    --bg-page: #EBF2EE;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-subtle: #D8E5DD;
    --border-color: rgba(43, 76, 63, 0.18);
    --border-card: rgba(28, 46, 36, 0.08);
    --text-primary: #1C2E24;
    --text-secondary: #586B60;
    --text-muted: #7E9487;
    --accent-primary: #2B4C3F;
    --accent-hover: #1E372D;
    --accent-secondary: #608A7C;
    --accent-tertiary: #A4C3B2;
    --accent-badge-bg: #A4C3B2;
    --accent-badge-text: #1C2E24;
    --player-bg: #FFFFFF;
    --player-border: rgba(43, 76, 63, 0.25);
    --player-progress: #2B4C3F;
    --card-shadow: 0 4px 16px rgba(43, 76, 63, 0.06);
    --glow: none;
}

[data-theme="cyber-dark"] {
    --theme-name: "赛博极夜";
    --bg-page: #0F172A;
    --bg-surface: #1E293B;
    --bg-card: #1E293B;
    --bg-subtle: #334155;
    --border-color: rgba(139, 92, 246, 0.35);
    --border-card: rgba(0, 229, 255, 0.2);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --accent-primary: #00E5FF;
    --accent-hover: #38BDF8;
    --accent-secondary: #8B5CF6;
    --accent-tertiary: #06B6D4;
    --accent-badge-bg: rgba(0, 229, 255, 0.15);
    --accent-badge-text: #00E5FF;
    --player-bg: #1E293B;
    --player-border: rgba(0, 229, 255, 0.4);
    --player-progress: #00E5FF;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --glow: 0 0 16px rgba(0, 229, 255, 0.22);
}

[data-theme="elegant-modern"] {
    --theme-name: "优雅摩登";
    --bg-page: #FAF7F5;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-subtle: #E2D5C5;
    --border-color: rgba(193, 154, 139, 0.25);
    --border-card: rgba(30, 34, 41, 0.08);
    --text-primary: #1E2229;
    --text-secondary: #6B6E70;
    --text-muted: #95989A;
    --accent-primary: #C19A8B;
    --accent-hover: #A88172;
    --accent-secondary: #1E2229;
    --accent-tertiary: #E2D5C5;
    --accent-badge-bg: #E2D5C5;
    --accent-badge-text: #1E2229;
    --player-bg: #FFFFFF;
    --player-border: rgba(193, 154, 139, 0.35);
    --player-progress: #C19A8B;
    --card-shadow: 0 4px 16px rgba(193, 154, 139, 0.08);
    --glow: none;
}

/* 2. Global Resets & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.68;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.85;
}

code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

pre {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

/* 3. Header & Navigation */
.site-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.header-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.site-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background-color: var(--accent-badge-bg);
    color: var(--accent-badge-text);
    font-weight: 600;
}

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

.nav-link {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--accent-primary);
    background: var(--bg-subtle);
}

/* Theme Switcher */
.theme-selector-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.25rem 0.6rem;
    font-size: 0.82rem;
}

.theme-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.theme-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* 4. Main Layout Container */
.main-container {
    max-width: 980px;
    margin: 2rem auto;
    padding: 0 1.25rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.hero-stats span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-weight: 600;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-primary);
    color: #FFFFFF !important;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 5. Syllabus / Lesson Grid */
.syllabus h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.lesson-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    transition: all 0.2s;
}

.lesson-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--card-shadow), var(--glow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.lesson-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.35;
}

.card-title a {
    color: var(--text-primary);
}

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

.card-concepts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.concept-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-subtle);
    border-radius: 999px;
    color: var(--text-primary);
    font-weight: 600;
}

.concept-tag.more {
    color: var(--text-muted);
    background: var(--bg-page);
}

.card-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.mini-progress {
    flex: 1;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.mini-progress::after {
    content: '';
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.btn-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--accent-primary);
    color: #fff !important;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
}

.btn-card:hover {
    background: var(--accent-hover);
}

/* 6. Progress Dashboard */
.progress-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

.stat-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-detail h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.progress-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.progress-table th,
.progress-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-card);
}

.progress-table th {
    background: var(--bg-surface);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-table tr:last-child td {
    border-bottom: none;
}

.progress-table tr:hover td {
    background: var(--bg-subtle);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.status-pending {
    background: var(--bg-subtle);
    color: var(--text-muted);
}

.status-inprogress {
    background: rgba(226, 135, 67, 0.15);
    color: #E28743;
}

.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #16A34A;
}

.quiz-score,
.cmd-count,
.last-study {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-reset {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-reset:hover {
    border-color: #EF4444;
    color: #EF4444;
}

/* Cheatsheet */
.cheatsheet {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.cheatsheet h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cheatsheet > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

#cheatsheet-search {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    outline: none;
}

#cheatsheet-search:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-badge-bg);
}

.cheatsheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.cheat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: var(--card-shadow);
    transition: all 0.15s;
}

.cheat-card:hover {
    border-color: var(--accent-primary);
}

.cheat-card code {
    flex: 1;
    font-size: 0.85rem;
    color: var(--accent-primary);
    background: var(--bg-page);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.cheat-card span {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 7. Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    padding: 2rem 1.25rem;
    margin-top: 3.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* 8. Buttons */
.btn-copy {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-copy:hover, .btn-copy.copied {
    background: var(--accent-hover);
}

/* 9. Responsive Adjustments */
@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;
        gap: 0.6rem;
        align-items: flex-start;
    }
    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .hero-stats {
        gap: 0.75rem;
    }
    .hero-stats span {
        padding: 0.3rem 0.75rem;
        font-size: 0.85rem;
    }
    .lesson-grid {
        grid-template-columns: 1fr;
    }
    .progress-table {
        font-size: 0.85rem;
    }
    .progress-table th,
    .progress-table td {
        padding: 0.75rem 0.5rem;
    }
    .cheatsheet-grid {
        grid-template-columns: 1fr;
    }
}