/* ==========================================
   學生點名管理系統 - 全域樣式
   ========================================== */

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

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --late: #f97316;
    --leave: #8b5cf6;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(79,70,229,0.15), 0 8px 24px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --navbar-height: 64px;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; }

/* ==========================================
   導航列
   ========================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.navbar-brand i { font-size: 1.4rem; }

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.nav-link.active {
    background: #eef2ff;
    color: var(--primary);
    font-weight: 600;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

/* ==========================================
   主內容
   ========================================== */
.main-content {
    flex: 1;
    padding-bottom: 40px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================
   英雄區塊
   ========================================== */
.hero-section {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
    color: white;
    padding: 60px 24px;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 32px;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ==========================================
   按鈕
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

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

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
}
.btn-secondary:hover { background: rgba(255,255,255,0.3); transform: translateY(-1px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

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

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #2563eb; }

.btn-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: #eef2ff; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ==========================================
   統計卡片
   ========================================== */
.stats-section {
    padding: 40px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================
   章節標題
   ========================================== */
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i { color: var(--primary); }

/* ==========================================
   功能卡片
   ========================================== */
.features-section { padding: 0 0 40px; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.feature-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
}

.feature-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================
   班級類型
   ========================================== */
.classes-section { padding: 0 0 40px; }

.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.class-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 4px solid transparent;
    transition: all 0.3s;
}

.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.class-card.english { border-top-color: #3b82f6; }
.class-card.math { border-top-color: #f59e0b; }
.class-card.liberal { border-top-color: #10b981; }
.class-card.science { border-top-color: #8b5cf6; }

.class-badge {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.3rem;
    color: white;
}

.english .class-badge { background: #3b82f6; }
.math .class-badge { background: #f59e0b; }
.liberal .class-badge { background: #10b981; }
.science .class-badge { background: #8b5cf6; }

.class-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.class-card p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }

/* ==========================================
   頁面標題列
   ========================================== */
.page-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.page-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title i { color: var(--primary); }

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================
   卡片 / 面板
   ========================================== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fafafa;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* ==========================================
   表單元素
   ========================================== */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-label span { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
    background: white;
    transition: all 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-control::placeholder { color: #aaa; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* ==========================================
   複選框群組
   ========================================== */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.checkbox-label:hover { border-color: var(--primary); background: #f5f3ff; }

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-label.checked {
    border-color: var(--primary);
    background: #eef2ff;
    color: var(--primary);
    font-weight: 600;
}

/* ==========================================
   表格
   ========================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }

/* ==========================================
   徽章 / Tag
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-primary { background: #eef2ff; color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-late { background: #ffedd5; color: #9a3412; }
.badge-leave { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

/* ==========================================
   班級顏色標籤
   ========================================== */
.class-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    margin: 2px;
}

.class-tag.英文班 { background: #dbeafe; color: #1e40af; }
.class-tag.數學班 { background: #fef3c7; color: #92400e; }
.class-tag.文科班 { background: #d1fae5; color: #065f46; }
.class-tag.理化班 { background: #ede9fe; color: #5b21b6; }

/* ==========================================
   搜尋與篩選列
   ========================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 9px 14px 9px 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.44 1.406a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 12px center;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.filter-select {
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: white;
    color: var(--text);
    cursor: pointer;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==========================================
   點名狀態按鈕
   ========================================== */
.status-btn-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.status-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}

.status-btn:hover { transform: scale(1.05); }

.status-btn.present { border-color: var(--success); color: var(--success); }
.status-btn.present.active { background: var(--success); color: white; }

.status-btn.absent { border-color: var(--danger); color: var(--danger); }
.status-btn.absent.active { background: var(--danger); color: white; }

.status-btn.late { border-color: var(--late); color: var(--late); }
.status-btn.late.active { background: var(--late); color: white; }

.status-btn.leave { border-color: var(--leave); color: var(--leave); }
.status-btn.leave.active { background: var(--leave); color: white; }

/* ==========================================
   點名表格特殊樣式
   ========================================== */
.attendance-table th {
    padding: 10px 8px;
    text-align: center;
    font-size: 0.78rem;
}

.attendance-table td {
    text-align: center;
    padding: 8px;
}

.attendance-table td:first-child,
.attendance-table td:nth-child(2) {
    text-align: left;
}

.attendance-table .status-cell {
    min-width: 90px;
}

.att-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid var(--border);
    background: #f8fafc;
    transition: all 0.15s;
    margin: 2px;
}

.att-dot:hover { transform: scale(1.15); }
.att-dot.present { background: var(--success); color: white; border-color: var(--success); }
.att-dot.absent { background: var(--danger); color: white; border-color: var(--danger); }
.att-dot.late { background: var(--late); color: white; border-color: var(--late); }
.att-dot.leave { background: var(--leave); color: white; border-color: var(--leave); }

/* ==========================================
   Modal 彈窗
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover { background: #fee2e2; color: var(--danger); }

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==========================================
   Toast 通知
   ========================================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    background: white;
    border-left: 4px solid transparent;
    min-width: 260px;
    max-width: 360px;
    animation: slideInRight 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast.info i { color: var(--info); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==========================================
   空狀態
   ========================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state p { font-size: 0.88rem; }

/* ==========================================
   Loading 狀態
   ========================================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

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

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

/* ==========================================
   頁腳
   ========================================== */
.footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}

/* ==========================================
   批次匯入區
   ========================================== */
.import-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.2s;
}

.import-area:hover {
    border-color: var(--primary);
    background: #fafbff;
}

/* ==========================================
   列印樣式
   ========================================== */
@media print {
    .navbar, .page-header .btn, .filter-bar,
    .footer, .btn, .modal-overlay, .toast-container,
    .no-print { display: none !important; }

    body { background: white; }

    .page-header { border: none; padding: 0; margin-bottom: 16px; }

    .print-title {
        text-align: center;
        font-size: 1.4rem;
        font-weight: 700;
        margin-bottom: 8px;
    }

    .print-info {
        text-align: center;
        font-size: 0.85rem;
        color: #555;
        margin-bottom: 16px;
    }

    .card { box-shadow: none; border: 1px solid #ddd; }

    table { font-size: 0.78rem; }
    th, td { padding: 6px 8px; }

    .att-dot {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }

    .print-attendance-table th {
        background: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .att-dot.present { background: #10b981 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .att-dot.absent { background: #ef4444 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .att-dot.late { background: #f97316 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .att-dot.leave { background: #8b5cf6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    @page { size: A4 landscape; margin: 10mm; }
}

/* ==========================================
   日期選擇器（多選）
   ========================================== */
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 12px;
}

.date-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    font-weight: 500;
}

.date-cell:hover { background: #eef2ff; border-color: var(--primary-light); }
.date-cell.selected { background: var(--primary); color: white; border-color: var(--primary); }
.date-cell.weekend { color: var(--danger); }
.date-cell.weekend.selected { background: var(--danger); border-color: var(--danger); }
.date-cell.empty { cursor: default; }
.date-cell.header { font-weight: 700; font-size: 0.78rem; color: var(--text-muted); cursor: default; background: none; border: none; }

/* ==========================================
   年級標籤頁
   ========================================== */
.tab-list {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab-item {
    padding: 10px 16px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    border: 1.5px solid transparent;
    border-bottom: none;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-item:hover { color: var(--primary); background: #f5f3ff; }

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

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ==========================================
   響應式
   ========================================== */
@media (max-width: 768px) {
    .navbar-nav {
        display: none;
        position: absolute;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 12px;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        z-index: 99;
    }

    .navbar-nav.open { display: flex; }
    .menu-toggle { display: block; }

    .hero-content h1 { font-size: 1.6rem; }
    .hero-content p { font-size: 0.95rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .features-grid { grid-template-columns: 1fr; }
    .classes-grid { grid-template-columns: 1fr 1fr; }

    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-input { min-width: unset; }

    .page-header-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .classes-grid { grid-template-columns: 1fr; }
    .hero-content h1 { font-size: 1.3rem; }
}
