/* ========================================
   全樺試務中心 - 首頁樣式表
   ======================================== */

/* CSS Variables */
:root {
    /* Colors - Corporate Green (Stable & Professional) */
    --color-primary: #1A8B58;
    --color-primary-dark: #115E3F;
    --color-primary-light: #E4F1EB;
    --color-primary-lighter: #F1F8F5;
    --color-primary-hover: #22C55E;
    --shadow-primary-hover: 0 4px 12px rgba(26, 139, 88, 0.25);

    /* Secondary Palette */
    --color-accent: #3A4750;
    /* Deep Charcoal for stability */
    --color-border: #E2E8F0;

    /* Button States */
    --btn-default-bg: #FFFFFF;
    --btn-default-text: #2D3748;
    --btn-default-border: #CBD5E0;
    --btn-active-bg: #1A8B58;
    --btn-active-text: #FFFFFF;
    --btn-active-border: #1A8B58;
    --btn-hover-bg: #F8FAFC;

    /* Background Colors */
    --bg-page: #F7FAFC;
    /* Cleaner, professional light gray */
    --bg-white: #FFFFFF;
    --bg-header: #1A8B58;
    /* Solid is often more stable than aggressive gradients */

    /* Text Colors */
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-light: #718096;
    --text-white: #FFFFFF;

    /* Shadows - More sophisticated multilayered shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-header: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius - Refined for professional look */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 50px;

    /* Subject Colors - Specific for better UX differentiation */
    --color-subject-chi: #3B82F6;
    /* Chinese - Blue */
    --color-subject-eng: #F97316;
    /* English - Orange */
    --color-subject-math: #EF4444;
    /* Math - Red */
    --color-subject-pro1: #22C55E;
    /* Pro 1 - Green */
    --color-subject-pro2: #6366F1;
    /* Pro 2 - Purple */
    --color-subject-total: #64748B;
    /* Total - Slate */

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 64px;
    /* More breathing room */
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

    a:hover {
        text-decoration: none;
    }

    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

button:focus {
    outline: none;
}

/* ========================================
   Header
   ======================================== */
.header {
    background: var(--bg-header);
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 100%;
    margin: 0;
    padding: 12px var(--spacing-lg);
    /* Slightly more breathing room */
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--spacing-xl);
}

/* Logo Section */
.logo-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    background: white;
    border-radius: 50%;
    padding: 4px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.05em;
    /* Refined spacing */
    white-space: nowrap;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.2em;
    /* Grand look */
    text-transform: uppercase;
    font-weight: 500;
}

/* Main Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    /* Cleaner initial state */
    border: none;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    text-decoration: none;
}

.nav-btn:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}

/* Active State */
.nav-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* User Area */
.user-area {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    /* Align right in grid */
}

.nav-btn.active:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Login Button */
.login-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--text-white);
    border: 2px solid var(--text-white);
    border-radius: var(--radius-pill);
    color: var(--color-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.login-btn:hover {
    background: transparent;
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.login-icon {
    width: 18px;
    height: 18px;
}

/* ========================================
   Main Content
   ========================================*/
/* Main Content Layout */
.main-content {
    flex: 1;
    padding: var(--spacing-2xl) 0;
    /* More top/bottom breathing room */
}

.container {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* News Section */
.news-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    /* Premium elevation */
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-primary-light);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-title h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

/* News Table */
.news-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.news-table {
    width: 100%;
    border-collapse: collapse;
}

.news-table thead {
    background: var(--bg-page);
}

.news-table th {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--color-border);
}

.news-table td {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.news-table tbody tr {
    transition: background var(--transition-fast);
}

.news-table tbody tr:hover {
    background: var(--color-primary-lighter);
}

.col-date {
    width: 120px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.col-category {
    width: 100px;
}

.category-tag {
    display: inline-block;
    padding: 2px 12px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    /* Formal corner */
}

.category-tag.category-system {
    background: #EDF2FF;
    color: #4C6EF5;
}

.col-title {
    font-size: 0.95rem;
}

.news-link {
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.news-link:hover {
    color: var(--color-primary);
}

/* More Button */
.news-more {
    margin-top: var(--spacing-lg);
    text-align: center;
}

.more-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-xl);
    background: var(--bg-white);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-pill);
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.more-btn:hover {
    background: var(--color-primary);
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-hover);
}

.news-pagination-nav {
    margin-top: var(--spacing-xl);
    display: flex;
    justify-content: center;
}

.news-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.news-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.news-page-link:hover,
.news-page-link:focus {
    border-color: var(--color-primary);
    color: var(--color-primary);
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.12);
}

.news-page-link.is-current {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--text-white);
    box-shadow: var(--shadow-primary-hover);
}

.news-page-link-label {
    min-width: 5.5rem;
}

.news-page-item.disabled .news-page-link {
    border-color: var(--color-border);
    background: var(--bg-page);
    color: var(--text-secondary);
    box-shadow: none;
    pointer-events: none;
}

.news-detail-modal-content {
    background: transparent;
    box-shadow: none;
}

.news-detail-panel {
    width: 100%;
    max-width: 960px;
    margin: 1rem auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-white);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.news-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--color-primary-lighter) 0%, #ffffff 100%);
    border-bottom: 1px solid var(--color-border);
}

.news-detail-meta {
    min-width: 0;
}

.news-detail-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.news-detail-date {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}

.news-detail-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.5;
}

.news-detail-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.news-detail-close:hover,
.news-detail-close:focus {
    background: var(--color-primary);
    color: var(--text-white);
    outline: none;
}

.news-detail-body {
    padding: 1.5rem;
    max-height: calc(100vh - 12rem);
    overflow-y: auto;
}

.news-detail-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-page);
}

.news-detail-image {
    max-width: 100%;
    max-height: 320px;
    height: auto;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.news-detail-content {
    color: var(--text-primary);
    line-height: 1.9;
    word-break: break-word;
}

.news-detail-content img {
    max-width: 100%;
    height: auto;
}

.news-detail-content p:last-child {
    margin-bottom: 0;
}

.news-detail-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.news-detail-section h4 {
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
}

.news-detail-link {
    color: var(--color-primary);
    word-break: break-all;
}

.news-detail-files {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.news-detail-file {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.news-detail-file:hover,
.news-detail-file:focus {
    border-color: var(--color-primary);
    color: var(--color-primary);
    text-decoration: none;
    transform: translateY(-2px);
}

.news-detail-file-icon {
    width: 40px;
    height: auto;
    flex: 0 0 40px;
}

.news-detail-file-name {
    min-width: 0;
    font-size: 0.92rem;
    line-height: 1.6;
    word-break: break-word;
}

.news-detail-empty,
.news-detail-error {
    max-width: 960px;
    margin: 1rem auto;
    padding: 2.5rem 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-white);
    color: var(--text-secondary);
    text-align: center;
    box-shadow: var(--shadow-md);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--bg-page);
    padding: var(--spacing-2xl) 0;
    margin-top: auto;
    border-top: 1px solid var(--color-border);
}

.footer-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    text-align: center;
}

.footer-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.02em;
}

