/* 通用样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563EB;
    --primary-light: #60A5FA;
    --primary-dark: #1D4ED8;
    --primary-gradient: linear-gradient(135deg, #2563EB 0%, #60A5FA 100%);
    --primary-color: #2563EB;
    --brand-gradient: linear-gradient(135deg, #2563EB 0%, #60A5FA 100%);

    --sidebar-bg: #1E293B;
    --sidebar-hover: #334155;

    --secondary-color: #22C993;
    --accent-color: #F59E0B;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;

    --text-dark: #1E293B;
    --text-medium: #6B7280;
    --text-light: #9CA3AF;

    --bg-page: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-input: #F9FAFB;
    --border-color: #E5E7EB;
    --border-input: #E5E7EB;

    --shadow-card: 0 2px 12px rgba(37, 99, 235, 0.06), 0 1px 4px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 8px 32px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 16px 48px rgba(37, 99, 235, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 50px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 750px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
    padding-left: 14px;
    position: relative;
}
.section-title::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 20px;
    background: var(--brand-gradient);
    border-radius: 2px;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--brand-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.45);
}
.btn-primary:active { transform: translateY(0); }

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--text-dark);
    color: #fff;
    padding: 14px 32px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    display: none;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}
.toast.show {
    display: block;
    animation: toastAnim 2s ease-in-out;
}
@keyframes toastAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    10%,90% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ===== Loading ===== */
.loading {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; margin-top: 14px; font-size: 14px; }

/* ===== Modal ===== */
.modal {
    position: fixed; inset: 0;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(6px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9997;
}
.modal-content {
    background: #fff;
    border-radius: var(--radius-xl);
    width: 92%; max-width: 500px; max-height: 80vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalUp 0.3s ease;
}
@keyframes modalUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    padding: 22px 24px;
    border-bottom: 1px solid #F3F4F6;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text-dark); }
.modal-close {
    background: #F3F4F6; border: none;
    font-size: 20px; color: var(--text-medium);
    cursor: pointer; width: 34px; height: 34px;
    border-radius: 50%; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.2s;
}
.modal-close:hover { background: #E5E7EB; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #F3F4F6; }

/* ===== Form ===== */
input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.2s;
    background: var(--bg-input);
    color: var(--text-dark);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
    background: #fff;
}
textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.6;
}

/* ===== School Logo ===== */
.school-logo {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--brand-gradient);
    border: 3px solid rgba(255,255,255,0.9);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.school-logo-book { font-size: 22px; line-height: 1; }
.school-logo-year {
    font-size: 5px; font-weight: 700;
    color: rgba(255,255,255,0.85);
    margin-top: 1px;
}
.school-logo-lg { width: 84px; height: 84px; }
.school-logo-lg .school-logo-book { font-size: 36px; }
.school-logo-lg .school-logo-year { font-size: 9px; margin-top: 2px; }

