/* ============================================
   香港 DSE 學習網站 - 全站樣式
   設計參考：study.590.net 風格
   ============================================ */

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

:root {
    --primary: #00acc1;
    --primary-dark: #006064;
    --primary-light: #4dd0e1;
    --physics: #00acc1;
    --math: #0288d1;
    --chemistry: #7b1fa2;
    --biology: #2e7d32;
    --chinese: #5e35b1;
    --other: #f57c00;
    --bg-gradient-1: #e0f7fa;
    --bg-gradient-2: #80deea;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e0e0e0;
    --card-bg: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
    --radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: "Microsoft JhengHei", "PingFang TC", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    min-height: 100vh;
}

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

/* ========== 頂部導航 ========== */
.site-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.site-brand {
    font-size: 1.4em;
    font-weight: bold;
    padding: 18px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-brand .brand-icon { font-size: 1.4em; }
.site-brand a { color: white !important; text-decoration: none !important; }
.site-brand a:hover { opacity: 0.85; }

.site-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.site-nav a {
    color: rgba(255,255,255,0.85);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}
.site-nav a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
}
.site-nav a.active {
    background: rgba(255,255,255,0.25);
    color: white;
    font-weight: bold;
}

/* ========== 主容器 ========== */
.site-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px;
}

/* ========== 麵包屑 ========== */
.breadcrumb {
    background: rgba(255,255,255,0.6);
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}
.breadcrumb a { color: var(--primary-dark); font-weight: 500; }
.breadcrumb .sep { color: var(--text-light); margin: 0 8px; }
.breadcrumb .current { color: var(--text-light); }

/* ========== 頁面標題 ========== */
.page-title {
    font-size: 2.4em;
    color: var(--primary-dark);
    border-bottom: 4px solid var(--primary);
    padding-bottom: 16px;
    margin-bottom: 12px;
    font-weight: bold;
}
.page-subtitle {
    color: var(--text-light);
    font-size: 1.1em;
    margin-bottom: 30px;
}

/* ========== 章節卡片網格 ========== */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin: 24px 0;
}
.subject-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    border-left: 6px solid var(--primary);
    position: relative;
    overflow: hidden;
}
.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    text-decoration: none !important;
}
.subject-card.physics { border-left-color: var(--physics); }
.subject-card.math { border-left-color: var(--math); }
.subject-card.chemistry { border-left-color: var(--chemistry); }
.subject-card.biology { border-left-color: var(--biology); }
.subject-card.chinese { border-left-color: var(--chinese); background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%); }
.subject-card.other { border-left-color: var(--other); }

.subject-card-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}
.subject-card-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 8px;
}
.subject-card-desc {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}
.subject-card-meta {
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

/* ========== 章節列表 ========== */
.chapter-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin: 20px 0;
}
.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.chapter-item:last-child { border-bottom: none; }
.chapter-item:hover { background: var(--bg-gradient-1); }
.chapter-item-left { flex: 1; }
.chapter-item-title {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 4px;
}
.chapter-item-desc {
    font-size: 13px;
    color: var(--text-light);
}
.chapter-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.chapter-action-btn {
    background: var(--bg-gradient-1);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.chapter-action-btn:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* ========== 統計數字 ========== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}
.stat-card-num {
    font-size: 2.2em;
    font-weight: bold;
    color: var(--primary);
    line-height: 1;
}
.stat-card-label {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 8px;
}

/* ========== 章節導航 ========== */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin: 40px 0 20px 0;
    gap: 16px;
}
.chapter-nav-btn {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chapter-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none !important;
}
.chapter-nav-btn .label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.chapter-nav-btn .title {
    font-weight: 600;
    color: var(--primary-dark);
}
.chapter-nav-btn.next { text-align: right; }

/* ========== 頁腳 ========== */
.site-footer {
    background: rgba(255,255,255,0.7);
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    margin-top: 60px;
}
.site-footer a { color: var(--primary-dark); }

/* ========== 響應式 ========== */
@media (max-width: 768px) {
    .site-header-inner { padding: 0 16px; }
    .site-brand { font-size: 1.2em; padding: 14px 0; }
    .site-nav a { padding: 6px 12px; font-size: 13px; }
    .site-main { padding: 20px 16px; }
    .page-title { font-size: 1.8em; }
    .subject-grid { grid-template-columns: 1fr; }
    .chapter-nav { flex-direction: column; }
    .chapter-nav-btn.next { text-align: left; }
    .chapter-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .chapter-item-actions { width: 100%; }
}

/* ========== 章節頁面內容區 ========== */
.chapter-content-wrapper {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    margin: 20px 0;
}
.chapter-content-wrapper h1 {
    color: var(--primary-dark);
    border-bottom: 4px solid var(--primary);
    padding-bottom: 15px;
    margin-bottom: 24px;
    font-size: 2.2em;
}
.chapter-content-wrapper h2 {
    color: var(--primary-dark);
    background: linear-gradient(90deg, var(--primary-light) 0%, transparent 100%);
    padding: 12px 20px;
    margin: 35px 0 20px 0;
    border-left: 5px solid var(--primary);
    border-radius: 5px;
    font-size: 1.5em;
}
.chapter-content-wrapper h3 {
    color: var(--primary);
    margin: 25px 0 12px 0;
    padding-left: 15px;
    border-left: 3px solid var(--primary-light);
    font-size: 1.2em;
}
.chapter-content-wrapper table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
    overflow: hidden;
}
.chapter-content-wrapper th {
    background: var(--primary-dark);
    color: white;
    padding: 12px;
    text-align: left;
}
.chapter-content-wrapper td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.chapter-content-wrapper .formula {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border: 2px dashed #f57f17;
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 10px;
    font-family: "Courier New", monospace;
    font-size: 1.1em;
    font-weight: bold;
    color: #e65100;
    text-align: center;
}
.chapter-content-wrapper .keypoint,
.chapter-content-wrapper .note,
.chapter-content-wrapper .important,
.chapter-content-wrapper .example,
.chapter-content-wrapper .memory-tip {
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 8px;
}
.chapter-content-wrapper .keypoint { background: #e8f5e9; border-left: 5px solid #43a047; }
.chapter-content-wrapper .note { background: #fff3e0; border-left: 5px solid #ff9800; }
.chapter-content-wrapper .important { background: #ffebee; border: 2px solid #ef5350; }
.chapter-content-wrapper .example { background: #e3f2fd; border: 1px solid #42a5f5; }
.chapter-content-wrapper .memory-tip { background: #fce4ec; border: 2px solid #ec407a; color: #880e4f; font-weight: bold; }