.footer-copyright {
    color: var(--text-light);
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center {
    text-align: center;
}

.hidden-section {
    display: none !important;
}

.text-primary {
    color: var(--color-primary);
}

.font-bold {
    font-weight: 700;
}

/* Hover Animation for Interactive Elements */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F1F1F1;
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* ========================================
   User Area - Login Dropdown & User Info
   ======================================== */
.user-area {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Login Dropdown (Guest State) */
.login-dropdown {
    position: relative;
}

.login-trigger {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.login-trigger:hover {
    background: rgba(255, 255, 255, 0.25);
}

.login-trigger.active {
    background: rgba(255, 255, 255, 0.3);
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.login-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 200;
    overflow: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    border-bottom: 1px solid #EEE;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.dropdown-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Login Modal */
.login-modal .modal-dialog {
    max-width: 540px;
}

.login-modal-body {
    background: transparent;
}

.login-modal-panel {
    position: relative;
    padding: 2rem;
    border-radius: 28px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.login-modal-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, var(--color-primary) 0%, #7cb342 100%);
}

.login-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-secondary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.login-modal-close:hover,
.login-modal-close:focus {
    background: var(--color-primary);
    color: var(--text-white);
    outline: none;
}

.login-modal-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-modal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(110, 163, 64, 0.12);
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.login-modal-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
}

.login-modal-subtitle {
    margin-top: 0.65rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.login-modal-user-card {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(110, 163, 64, 0.18);
    border-radius: 20px;
    background: #fffef4;
}

.login-modal-user-heading {
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.login-modal-user-school {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

.login-modal-user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 0.65rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.login-modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.login-field-label {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
}

.login-field-control {
    position: relative;
}

.login-field-input {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-field-input::placeholder {
    color: #94a3b8;
}

.login-field-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(110, 163, 64, 0.12);
}

.login-password-control .login-field-input {
    padding-right: 3.5rem;
}

.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    transform: translateY(-50%);
    transition: all var(--transition-fast);
}

.login-password-toggle:hover,
.login-password-toggle:focus {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
    outline: none;
}

.login-password-toggle i:first-child,
.login-password-toggle.active i:last-child {
    display: none;
}

.login-password-toggle i:last-child,
.login-password-toggle.active i:first-child {
    display: block;
}

.login-modal-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.login-modal .checkbox-box {
    position: relative;
    width: 22px;
    height: 22px;
}

.login-modal .checkbox-input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.login-modal .checkbox-icon {
    display: block;
    width: 22px;
    height: 22px;
}

.login-modal .tick {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: stroke-dashoffset var(--transition-fast);
}

.login-modal .checkbox-input:checked + .checkbox-icon .tick {
    stroke-dashoffset: 0;
}

.login-modal .check-label {
    color: var(--text-secondary);
    font-size: 0.92rem;
    cursor: pointer;
}

.login-modal-actions {
    margin-top: 0.5rem;
}

.login-submit-btn {
    width: 100%;
    min-height: 3.4rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #7cb342 100%);
    color: var(--text-white);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: 0 18px 30px rgba(110, 163, 64, 0.22);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.login-submit-btn:hover,
.login-submit-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 22px 36px rgba(110, 163, 64, 0.28);
    outline: none;
}

/* User Logged In State */
.user-logged-in {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
}

.user-icon-wrapper {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-role-icon {
    width: 22px;
    height: 22px;
    color: var(--color-primary);
    display: none;
    flex-shrink: 0;
}

/* Hide all user names by default */
.user-name {
    white-space: nowrap;
    display: none;
}

.user-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.action-btn {
    padding: 10px 16px;
    background: var(--bg-white);
    border: 1px solid var(--btn-default-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.action-btn:hover {
    background: var(--color-primary-lighter);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.action-btn.action-logout {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-white);
}

.action-btn.action-logout:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

/* ========================================
   Role-Based Visibility
   ======================================== */
/* Guest State */
body[data-user-role="guest"] .login-dropdown {
    display: block;
}

body[data-user-role="guest"] .user-logged-in {
    display: none;
}

body[data-user-role="guest"] .nav-download {
    display: none;
}

/* Logged In States (School, Teacher, Student) */
body[data-user-role="school"] .login-dropdown,
body[data-user-role="teacher"] .login-dropdown,
body[data-user-role="student"] .login-dropdown {
    display: none;
}

body[data-user-role="school"] .user-logged-in,
body[data-user-role="teacher"] .user-logged-in,
body[data-user-role="student"] .user-logged-in {
    display: flex;
}

/* Download Zone visibility - for school and teacher */
body[data-user-role="school"] .nav-download,
body[data-user-role="teacher"] .nav-download {
    display: flex;
}

body[data-user-role="student"] .nav-download {
    display: none;
}

/* Role Icons */
body[data-user-role="school"] .school-icon {
    display: block;
}

body[data-user-role="teacher"] .teacher-icon {
    display: block;
}

body[data-user-role="student"] .student-icon {
    display: block;
}

/* Show correct user name for each role */
body[data-user-role="school"] .school-name {
    display: inline;
}

body[data-user-role="teacher"] .teacher-name {
    display: inline;
}

body[data-user-role="student"] .student-name {
    display: inline;
}

/* ========================================
   Demo Role Switcher
   ======================================== */
.demo-switcher {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-white);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    z-index: 1000;
    border: 2px solid var(--color-primary-light);
}

.demo-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.demo-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-white);
    border: 1px solid var(--btn-default-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.demo-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.demo-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-white);
}

/* ========================================
   Hamburger Menu Button
   ======================================== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--text-white);
    transition: all var(--transition-normal);
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Responsive Design - Tablet (< 1280px)
   ======================================== */
@media (max-width: 1280px) {
    .hamburger-btn {
        display: flex;
    }

    .header-container {
        width: 100%;
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }

    /* Hide navigation and user area on small screens */
    .main-nav {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        background: var(--color-primary-dark);
        padding: 60px 0 20px;
        /* Slight adjustment */
        justify-content: flex-start;
        /* Ensure items start from top */
        gap: 0;
        z-index: 1000;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
        visibility: hidden;
        overflow-y: auto;
    }

    .main-nav.show {
        transform: translateX(0);
        visibility: visible;
    }

    .nav-btn {
        width: 100%;
        padding: 16px 24px;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: transparent;
        justify-content: flex-start;
        font-size: 1.05rem;
        position: relative;
        overflow: hidden;
    }

    .nav-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        padding-left: 28px;
        /* Slide effect on hover */
    }

    .nav-btn.active {
        background: rgba(255, 255, 255, 0.2);
        color: var(--text-white);
        border-right: 4px solid var(--text-white);
    }

    .user-area {
        margin-left: auto;
    }

    /* Overlay when menu is open */
    .header::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 900;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.4s ease, visibility 0.4s;
        pointer-events: none;
    }

    body.menu-open .header::after {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .logo-title {
        font-size: 1.2rem;
    }

    .logo-subtitle {
        font-size: 0.6rem;
    }

    .logo-img {
        width: 44px;
        height: 44px;
    }
}



/* ========================================
   Score Inquiry Section & Main Content Containers
   ======================================== */
.score-section,
.content-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-2xl);
    animation: fadeIn 0.4s ease-out;
}

.score-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-primary-light);
}