/* ============ 字号偏好 ============ */
.font-size-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    margin-right: 12px;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
}
.font-size-toggle:hover {
    border-color: #2563EB;
    color: #2563EB;
}
.font-size-toggle .font-size-icon { font-size: 14px; }
.font-size-toggle .font-size-label { font-size: 12px; letter-spacing: 0.5px; }
.font-size-toggle[data-level="large"]  { background: #FEF6E7; border-color: #FFB547; color: #92400E; }
.font-size-toggle[data-level="xlarge"] { background: #FEF1E7; border-color: #FF8C42; color: #9A3412; }

/* —— 标准档（整体上移一级：原较大档的字号） —— */
html[data-font-size="normal"] body { font-size: 19px; }
html[data-font-size="normal"] .topbar-title { font-size: 24px; }
html[data-font-size="normal"] .dash-card-title,
html[data-font-size="normal"] .modal-header h3 { font-size: 21px; }
html[data-font-size="normal"] .nav-label,
html[data-font-size="normal"] .ht-module-name,
html[data-font-size="normal"] .topbar-user-name,
html[data-font-size="normal"] .dash-list-title,
html[data-font-size="normal"] .gm-detail-name,
html[data-font-size="normal"] .gm-student-name { font-size: 18px; }
html[data-font-size="normal"] .tag,
html[data-font-size="normal"] .tag-dimension,
html[data-font-size="normal"] .gm-event-note,
html[data-font-size="normal"] .hq-section-title,
html[data-font-size="normal"] .gm-period-name,
html[data-font-size="normal"] button { font-size: 17px; }
html[data-font-size="normal"] .dash-list-meta,
html[data-font-size="normal"] .gm-event-meta,
html[data-font-size="normal"] .gm-event-time,
html[data-font-size="normal"] .gm-period-range,
html[data-font-size="normal"] .section-hint,
html[data-font-size="normal"] .hq-hint { font-size: 14px; }

/* —— 较大档（整体上移一级：原大字档的字号） —— */
html[data-font-size="large"] body { font-size: 23px; }
html[data-font-size="large"] .topbar-title { font-size: 29px; }
html[data-font-size="large"] .dash-card-title,
html[data-font-size="large"] .modal-header h3 { font-size: 25px; }
html[data-font-size="large"] .nav-label,
html[data-font-size="large"] .ht-module-name,
html[data-font-size="large"] .topbar-user-name,
html[data-font-size="large"] .dash-list-title,
html[data-font-size="large"] .gm-detail-name,
html[data-font-size="large"] .gm-student-name { font-size: 22px; }
html[data-font-size="large"] .tag,
html[data-font-size="large"] .tag-dimension,
html[data-font-size="large"] .gm-event-note,
html[data-font-size="large"] .hq-section-title,
html[data-font-size="large"] .gm-period-name,
html[data-font-size="large"] button { font-size: 20px; }
html[data-font-size="large"] .dash-list-meta,
html[data-font-size="large"] .gm-event-meta,
html[data-font-size="large"] .gm-event-time,
html[data-font-size="large"] .gm-period-range,
html[data-font-size="large"] .section-hint,
html[data-font-size="large"] .hq-hint { font-size: 17px; }

/* —— 大字档（整体上移一级：在原大字档基础上再约 1.2×） —— */
html[data-font-size="xlarge"] body { font-size: 27px; }
html[data-font-size="xlarge"] .topbar-title { font-size: 34px; }
html[data-font-size="xlarge"] .dash-card-title,
html[data-font-size="xlarge"] .modal-header h3 { font-size: 30px; }
html[data-font-size="xlarge"] .nav-label,
html[data-font-size="xlarge"] .ht-module-name,
html[data-font-size="xlarge"] .topbar-user-name,
html[data-font-size="xlarge"] .dash-list-title,
html[data-font-size="xlarge"] .gm-detail-name,
html[data-font-size="xlarge"] .gm-student-name { font-size: 26px; }
html[data-font-size="xlarge"] .tag,
html[data-font-size="xlarge"] .tag-dimension,
html[data-font-size="xlarge"] .gm-event-note,
html[data-font-size="xlarge"] .hq-section-title,
html[data-font-size="xlarge"] .gm-period-name,
html[data-font-size="xlarge"] button { font-size: 24px; }
html[data-font-size="xlarge"] .dash-list-meta,
html[data-font-size="xlarge"] .gm-event-meta,
html[data-font-size="xlarge"] .gm-event-time,
html[data-font-size="xlarge"] .gm-period-range,
html[data-font-size="xlarge"] .section-hint,
html[data-font-size="xlarge"] .hq-hint { font-size: 20px; }

/* 输入框、textarea 跟着放大 */
html[data-font-size="normal"] input,
html[data-font-size="normal"] textarea,
html[data-font-size="normal"] select { font-size: 18px; }
html[data-font-size="large"] input,
html[data-font-size="large"] textarea,
html[data-font-size="large"] select { font-size: 22px; }
html[data-font-size="xlarge"] input,
html[data-font-size="xlarge"] textarea,
html[data-font-size="xlarge"] select { font-size: 26px; }

/* ==================== 学生头像照片 ==================== */
/* 头像容器内的真实照片：撑满圆形容器并裁剪 */
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}
/* 图片加载失败时的回退：用 data-char 显示姓名首字 */
.avatar-fallback::after {
    content: attr(data-char);
}