.exam-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.exam-selector label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-select {
    border: 1px solid var(--btn-default-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    min-width: 320px;
    background-color: var(--bg-page);
    transition: all var(--transition-fast);
}

.form-select:focus {
    border-color: var(--color-primary);
    background-color: var(--bg-white);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.score-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    margin-top: 16px;
}

/* Score Section Header - 圖標並排文字 */
.section-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title-area h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* School Info Badge - 更漂亮的學校名稱 */
.school-info {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(26, 139, 88, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.school-info::before {
    content: '🏫';
    font-size: 1rem;
}

/* 考試選擇區調整 */
.score-exam-select {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.score-exam-select label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 考試科目按鈕群組 */
.subject-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subject-btn {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.subject-btn:hover {
    background: var(--color-primary-lighter);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.subject-btn.active {
    background: var(--color-primary-lighter);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

.subject-btn:active {
    transform: scale(0.97);
}

/* 單元分析類型標籤 */
.analysis-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.analysis-type-btn {
    padding: 8px 16px;
    border: 2px solid var(--color-border);
    background: var(--bg-white);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.analysis-type-btn:hover {
    background: var(--color-primary-lighter);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.analysis-type-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

/* 單元圖表按鈕 */
.unit-chart-btn {
    padding: 6px 12px;
    background: linear-gradient(to bottom, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.unit-chart-btn:hover {
    background: linear-gradient(to bottom, #dcfce7, #bbf7d0);
    border-color: #4ade80;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.unit-chart-btn:active {
    transform: scale(0.98);
}

.score-action-btn {
    padding: 12px 16px;
    background: var(--bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    position: relative;
    user-select: none;
}

.score-action-btn:hover {
    background: var(--color-primary-lighter);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* 點擊時的按壓效果 */
.score-action-btn:active {
    transform: scale(0.97);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 下拉選單包裝器 */
.dropdown-btn-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.dropdown-btn-wrapper.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: white;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
    display: none;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
}

.dropdown-btn-wrapper.open .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    animation: slideDown 0.2s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

/* 選中狀態 - 使用綠色邊框和底部高亮 */
.score-action-btn.active,
.score-action-btn.active-gold {
    background: var(--bg-white);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 3px 0 var(--color-primary), var(--shadow-sm);
    transform: translateY(-2px);
}

.score-action-btn.active::after,
.score-action-btn.active-gold::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 8px;
    right: 8px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 3px 3px 0 0;
}

.score-action-btn.active:hover,
.score-action-btn.active-gold:hover {
    background: var(--color-primary-lighter);
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   REPORT SECTION STYLES
   ============================================ */

/* Filter Section */
.filter-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
}

.filter-title {
    font-weight: 600;
    color: #1e293b;
}

.filter-toggle {
    background: #e2e8f0;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #475569;
    transition: all 0.2s;
}

.filter-toggle:hover {
    background: #cbd5e1;
}

.filter-body {
    padding: 16px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-column {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    font-weight: 500;
    color: #475569;
    margin-bottom: 8px;
    display: block;
}

.filter-select {
    width: 100%;
    height: 150px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
    font-size: 0.9rem;
}

.filter-footer {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    border-radius: 0 0 8px 8px;
}

/* Filter Hint Text */
.filter-hint {
    display: block;
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: 400;
    margin-top: 4px;
}

/* Checkbox and Radio List Containers */
.filter-checkbox-list,
.filter-radio-list {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
}

/* Individual Checkbox/Radio Items */
.filter-checkbox,
.filter-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
}

.filter-checkbox:hover,
.filter-radio:hover {
    color: #1d4ed8;
}

.filter-checkbox input,
.filter-radio input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1d4ed8;
}

/* Button Row in Filter Column */
.filter-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}


.btn-mini-outline {
    padding: 6px 12px;
    border: 1px solid #3b82f6;
    background: white;
    color: #3b82f6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-mini-outline:hover {
    background: #eff6ff;
}

.btn-mini-danger {
    padding: 6px 12px;
    border: 1px solid #ef4444;
    background: white;
    color: #ef4444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-mini-danger:hover {
    background: #fef2f2;
}

.btn-query {
    margin-left: auto;
    padding: 10px 24px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-query:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.btn-query:disabled,
.btn-query.is-loading {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
    box-shadow: none;
}

/* Report Container */
.report-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 300px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
}

.report-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(1px);
    z-index: 30;
}

.report-loading-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid #dbe5ef;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    color: #1e293b;
    font-weight: 600;
}

.report-loading-card .spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 0.18em;
}

.table-placeholder {
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
    font-style: italic;
}

/* Report Wrapper - Scrollable Container */
.report-wrapper {
    width: 100%;
    max-height: 70vh;
    overflow: auto;
    border-radius: 8px;
}

/* Custom Scrollbar */
.report-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.report-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

.report-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

.report-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   STABLE TABLE DESIGN
   Only top-sticky headers for maximum stability
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    position: relative;
}

/* Hover Effect - Light Yellow on Entire Row */
.data-table tbody tr:hover {
    background-color: #FFFDE7 !important;
}

.data-table tbody tr:hover td {
    background-color: #FFFDE7 !important;
}

/* Zebra Striping */
.data-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Broken Vertical Line */
.data-table th:not(:last-child)::after,
.data-table td:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background-color: rgba(0, 0, 0, 0.12);
}

/* TOP STICKY HEADERS ONLY */
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.data-table th.sticky-th,
.data-table td.sticky-td {
    position: sticky;
    left: 0;
}

.data-table thead tr.main-header th.sticky-th {
    z-index: 12;
}

.data-table thead tr.sub-header th.sticky-th {
    z-index: 11;
}

.data-table tbody td.sticky-td {
    z-index: 4;
    background-color: #fff;
    box-shadow: 1px 0 0 rgba(148, 163, 184, 0.25);
}

.data-table tbody tr:nth-child(even) td.sticky-td {
    background-color: #f8fafc;
}

.data-table tbody tr:hover td.sticky-td {
    background-color: #FFFDE7 !important;
}

/* Main Header Row */
.data-table thead tr.main-header th {
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 12px;
}

.table-sticky thead > tr:first-child > th[rowspan="2"] {
    vertical-align: middle;
}

.data-table thead tr.main-header th[rowspan="2"] > div,
.table-sticky thead > tr:first-child > th[rowspan="2"] > div {
    align-items: center;
    min-height: 100%;
}

.data-table thead tr.main-header th h3,
.data-table thead tr.main-header th h4,
.data-table thead tr.main-header th h5,
.data-table thead tr.main-header th .h3,
.data-table thead tr.main-header th .h4,
.data-table thead tr.main-header th .h5,
.table-sticky thead > tr:first-child > th h3,
.table-sticky thead > tr:first-child > th h4,
.table-sticky thead > tr:first-child > th h5,
.table-sticky thead > tr:first-child > th .h3,
.table-sticky thead > tr:first-child > th .h4,
.table-sticky thead > tr:first-child > th .h5 {
    margin-bottom: 0;
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 700;
}

/* Sub-Header Row */
.data-table thead tr.sub-header th {
    top: 49px;
    z-index: 9;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 10px;
}

.data-table thead tr.sub-header th h3,
.data-table thead tr.sub-header th h4,
.data-table thead tr.sub-header th h5,
.data-table thead tr.sub-header th .h3,
.data-table thead tr.sub-header th .h4,
.data-table thead tr.sub-header th .h5,
.table-sticky thead > tr:nth-child(2) > th h3,
.table-sticky thead > tr:nth-child(2) > th h4,
.table-sticky thead > tr:nth-child(2) > th h5,
.table-sticky thead > tr:nth-child(2) > th .h3,
.table-sticky thead > tr:nth-child(2) > th .h4,
.table-sticky thead > tr:nth-child(2) > th .h5 {
    margin-bottom: 0;
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 700;
}

.data-table tbody td.h5,
.data-table tbody th.h5,
.table-sticky tbody td.h5,
.table-sticky tbody th.h5 {
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 600;
}

.data-table th[data-sort] .sort-icon {
    color: #94a3b8;
    line-height: 0.78;
}

.data-table th[data-sort] .sort-icon .fa {
    opacity: 0.38;
    transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.data-table th[data-sort]:hover .sort-icon .fa {
    opacity: 0.62;
}

.data-table th[data-sort] .sort-icon.is-up .fa-caret-up,
.data-table th[data-sort] .sort-icon.is-down .fa-caret-down {
    color: #1d4ed8;
    opacity: 1;
    transform: scale(1.08);
}

/* ============================================
   SUBJECT COLOR CODING
   ============================================ */

/* Base Columns - Gray */
.col-base {
    background-color: #f1f5f9 !important;
    color: #475569;
    font-weight: 500;
    min-width: 70px;
}

th.col-base {
    background-color: #cbd5e1 !important;
    color: #1e293b;
}

/* Chinese - BLUE */
.col-chi {
    background-color: #eff6ff !important;
    color: #1e3a8a !important;
    font-weight: 500;
}

th.col-chi {
    background-color: var(--color-subject-chi) !important;
    color: white !important;
}

/* English - ORANGE */
.col-eng {
    background-color: #fff7ed !important;
    color: #7c2d12 !important;
    font-weight: 500;
}

th.col-eng {
    background-color: var(--color-subject-eng) !important;
    color: white !important;
}

/* Math - RED */
.col-math {
    background-color: #fef2f2 !important;
    color: #7f1d1d !important;
    font-weight: 500;
}

th.col-math {
    background-color: var(--color-subject-math) !important;
    color: white !important;
}

/* Pro 1 - GREEN */
.col-pro1 {
    background-color: #f0fdf4 !important;
    color: #14532d !important;
    font-weight: 500;
}

th.col-pro1 {
    background-color: var(--color-subject-pro1) !important;
    color: white !important;
}

/* Pro 2 - PURPLE */
.col-pro2 {
    background-color: #eef2ff !important;
    color: #312e81 !important;
    font-weight: 500;
}

th.col-pro2 {
    background-color: var(--color-subject-pro2) !important;
    color: white !important;
}

/* Total - SLATE */
.col-total {
    background-color: #f8fafc !important;
    color: #0f172a;
    font-weight: 700;
}

th.col-total {
    background-color: var(--color-subject-total) !important;
    color: white;
}

/* Bold Grade Points */
.data-table tr th:nth-child(4n+8),
.data-table tr td:nth-child(4n+8) {
    font-weight: 800;
}

/* Data Table Enhanced Interactions */
.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--color-primary-lighter) !important;
}

/* B106 Subject Standard Table */
.b106-table {
    font-size: 0.84rem;
}

.b106-table th,
.b106-table td {
    padding: 10px 8px;
}

.b106-table thead tr.main-header th {
    font-size: 0.92rem;
    padding: 12px 10px;
}

.b106-table thead tr.main-header th h3 {
    font-size: 0.92rem;
    font-weight: 700;
}

.b106-table tbody td.h5 {
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 600;
}

.b106-table .b106-label-cell {
    font-weight: 700;
}

.b106-table tbody tr.b106-row:hover {
    background-color: transparent !important;
}

/* Custom Scrollbar - Branded & Modern */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Unified Works Section Buttons */
.works-option-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    background: white;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-option-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.works-option-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* iOS Input Zoom Fix & Enhanced Focus States */
input, select, textarea {
    font-size: 16px !important; /* Prevents auto-zoom on mobile */
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(26, 139, 88, 0.1) !important;
    outline: none;
}

/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */
@media screen and (max-width: 768px) {
    .report-wrapper {
        max-height: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }

    .report-wrapper::after {
        content: "← 左右滑動查看更多 →";
        display: block;
        text-align: center;
        color: #94a3b8;
        font-size: 0.75rem;
        padding: 8px;
        background: #f1f5f9;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 0.8rem;
        min-width: 60px;
    }

    .data-table thead tr.main-header th {
        font-size: 0.85rem;
        padding: 10px 8px;
    }

    .data-table thead tr.main-header th h3,
    .data-table thead tr.main-header th h4,
    .data-table thead tr.main-header th h5,
    .data-table thead tr.main-header th .h3,
    .data-table thead tr.main-header th .h4,
    .data-table thead tr.main-header th .h5,
    .table-sticky thead > tr:first-child > th h3,
    .table-sticky thead > tr:first-child > th h4,
    .table-sticky thead > tr:first-child > th h5,
    .table-sticky thead > tr:first-child > th .h3,
    .table-sticky thead > tr:first-child > th .h4,
    .table-sticky thead > tr:first-child > th .h5 {
        font-size: 0.85rem;
    }

    .data-table thead tr.sub-header th {
        top: 44px;
        font-size: 0.75rem;
        padding: 6px 6px;
    }

    .data-table thead tr.sub-header th h3,
    .data-table thead tr.sub-header th h4,
    .data-table thead tr.sub-header th h5,
    .data-table thead tr.sub-header th .h3,
    .data-table thead tr.sub-header th .h4,
    .data-table thead tr.sub-header th .h5,
    .table-sticky thead > tr:nth-child(2) > th h3,
    .table-sticky thead > tr:nth-child(2) > th h4,
    .table-sticky thead > tr:nth-child(2) > th h5,
    .table-sticky thead > tr:nth-child(2) > th .h3,
    .table-sticky thead > tr:nth-child(2) > th .h4,
    .table-sticky thead > tr:nth-child(2) > th .h5 {
        font-size: 0.75rem;
    }

    .filter-body {
        flex-direction: column;
    }

    .filter-column {
        width: 100%;
        margin-bottom: 16px;
    }

    .filter-footer {
        flex-direction: column;
        gap: 10px;
    }

    .btn-query {
        width: 100%;
        margin-left: 0;
    }

    /* 佳作作品篩選區 - 手機端調整 */
    .works-filter-options {
        flex-wrap: wrap;
    }

    .works-action-row {
        flex-direction: column;
        gap: 10px;
    }

    .works-action-btn {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {

    .data-table th,
    .data-table td {
        padding: 8px 6px;
        font-size: 0.75rem;
        min-width: 50px;
    }

    .col-base {
        min-width: 55px;
    }
}

/* 右下角首頁按鈕 */
.home-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
}

.home-fab:hover {
    transform: scale(1.1) translateY(-3px);
}

.home-fab:active {
    transform: scale(0.95);
}

.home-fab svg {
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    fill: var(--color-primary);
}

/* ===== Download Zone Styles ===== */
.download-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.download-actions-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.download-action-btn {
    padding: 12px 24px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-action-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.download-action-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.download-file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.download-file-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.download-file-card .file-icon {
    margin-bottom: 12px;
}

.download-file-card .file-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
}

/* ===== Works Section Styles ===== */
.works-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.works-filter-section {
    padding: 20px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-label-inline {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 80px;
}

.filter-btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.works-filter-btn {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.works-filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.works-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.works-table thead th {
    padding: 16px;
    background: linear-gradient(to right, var(--color-primary), #4ade80);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    border-bottom: 2px solid var(--color-primary);
}

.works-table tbody td {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.works-table tbody tr:hover {
    background: var(--color-primary-lighter);
}

.work-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.work-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.work-comment-container {
    padding: 16px;
}

.work-comment {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
}

.pagination-btn {
    padding: 10px 20px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* ===== PDF Cards Grid (試題解析下載) ===== */
.pdf-cards-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    padding: 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    margin-top: 20px;
}

.pdf-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.pdf-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.pdf-card.selected {
    background: #fef3c7;
    border-color: #f59e0b;
}

.pdf-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.pdf-info {
    text-align: center;
}

.pdf-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px 0;
}

.pdf-detail {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
}

/* ===== Folder Cards Grid (歷屆試題下載) ===== */
.folder-cards-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 40px 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    margin-top: 20px;
}

.folder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.folder-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.folder-card.selected {
    background: #fef3c7;
    border-color: #f59e0b;
}

.folder-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.folder-info {
    text-align: center;
}

.folder-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.folder-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== Download Buttons Row ===== */
.download-btn-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.download-btn {
    padding: 10px 40px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.download-btn:active {
    transform: scale(0.98);
}

/* ===== Selectable Card State ===== */
.selectable.selected {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
}

/* ===== Works Filter Page (階段一) ===== */
.works-filter-page {
    padding: 20px 0;
}

.works-filter-box {
    margin-bottom: 24px;
}

.works-filter-header {
    text-align: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--color-primary-lighter) 0%, #d1fae5 100%);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-primary);
    letter-spacing: 0.5em;
    margin-bottom: 12px;
}

.works-filter-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.works-option-btn {
    padding: 10px 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-option-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
}

.works-option-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.works-mode-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-right: 20px;
}

.works-mode-label {
    padding: 6px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Works Result Page (階段二) ===== */
.works-result-page {
    padding: 20px 0;
}

.works-action-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.works-action-btn {
    padding: 10px 32px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-action-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
}

.works-action-btn.primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.works-action-btn.primary:hover {
    background: #059669;
}

/* ===== Account Page ===== */
.account-page {
    margin-top: var(--spacing-xl);
}

.account-switcher {
    margin: 16px 0 28px;
}

.account-content {
    max-width: 960px;
    margin: 0 auto;
}

.account-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.account-profile-item {
    padding: 16px 18px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.account-profile-item span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.account-profile-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    word-break: break-word;
}

.account-page .input-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.account-label-box label {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.account-input-box {
    position: relative;
}

.account-input-box input,
.account-table-input {
    width: 100%;
    padding: 10px 44px 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
}

.account-input-box .btn-visible,
.btn-visible-account {
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.account-input-box .btn-visible i:first-child,
.account-input-box .btn-visible.active i:last-child,
.btn-visible-account i:first-child,
.btn-visible-account.active i:last-child {
    display: none;
}

.account-input-box .btn-visible i:last-child,
.account-input-box .btn-visible.active i:first-child,
.btn-visible-account i:last-child,
.btn-visible-account.active i:first-child {
    display: inline-block;
}

.account-filter-panel {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 16px;
    padding: 20px;
    margin-bottom: 24px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.account-filter-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.account-page .form-select {
    width: 100%;
    min-width: 0;
}

.account-action-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.account-action-row-end {
    justify-content: flex-end;
}

.account-action-row .btn-query {
    margin-left: 0;
}

.account-table-wrapper {
    max-height: 500px;
}

.account-table-input {
    min-width: 180px;
}

@media screen and (max-width: 768px) {
    .account-profile-grid,
    .account-filter-panel {
        grid-template-columns: 1fr;
    }

    .account-page .input-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .account-action-row,
    .account-action-row-end {
        flex-direction: column;
        justify-content: stretch;
    }

    .account-action-row .btn-query,
    .account-action-row .works-action-btn {
        width: 100%;
    }
}

/* Direct Download Card */
.download-file-card.direct-download:hover {
    background: #f0fdf4;
    border-color: var(--color-primary);
    cursor: pointer;
}

/* ===== Unit Analysis Table ===== */
.unit-analysis-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.unit-analysis-table thead tr {
    background: linear-gradient(to bottom, #16a34a, #15803d);
}

.unit-analysis-table th {
    color: white;
    padding: 14px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.unit-analysis-table .col-group {
    width: 180px;
}

.unit-analysis-table tbody tr {
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.unit-analysis-table tbody tr.row-alt {
    background: #f0fdf4;
}

.unit-analysis-table tbody tr:hover {
    background: #ecfdf5;
}

.unit-analysis-table .cell-group {
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.unit-analysis-table .cell-btn {
    padding: 8px;
    text-align: center;
}

/* Unit Subject Button */
.unit-subject-btn {
    padding: 8px 20px;
    background: white;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.unit-subject-btn:hover {
    background: var(--color-primary-lighter);
}

.unit-subject-btn.selected {
    background: var(--color-primary);
    color: white;
}

.unit-subject-btn.avg {
    background: #d1fae5;
    border-color: var(--color-primary);
}

.unit-subject-btn.avg.selected {
    background: var(--color-primary);
    color: white;
}

/* Student Table Cells */
.unit-analysis-table .cell-center {
    padding: 12px 10px;
    text-align: center;
    color: var(--text-primary);
}

.unit-analysis-table.student-table .col-subject {
    background: #22c55e;
}

/* Unit Select Button Selected State */
.btn-mini-outline.unit-select-btn.selected {
    background: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Unit Select Button Base State (Pill Style) */
.btn-mini-outline.unit-select-btn {
    border-radius: 9999px;
    /* Pill shape */
    padding: 6px 16px;
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: #4b5563;
    transition: all 0.2s ease;
    min-width: 80px;
    /* Ensure uniform width */
}

.btn-mini-outline.unit-select-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-mini-outline.unit-select-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}



/* 成績查詢按鈕角色控制 */
/* 預設隱藏所有成績查詢按鈕 */
.score-action-btn {
    display: none !important;
}

/* 學校視角：顯示有 role-school 類別的按鈕 */
body[data-user-role="school"] .score-action-btn.role-school {
    display: flex !important;
}

/* 老師視角：顯示有 role-teacher 類別的按鈕 */
body[data-user-role="teacher"] .score-action-btn.role-teacher {
    display: flex !important;
}

/* 學生視角：顯示有 role-student 類別的按鈕 */
body[data-user-role="student"] .score-action-btn.role-student {
    display: flex !important;
}

/* 下拉選單包裝器的角色控制 */
.dropdown-btn-wrapper {
    display: none !important;
}

body[data-user-role="school"] .dropdown-btn-wrapper.role-school {
    display: block !important;
}

body[data-user-role="teacher"] .dropdown-btn-wrapper.role-teacher {
    display: block !important;
}

body[data-user-role="student"] .dropdown-btn-wrapper.role-student {
    display: block !important;
}

/* 下載區說明文字 */
.download-instruction {
    margin-top: 24px;
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    background-color: #f9f9fa;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

/* ========================================
   Role-based Visibility Control (Restored)
   ======================================== */

/* 老師視角：隱藏學校專用的元素 */
body[data-user-role="teacher"] .role-school {
    display: none !important;
}

/* 學生視角：隱藏學校和老師專用的元素 */
body[data-user-role="student"] .role-school,
body[data-user-role="student"] .role-teacher {
    display: none !important;
}

/* 訪客視角：隱藏所有角色專用的元素 */
body[data-user-role="guest"] .role-school,
body[data-user-role="guest"] .role-teacher,
body[data-user-role="guest"] .role-student {
    display: none !important;
}



/* 成績查詢按鈕角色控制 */
/* 預設隱藏所有成績查詢按鈕 */
.score-action-btn {
    display: none !important;
}

/* 學校視角：顯示有 role-school 類別的按鈕 */
body[data-user-role="school"] .score-action-btn.role-school {
    display: flex !important;
}

/* 老師視角：顯示有 role-teacher 類別的按鈕 */
body[data-user-role="teacher"] .score-action-btn.role-teacher {
    display: flex !important;
}

/* 學生視角：顯示有 role-student 類別的按鈕 */
body[data-user-role="student"] .score-action-btn.role-student {
    display: flex !important;
}

/* 下拉選單包裝器的角色控制 */
.dropdown-btn-wrapper {
    display: none !important;
}

body[data-user-role="school"] .dropdown-btn-wrapper.role-school {
    display: block !important;
}

body[data-user-role="teacher"] .dropdown-btn-wrapper.role-teacher {
    display: block !important;
}

body[data-user-role="student"] .dropdown-btn-wrapper.role-student {
    display: block !important;
}

/* 確保下拉選單觸發按鈕在 wrapper 顯示時也顯示 */
.dropdown-btn-wrapper .score-action-btn {
    display: flex !important;
}

/* ========================================
   下載區灰框背景樣式
   ======================================== */
.download-content-box {
    background-color: #f9f9fa;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 16px;
}

.download-content-box .download-files-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ========================================
   區塊切換動畫
   ======================================== */
.content-section {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 下載內容區塊切換動畫 */
.download-type-content {
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   選擇考試下拉選單 - 高質感設計
   選擇考試下拉選單 - 符合網站風格
   ======================================== */
.exam-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.exam-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 36px 8px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-primary-dark);
    cursor: pointer;
    min-width: 260px;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A8B58' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.exam-select:hover {
    border-color: var(--color-primary);
    background-color: var(--color-primary-lighter);
}

.exam-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.inquiries-score-page .nav-breadcrumb {
    gap: 12px;
}

.inquiries-score-page .inquiries-filter-panel {
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #dbe5ef;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.inquiries-score-page .inquiries-filter-grid {
    align-items: stretch;
}

.inquiries-score-page .inquiry-panel-card {
    height: 100%;
    border: 1px solid #dbe5ef;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.inquiries-score-page .inquiry-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text-primary);
    font-weight: 700;
}

.inquiries-score-page .inquiry-panel-body {
    padding: 18px;
}

.inquiries-score-page .inquiry-panel-footer {
    padding: 14px 18px 18px;
    border-top: 1px solid #e2e8f0;
}

.inquiries-score-page .inquiry-panel-header .text-danger {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.inquiries-score-section .inquiry-exam-host {
    display: block;
    min-width: 260px;
}

.inquiries-score-section .inquiry-exam-host .exam-select {
    display: block;
    width: 100%;
}

.inquiries-score-section .exam-selector .exam-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 260px;
    min-height: 42px;
    padding: 8px 36px 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--bg-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A8B58' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    box-shadow: none;
    color: var(--color-primary-dark);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.inquiries-score-section .exam-selector .exam-select:hover {
    border-color: var(--color-primary);
    background-color: var(--color-primary-lighter);
}

.inquiries-score-section .exam-selector .exam-select:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--bg-white);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.inquiries-score-section .inquiry-report-grid {
    margin-top: 0;
    margin-bottom: 20px;
}

.inquiries-score-section .inquiry-condition-container {
    min-height: auto;
    margin-top: 20px;
    padding: 0;
}

.inquiries-score-section .inquiry-condition-container .filter-header {
    border-radius: 8px 8px 0 0;
}

.inquiries-score-section .inquiry-condition-container .filter-title {
    font-size: 1rem;
}

.inquiries-score-section .inquiry-condition-container .filter-toggle {
    font-family: inherit;
}

.inquiries-score-section .inquiry-condition-container .filter-body {
    gap: 16px;
}

.inquiries-score-section .inquiry-condition-container .filter-column {
    min-width: 240px;
}

.inquiries-score-section .filter-subject-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-height: none;
}

.inquiries-score-section .filter-subject-list > div {
    display: none;
}

.inquiries-score-section .filter-subject-list button[data-subject] {
    min-width: 108px;
}

.inquiries-score-section .filter-btn-row {
    justify-content: flex-start;
}

.inquiries-score-section .filter-btn-row .btn {
    min-width: 96px;
}

.inquiries-score-section .filter-footer {
    justify-content: flex-end;
}

.inquiries-score-section .filter-footer .inquiry-submit-wrap {
    padding: 0;
}

.inquiries-score-section .inquiry-report-grid .score-action-btn.inquiry-report-btn {
    display: inline-flex !important;
}

.inquiries-score-section .inquiry-dependent-grid {
    margin-top: 0;
}

.inquiries-score-page .inquiry-submit-wrap {
    width: 100%;
    padding: 12px 0;
}

.inquiries-score-page .inquiry-actions-grid,
.inquiries-score-page .inquiry-selection-grid,
.inquiries-score-page .inquiry-subject-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inquiries-score-page .inquiry-subject-grid > div {
    display: none;
}

.inquiries-score-page .inquiry-choice-item {
    position: relative;
    min-width: 0;
}

.inquiries-score-page .inquiry-actions-grid .inquiry-choice-item,
.inquiries-score-page .inquiry-selection-grid .inquiry-choice-item {
    display: flex;
}

.inquiries-score-page .inquiry-choice-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.inquiries-score-page .inquiry-choice-label,
.inquiries-score-page .inquiry-subject-grid button[data-subject] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease, transform 0.1s ease;
    box-shadow: none;
    white-space: normal;
}

.inquiries-score-page .inquiry-choice-label:hover,
.inquiries-score-page .inquiry-subject-grid button[data-subject]:hover,
.inquiries-score-page button[data-select="all"]:hover,
.inquiries-score-page button[data-select="cancel"]:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
    color: var(--color-primary);
    text-decoration: none;
}

.inquiries-score-page .inquiry-choice-input:checked + .inquiry-choice-label,
.inquiries-score-page .inquiry-subject-grid button[data-subject].active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--bg-white);
    box-shadow: 0 3px 0 var(--color-primary), var(--shadow-sm);
    transform: translateY(-2px);
}

.inquiries-score-page .inquiry-choice-input:focus + .inquiry-choice-label,
.inquiries-score-page .inquiry-exam-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.inquiries-score-page .inquiry-selection-grid .inquiry-choice-label {
    width: 100%;
    justify-content: flex-start;
}

.inquiries-score-page .inquiry-selection-grid .inquiry-choice-item {
    flex: 1 1 100%;
}

.inquiries-score-page .inquiry-actions-grid .inquiry-choice-item {
    flex: 1 1 220px;
}

.inquiries-score-page .inquiry-actions-grid .inquiry-choice-label {
    width: 100%;
}

.inquiries-score-page .inquiry-exam-dropdown {
    position: relative;
}

.inquiries-score-page .inquiry-exam-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--color-primary-dark);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.inquiries-score-page .inquiry-exam-trigger:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
}

.inquiries-score-page .inquiry-exam-trigger-icon {
    flex-shrink: 0;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.inquiries-score-page .inquiry-exam-dropdown.open .inquiry-exam-trigger-icon {
    transform: rotate(180deg);
}

.inquiries-score-page .inquiry-exam-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    display: none;
    padding: 8px;
    background: var(--bg-white);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 320px;
    overflow-y: auto;
}

.inquiries-score-page .inquiry-exam-dropdown.open .inquiry-exam-menu {
    display: block;
}

.inquiries-score-page .inquiry-exam-menu .inquiry-choice-item {
    display: block;
    width: 100%;
}

.inquiries-score-page .inquiry-exam-menu .inquiry-choice-item + .inquiry-choice-item {
    margin-top: 6px;
}

.inquiries-score-page .inquiry-exam-menu .inquiry-choice-label {
    width: 100%;
    justify-content: flex-start;
    min-height: 42px;
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

.inquiries-score-page .inquiry-exam-menu .inquiry-choice-input:checked + .inquiry-choice-label {
    background: var(--color-primary-lighter);
    border-color: var(--color-primary-light);
    box-shadow: none;
    transform: none;
}

.inquiries-score-page .inquiry-empty-state {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.report-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.report-breadcrumb-title {
    margin: 0;
    color: var(--color-primary-dark);
    font-size: 1.25rem;
    font-weight: 700;
}

.report-breadcrumb-separator {
    margin: 0 4px;
    color: #64748b;
}

.chart-note-card {
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
}

.chart-note-card__title {
    margin: 0 0 12px 0;
    color: #1e293b;
    font-size: 1rem;
}

.chart-note-card__text {
    margin: 6px 0;
    color: #475569;
    line-height: 1.6;
    font-size: 0.9rem;
    padding-left: 1.25rem;
    text-indent: -1.25rem;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .exam-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .inquiries-score-page .inquiries-filter-panel {
        padding: 18px;
    }

    .inquiries-score-page .inquiry-toggle-btn,
    .inquiries-score-page button[data-select="submit"] {
        min-width: auto;
    }

    .inquiries-score-page .inquiry-actions-grid .inquiry-choice-item,
    .inquiries-score-page .inquiry-selection-grid .inquiry-choice-item,
    .inquiries-score-page .inquiry-choice-label,
    .inquiries-score-page .inquiry-subject-grid button[data-subject],
    .inquiries-score-page button[data-select="all"],
    .inquiries-score-page button[data-select="cancel"] {
        width: 100%;
    }

    .exam-select {
        width: 100%;
        min-width: unset;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ============================================
   CONTACT SECTION & UTILITIES
   ============================================ */
.hidden-section {
    display: none !important;
}

.contact-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.contact-info-card,
.contact-form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 24px;
}

.contact-info-card {
    flex: 1;
    min-width: 300px;
}

.contact-form-card {
    flex: 1.5;
    min-width: 350px;
}

.contact-card-title {
    color: var(--color-primary);
    margin-bottom: 20px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.contact-item {
    margin-bottom: 16px;
}

.contact-item:last-child {
    margin-bottom: 0;
}

.contact-label {
    color: #475569;
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.contact-value {
    color: #1e293b;
    font-size: 1.05rem;
}

.contact-link {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.contact-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.contact-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.contact-form-group {
    flex: 1;
    min-width: 150px;
}

.contact-form-group label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-weight: 500;
    font-size: 0.9rem;
}

.contact-input,
.contact-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.contact-input:focus,
.contact-textarea:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 139, 88, 0.1);
}

.contact-textarea {
    height: 120px;
    resize: vertical;
}

@media (max-width: 768px) {
    .contact-container {
        flex-direction: column;
    }

    .contact-info-card,
    .contact-form-card {
        min-width: 100%;
    }
}

/* 報表容器卡片化 */
.report-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 32px;
    margin-bottom: 24px;
}

/* 標題區塊 */
.report-header {
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 16px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.report-title {
    font-size: 1.25rem;
    color: var(--color-primary-dark);
    font-weight: 700;
    margin: 0 0 12px 0;
}

.student-info-badge {
    display: inline-flex;
    align-items: center;
    background: var(--color-primary-lighter);
    color: var(--color-primary-dark);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.exam-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: right;
    line-height: 1.5;
}

/* 科目顏色定義 (更飽和一點的邊框，讓格子更清晰) */
.subj-header {
    font-weight: 600;
    color: #fff;
}

    .subj-header.chi {
        background-color: #3b82f6;
    }
    /* 藍色 */
    .subj-header.eng {
        background-color: #f97316;
    }
    /* 橘色 */
    .subj-header.math {
        background-color: #ef4444;
    }
    /* 紅色 */
    .subj-header.pro1 {
        background-color: #a855f7;
    }
    /* 紫色 */
    .subj-header.pro2 {
        background-color: #ec4899;
    }
    /* 粉色 */
    .subj-header.total {
        background-color: #10b981;
    }
/* 綠色 */

/* 表格樣式優化 */
.modern-table {
    width: 100%;
    border-collapse: separate; /* 為了圓角 */
    border-spacing: 0;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

    .modern-table th, .modern-table td {
        padding: 12px 16px;
        text-align: center;
        border-bottom: 1px solid #e2e8f0;
        border-right: 1px solid #e2e8f0;
    }

        .modern-table th:last-child, .modern-table td:last-child {
            border-right: none;
        }

    .modern-table tr:last-child td {
        border-bottom: none;
    }

.row-label {
    background-color: #f1f5f9;
    color: var(--text-primary);
    font-weight: 600;
    width: 100px;
    text-align: center;
}

/* 5格分數容器 */
.score-grid-container {
    display: flex;
    justify-content: center;
    gap: 4px;
}
/* 統一寬度的格子 */
.score-cell {
    width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background-color: #fff;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
}

    .score-cell.empty {
        background-color: #f8fafc;
        color: #94a3b8;
    }

/* 落點分析表格特別樣式 */
.analysis-table th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
}

/* 狀態標籤 */
.status-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-high {
    background: #dcfce7;
    color: #166534;
}
/* 錄取機會高 */
.status-low {
    background: #fee2e2;
    color: #991b1b;
}
/* 錄取機會低 */

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin: 32px 0 16px 0;
    padding-left: 12px;
    border-left: 4px solid var(--color-primary);
}

.flex-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.flex-col {
    flex: 1;
    min-width: 300px;
}

.absent-text {
    color: #dc2626;
    font-weight: 600;
}

.score-text {
    font-weight: 600;
    color: var(--text-primary);
}

.score-sub {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 4px;
}

.student-b120-report {
    color: #1e293b;
}

    .student-b120-report .student-b120-card {
        background: #fff;
        border: 1px solid #dbe5f0;
        border-radius: 24px;
        box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
        padding: 28px;
    }

    .student-b120-report .student-b120-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        gap: 24px;
        margin-bottom: 24px;
        padding-bottom: 18px;
        border-bottom: 2px solid #dbeafe;
    }

    .student-b120-report .student-b120-title {
        margin: 0;
        color: #1d4ed8;
        font-size: 1.3rem;
        font-weight: 700;
    }

    .student-b120-report .student-b120-school {
        margin-top: 10px;
        font-size: 0.95rem;
        font-weight: 600;
        color: #0f172a;
    }

    .student-b120-report .student-b120-student {
        margin-top: 6px;
        color: #334155;
        font-size: 0.95rem;
    }

    .student-b120-report .student-b120-subtitle {
        margin-top: 6px;
        color: #64748b;
        font-size: 0.9rem;
    }

    .student-b120-report .student-b120-meta {
        min-width: 220px;
        color: #475569;
        font-size: 0.85rem;
        text-align: right;
        line-height: 1.7;
    }

    .student-b120-report .student-b120-table-wrap {
        overflow: auto;
        border: 1px solid #dbe5f0;
        border-radius: 18px;
        background: #fff;
    }

    .student-b120-report .student-b120-table {
        width: 100%;
        min-width: 760px;
        margin: 0;
        border-collapse: separate;
        border-spacing: 0;
    }

        .student-b120-report .student-b120-table th,
        .student-b120-report .student-b120-table td {
            padding: 12px 14px;
            border-right: 1px solid #e2e8f0;
            border-bottom: 1px solid #e2e8f0;
            text-align: center;
            vertical-align: middle;
        }

        .student-b120-report .student-b120-table thead th {
            font-weight: 700;
        }

        .student-b120-report .student-b120-table tr:last-child td,
        .student-b120-report .student-b120-table tr:last-child th {
            border-bottom: 0;
        }

        .student-b120-report .student-b120-table th:last-child,
        .student-b120-report .student-b120-table td:last-child {
            border-right: 0;
        }

    .student-b120-report .student-b120-row-label {
        background: #f8fafc;
        color: #0f172a;
        font-weight: 700;
        white-space: nowrap;
    }

    .student-b120-report .student-b120-subject-head {
        color: #fff;
        font-weight: 700;
    }

    .student-b120-report .student-b120-subject-head--chi {
        background: #3b82f6;
    }

    .student-b120-report .student-b120-subject-head--eng {
        background: #f97316;
    }

    .student-b120-report .student-b120-subject-head--math {
        background: #ef4444;
    }

    .student-b120-report .student-b120-subject-head--pro1 {
        background: #22c55e;
    }

    .student-b120-report .student-b120-subject-head--pro2 {
        background: #6366f1;
    }

    .student-b120-report .student-b120-subject-head--total {
        background: #10b981;
    }

    .student-b120-report .student-b120-value {
        font-weight: 600;
        color: #1e293b;
    }

        .student-b120-report .student-b120-value.is-empty {
            color: #94a3b8;
            font-weight: 500;
        }

        .student-b120-report .student-b120-value.is-absent {
            color: #dc2626;
        }

        .student-b120-report .student-b120-value.is-emphasis {
            color: #1d4ed8;
            font-size: 1.02rem;
        }

    .student-b120-report .student-b120-score-sub {
        margin-left: 4px;
        color: #64748b;
        font-size: 0.82rem;
    }

    .student-b120-report .student-b120-score-grid {
        display: grid;
        grid-template-columns: repeat(5, minmax(32px, 1fr));
        gap: 6px;
    }

    .student-b120-report .student-b120-score-cell {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 32px;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        background: #fff;
        font-size: 0.84rem;
        font-weight: 600;
    }

        .student-b120-report .student-b120-score-cell.is-empty {
            background: #f8fafc;
            color: #94a3b8;
        }

    .student-b120-report .student-b120-grid-2 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .student-b120-report .student-b120-answer-wrap {
        overflow-x: auto;
        border: 1px solid #dbe5f0;
        border-radius: 18px;
        background: #fff;
    }

    .student-b120-report .student-b120-answer-table {
        min-width: 1240px;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        font-size: 0.84rem;
    }

        .student-b120-report .student-b120-answer-table th,
        .student-b120-report .student-b120-answer-table td {
            padding: 6px 4px;
            text-align: center;
            border-right: 1px solid #e2e8f0;
            border-bottom: 1px solid #e2e8f0;
            vertical-align: middle;
        }

        .student-b120-report .student-b120-answer-table tr:last-child td {
            border-bottom: 0;
        }

        .student-b120-report .student-b120-answer-table th:last-child,
        .student-b120-report .student-b120-answer-table td:last-child {
            border-right: 0;
        }

    .student-b120-report .student-b120-answer-head {
        background: #f8fafc;
        color: #475569;
        font-weight: 700;
    }

        .student-b120-report .student-b120-answer-head.is-fixed {
            min-width: 78px;
        }

    .student-b120-report .student-b120-answer-subject {
        min-width: 76px;
        font-weight: 700;
        font-size: 0.95rem;
    }

        .student-b120-report .student-b120-answer-subject.student-b120-answer-chi {
            background: rgba(59, 130, 246, 0.08);
            color: #1d4ed8;
        }

        .student-b120-report .student-b120-answer-subject.student-b120-answer-eng {
            background: rgba(249, 115, 22, 0.08);
            color: #c2410c;
        }

        .student-b120-report .student-b120-answer-subject.student-b120-answer-math {
            background: rgba(239, 68, 68, 0.08);
            color: #b91c1c;
        }

        .student-b120-report .student-b120-answer-subject.student-b120-answer-pro1 {
            background: rgba(34, 197, 94, 0.08);
            color: #15803d;
        }

        .student-b120-report .student-b120-answer-subject.student-b120-answer-pro2 {
            background: rgba(99, 102, 241, 0.08);
            color: #4338ca;
        }

    .student-b120-report .student-b120-answer-label {
        min-width: 88px;
        font-weight: 700;
    }

        .student-b120-report .student-b120-answer-label.student-b120-answer-chi {
            background: rgba(59, 130, 246, 0.14);
            color: #1d4ed8;
        }

        .student-b120-report .student-b120-answer-label.student-b120-answer-eng {
            background: rgba(249, 115, 22, 0.14);
            color: #c2410c;
        }

        .student-b120-report .student-b120-answer-label.student-b120-answer-math {
            background: rgba(239, 68, 68, 0.14);
            color: #b91c1c;
        }

        .student-b120-report .student-b120-answer-label.student-b120-answer-pro1 {
            background: rgba(34, 197, 94, 0.14);
            color: #15803d;
        }

        .student-b120-report .student-b120-answer-label.student-b120-answer-pro2 {
            background: rgba(99, 102, 241, 0.14);
            color: #4338ca;
        }

    .student-b120-report .student-b120-answer-label--student {
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
    }

    .student-b120-report .student-b120-answer-cell.is-group-end {
        border-right-width: 2px;
        border-right-color: #cbd5e1;
    }

    .student-b120-report .student-b120-answer-value {
        display: inline-block;
        min-width: 10px;
        color: #1e293b;
        font-weight: 600;
        font-family: Consolas, monospace;
    }

        .student-b120-report .student-b120-answer-value.is-empty,
        .student-b120-report .student-b120-answer-value.is-muted {
            color: #94a3b8;
        }

        .student-b120-report .student-b120-answer-value.is-correct {
            color: #16a34a;
        }

        .student-b120-report .student-b120-answer-value.is-warn {
            color: #d97706;
        }

    .student-b120-report .student-b120-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 24px;
        margin-top: 12px;
        padding: 14px 16px;
        border-radius: 14px;
        background: #f8fafc;
        color: #475569;
        font-size: 0.84rem;
    }

    .student-b120-report .student-b120-analysis-note {
        margin: 14px 0 0;
        padding: 14px 16px;
        border-radius: 14px;
        background: #eff6ff;
        color: #1e40af;
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .student-b120-report .student-b120-status {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 96px;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 0.8rem;
        font-weight: 700;
    }

        .student-b120-report .student-b120-status.is-high {
            background: #dcfce7;
            color: #166534;
        }

        .student-b120-report .student-b120-status.is-low {
            background: #fee2e2;
            color: #991b1b;
        }

    .student-b120-report .student-b120-empty {
        color: #64748b;
        font-size: 0.95rem;
    }

@media (max-width: 991.98px) {
    .student-b120-report .student-b120-card {
        padding: 20px;
    }

    .student-b120-report .student-b120-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .student-b120-report .student-b120-meta {
        text-align: left;
    }

    .student-b120-report .student-b120-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Responsive Design - Mobile (< 768px)
   ======================================== */
@media (max-width: 768px) {
    .header-container {
        padding: 12px 16px;
        /* Tighter padding for mobile */
    }

    .logo-section {
        gap: var(--spacing-xs);
    }

    .logo-img {
        width: 36px;
        height: 36px;
    }

    .logo-title {
        display: none;
    }

    .logo-subtitle {
        display: none;
    }

    .user-info {
        padding: 6px 10px;
        font-size: 0.85rem;
        gap: 6px;
    }

    .user-role-icon {
        width: 18px;
        height: 18px;
    }

    .action-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .login-trigger {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .login-modal .modal-dialog {
        max-width: calc(100vw - 1.5rem);
        margin: 0.75rem auto;
    }

    .login-modal-panel {
        padding: 1.5rem 1rem 1.25rem;
        border-radius: 22px;
    }

    .login-modal-title {
        font-size: 1.35rem;
        padding: 0 1.75rem;
    }

    .login-modal-subtitle {
        font-size: 0.88rem;
    }

    .login-modal-user-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .login-field-input {
        min-height: 3rem;
        font-size: 0.95rem;
    }

    .main-nav {
        width: 260px;
        padding-top: 50px;
        justify-content: flex-start;
    }

    /* Main Content */
    .container {
        padding: var(--spacing-md);
    }

    /* Section Header - 垂直排列 */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-title h2 {
        font-size: 1.1rem;
    }

    /* Score/Content Section - 減少 padding */
    .score-section,
    .content-section {
        padding: var(--spacing-md);
    }

    /* 按鈕列 - 手機端自動換行 */
    .score-actions-grid {
        gap: 8px;
    }

    .score-action-btn {
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    /* 考試選擇器 - 全寬 */
    .exam-select,
    .form-select {
        min-width: unset;
        width: 100%;
    }

    .news-table th,
    .news-table td {
        padding: var(--spacing-sm);
        font-size: 0.85rem;
    }

    .news-page-link {
        min-width: 2.5rem;
        height: 2.5rem;
        padding: 0 0.85rem;
    }

    .news-page-link-label {
        min-width: 0;
    }

    .news-detail-header,
    .news-detail-body {
        padding: 1rem;
    }

    .news-detail-title {
        font-size: 1.2rem;
    }

    .news-detail-body {
        max-height: calc(100vh - 8rem);
    }

    .col-date {
        width: 80px;
    }

    .col-category {
        width: 50px;
    }

    /* 佳作作品表格 - 堆疊佈局 */
    #works-result-page .data-table thead {
        display: none;
    }

    #works-result-page .data-table,
    #works-result-page .data-table tbody,
    #works-result-page .data-table tr,
    #works-result-page .data-table td {
        display: block;
        width: 100%;
    }

        #works-result-page .data-table tr {
            margin-bottom: 16px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            overflow: hidden;
        }

        #works-result-page .data-table td {
            border-bottom: none;
        }

            #works-result-page .data-table td::after {
                display: none;
            }

    /* 單元分析表格 - 橫向滾動 */
    .unit-analysis-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Footer */
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-sm);
    }

    .footer-info,
    .footer-copyright {
        font-size: 0.75rem;
    }

    /* Demo Switcher */
    .demo-switcher {
        bottom: 10px;
        right: 10px;
        padding: var(--spacing-sm);
        flex-wrap: wrap;
    }

    .demo-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* ========================================
   Responsive Design - Small Mobile (< 480px)
   ======================================== */
@media (max-width: 480px) {
    .user-info {
        display: none;
    }

    .hamburger-btn {
        width: 36px;
        height: 36px;
        padding: 8px;
    }

    .hamburger-line {
        width: 16px;
    }

    .user-actions {
        gap: 4px;
    }

    .action-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}
