/* ==================== Animations ==================== */

/* ==================== 手机端栏目间距（页面级加大） ==================== */

@media (max-width: 767px) {
    /* 教师评估页：推送给老师/题目配置/评估记录等栏目卡片拉开间距 */
    #page-assessment > .card { margin-bottom: var(--space-xl); }
    #page-assessment > .card:last-child { margin-bottom: var(--space-md); }
    /* 家长端吸顶头部（孩子切换条 + 账号/退出行）与下方内容之间留白加大：
       基础 padding-bottom 仅 4px，内容几乎贴着头部（utilities 晚于 layout 加载，直接覆盖） */
    body.has-sidebar .header-slim { padding-bottom: var(--space-lg); }
}

@keyframes pop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes modalEnter {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.page.active .card {
    animation: cardEnter 0.35s ease backwards;
}

.page.active .card:nth-child(1) { animation-delay: 0.03s; }
.page.active .card:nth-child(2) { animation-delay: 0.06s; }
.page.active .card:nth-child(3) { animation-delay: 0.09s; }
.page.active .card:nth-child(4) { animation-delay: 0.12s; }
.page.active .card:nth-child(5) { animation-delay: 0.15s; }
.page.active .card:nth-child(6) { animation-delay: 0.18s; }
.page.active .card:nth-child(7) { animation-delay: 0.21s; }
.page.active .card:nth-child(8) { animation-delay: 0.24s; }

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== Skeleton ==================== */

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== Responsive ==================== */

@media (min-width: 480px) {
    .nav-label-short {
        display: none;
    }
    .nav-label-full {
        display: inline;
    }
}

/* ==================== Tablet (≥768px) ==================== */

@media (min-width: 768px) {
    .container {
        padding: var(--space-xl);
    }

    .header h1 {
        font-size: var(--text-2xl);
    }

    .card {
        padding: var(--space-xl);
        margin-bottom: var(--space-lg);
        border-radius: var(--radius-lg);
    }

    .chart-container {
        height: 280px;
    }

    .score-board {
        grid-template-columns: repeat(4, 1fr);
    }

    .quick-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==================== Desktop / Large tablet ==================== */

@media (min-width: 1024px) {
    body {
        padding-bottom: 24px;
    }

    body.has-sidebar .container {
        max-width: 1200px;
        margin-left: var(--sidebar-width);
        margin-right: auto;
        padding: var(--space-xl) var(--space-2xl);
    }

    .container {
        max-width: 1100px;
    }

    /* 桌面侧边导航 */
    .desktop-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-width);
        background: var(--surface);
        box-shadow: var(--shadow);
        z-index: 1000;
        padding: var(--space-lg) 0;
        overflow-y: auto;
    }

    .desktop-nav .nav-brand {
        padding: 0 var(--space-xl) var(--space-lg);
        font-size: var(--text-lg);
        font-weight: 800;
        color: var(--primary-dark);
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        border-bottom: 1px solid var(--border-light);
        margin-bottom: var(--space-md);
    }

    .desktop-nav .nav-item {
        flex: none;
        max-width: none;
        min-width: auto;
        flex-direction: row;
        justify-content: flex-start;
        padding: var(--space-md) var(--space-xl);
        margin: 2px var(--space-md);
        border-radius: var(--radius-md);
        font-size: var(--text-base);
        color: var(--text-secondary);
        gap: var(--space-md);
        height: auto;
    }

    .desktop-nav .nav-item::after {
        display: none;
    }

    .desktop-nav .nav-item:hover {
        background: var(--surface-muted);
        color: var(--primary);
    }

    .desktop-nav .nav-item.active {
        background: var(--primary-50);
        color: var(--primary);
        font-weight: 700;
    }

    .desktop-nav .nav-icon {
        font-size: 1.3em;
    }

    .bottom-nav {
        display: none;
    }

    .header {
        padding: var(--space-md) 0 var(--space-lg);
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .user-bar {
        justify-content: flex-end;
    }

    /* 页面双栏布局 */
    .page.active {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        gap: var(--space-xl);
        align-content: start;
    }

    .page > .strategy-card,
    .page > .quick-stats,
    .page > .stats-summary,
    .page > .score-board,
    .page > .points-hint {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }

    .page > .score-board {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .page > .card {
        margin-bottom: 0;
        /* 网格项目默认 min-width:auto 会被宽内容（如知识图谱多列）撑破屏幕 */
        min-width: 0;
    }

    .page > .card-full { grid-column: 1 / -1; }
    .page > .card-half { grid-column: span 6; }
    .page > .card-two-thirds { grid-column: span 8; }
    .page > .card-one-third { grid-column: span 4; }

    /* 照片墙卡片与「身高体重趋势」卡片等高：卡片随网格行拉伸，
       画廊填满剩余高度，照片多出时内部滚动 */
    .page > .card-photos {
        display: flex;
        flex-direction: column;
    }

    .page > .card-photos .photo-gallery {
        flex: 1;
        max-height: none;
    }

    /* 系统管理页：双栏卡片顶部对齐，用户列表表格化 */
    .page > .card-half.admin-card {
        align-self: start;
    }

    .admin-card .form-row,
    .admin-card .form-row-3 {
        gap: var(--space-sm);
    }

    .admin-card .user-list {
        gap: var(--space-sm);
    }

    .admin-card .user-item {
        display: grid;
        grid-template-columns: 72px 1fr auto;
        gap: var(--space-md);
        align-items: center;
        padding: var(--space-sm) var(--space-md);
        background: var(--bg);
        border-radius: var(--radius-md);
    }

    .admin-card .user-item-info {
        display: contents;
    }

    .admin-card .user-item-actions {
        display: flex;
        justify-content: flex-end;
    }

    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .trade-form {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==================== 宽屏容器扩展（≥1440px） ==================== */

@media (min-width: 1440px) {
    body .container {
        max-width: 1280px;
    }
    body.has-sidebar .container {
        max-width: 1200px;
        margin-left: var(--sidebar-width);
        margin-right: auto;
    }
}

/* ==================== 超大屏（≥1600px） ==================== */

@media (min-width: 1600px) {
    body .container {
        max-width: 1440px;
    }
    body.has-sidebar .container {
        max-width: min(1360px, calc(100vw - var(--sidebar-width) - 64px));
    }
}

/* ==================== Mobile: form grids stack to 1 column ==================== */

@media (max-width: 480px) {
    .form-row,
    .form-row-3,
    .trade-form,
    .next-year-goals {
        grid-template-columns: 1fr;
    }
}

/* ==================== Utility ==================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-light);
}

.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ==================== Routine Tasks ==================== */

.radio-group {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.radio-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-row {
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.task-routine-tag {
    display: inline-block;
    margin-left: var(--space-sm);
    padding: 1px var(--space-sm);
    border-radius: var(--radius-full);
    background: var(--info-light, #ebf8ff);
    color: var(--info, #3182ce);
    border: 1px solid var(--info, #3182ce);
    font-size: var(--text-xs);
    font-weight: 600;
    vertical-align: middle;
}

.routine-item:hover {
    transform: translateX(2px);
}

.routine-info h4 {
    margin: 0 0 var(--space-xs);
    font-size: var(--text-base);
    font-weight: 600;
}

/* ==================== 教师评估模块 ==================== */

/* 推送给老师：三个输入栏等宽等高，按钮独立一列靠右 */
.push-assessment-row {
    grid-template-columns: repeat(3, 1fr) auto;
    align-items: end;
}

.push-assessment-row .input-group {
    margin-bottom: 0;
}

.push-assessment-row .readonly-field,
.push-assessment-row input {
    height: 44px;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: var(--text-base);
}

.push-assessment-row .readonly-field {
    display: flex;
    align-items: center;
}

.btn-push {
    height: 44px;
    box-sizing: border-box;
    padding: 10px 16px;
    font-size: var(--text-base);
    white-space: nowrap;
}

@media (max-width: 767px) {
    .push-assessment-row {
        grid-template-columns: 1fr;
    }

    .push-assessment-row .input-group {
        margin-bottom: var(--space-md);
    }

    .push-assessment-row .push-btn-group {
        margin-bottom: 0;
    }

    .btn-push {
        width: 100%;
    }
}

.hint-text {
    margin-top: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--text-light);
}

.assessment-question-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.assessment-question-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-muted);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.assessment-question-item .question-main {
    flex: 1;
    min-width: 0;
}

.assessment-question-item .title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.assessment-question-item .title .max {
    font-weight: normal;
    color: var(--text-light);
    font-size: var(--text-sm);
}

.assessment-question-item .rubric {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 评分细则动态行 */
.rubric-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rubric-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rubric-score {
    flex-shrink: 0;
    width: 40px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color, #667eea);
    text-align: right;
}

.rubric-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    font-size: 0.9rem;
}

.assessment-question-item .question-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.teacher-assessment-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.teacher-assessment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-muted);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--warning);
}

.teacher-assessment-item.submitted {
    border-left-color: var(--success);
}

.teacher-assessment-item.expired {
    border-left-color: var(--text-muted);
}

.teacher-assessment-item .item-main {
    flex: 1;
    min-width: 0;
}

.teacher-assessment-item .title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.teacher-assessment-item .meta {
    font-size: var(--text-sm);
    color: var(--text-light);
}

.teacher-assessment-item .score {
    font-weight: 700;
    color: var(--primary);
    margin-left: var(--space-xs);
}

.teacher-assessment-item .item-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .assessment-question-item,
    .teacher-assessment-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .assessment-question-item .question-actions,
    .teacher-assessment-item .item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}


/* 任务素养分类徽章（任务列表 meta） */
.task-lit-domain {
    font-size: 11px; font-weight: 600; color: var(--primary-500);
    background: #eef2ff; border-radius: 10px; padding: 1px 8px;
}

/* ==================== 综合素养（雷达图 + 金字塔 + 目标 + 年度里程碑） ==================== */
.lt-charts-row {
    display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
    align-items: flex-start;
}
.lt-radar-wrap {
    max-width: 420px; flex: 1 1 320px; min-width: 280px;
}
#literacyRadar { width: 100%; height: 340px; }
.lt-pyramid-wrap {
    max-width: 420px; flex: 1 1 320px; min-width: 280px;
}
#literacyPyramid { width: 100%; height: 340px; }
.lt-radar-legend {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px;
}
.lt-legend-chip {
    padding: 3px 10px; border-radius: 12px; background: #f3f4f6;
    font-size: 12px; color: #4b5563;
}
.lt-legend-chip b { color: var(--primary-500); }

.lt-domain-chip {
    display: inline-block; white-space: nowrap;
    font-size: 12px; font-weight: 600; color: #4b5563;
    background: #f3f4f6; border-radius: 12px; padding: 2px 10px;
}

/* 目标总表（六域合并单表） */
.lt-table-wrap { overflow-x: auto; }
.lt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lt-table th {
    padding: 8px; text-align: left; font-weight: 700; font-size: 12px;
    color: var(--text-secondary, #6b7280); border-bottom: 2px solid var(--border, #e5e7eb);
    white-space: nowrap;
}
.lt-table td { padding: 8px; border-bottom: 1px solid var(--border, #e5e7eb); vertical-align: top; }
.lt-table tbody tr:hover { background: #f8fafc; }
.lt-td-progress { min-width: 120px; }
.lt-td-actions { white-space: nowrap; }
.lt-td-actions .btn-compact { margin: 1px 2px; }

/* 头部孩子选择器 */
.lt-head-child { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.lt-child-select {
    height: 32px; max-width: 140px; cursor: pointer;
    border: 1px solid #e5e7eb; border-radius: 8px; padding: 0 8px;
    font-size: 13px; color: #374151; background: #fff;
}
.lt-child-select:focus {
    outline: none; border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}

/* 维度设置弹窗（六域子项下拉） */
.lt-subs-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0; border-bottom: 1px dashed #f0f0f0;
}
.lt-subs-row:last-child { border-bottom: none; }
.lt-subs-domain {
    flex: 0 0 96px; font-size: 13px; font-weight: 700; color: #374151;
    padding-top: 6px;
}
.lt-subs-slots { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lt-subs-slot { display: inline-flex; align-items: center; gap: 2px; }
.lt-subs-slot select {
    height: 30px; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 0 6px; font-size: 12px; color: #374151; background: #fff; cursor: pointer;
}
.lt-subs-slot select:focus {
    outline: none; border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}
.lt-subs-del {
    border: none; background: none; color: #9ca3af; cursor: pointer;
    font-size: 12px; padding: 2px 4px; border-radius: 6px;
}
.lt-subs-del:hover { color: var(--danger, #e74c3c); background: #fef2f2; }
.lt-subs-add {
    height: 30px; padding: 0 10px; cursor: pointer;
    border: 1px dashed #c7d2fe; border-radius: 8px; background: transparent;
    color: var(--primary-500); font-size: 12px; font-weight: 600;
}
.lt-subs-add:hover { background: #eef2ff; }

/* AI 草稿编辑面板 */
.lt-draft-card {
    border: 1px solid #c7d2fe;
    background: linear-gradient(180deg, #f6f7ff 0%, #ffffff 60%);
}
.lt-draft-tip { font-size: 12px; color: #6b7280; margin: -6px 0 12px; }
.lt-draft-domain {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 10px 12px; margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.lt-draft-domain-head {
    display: flex; align-items: center; gap: 6px;
    font-weight: 700; font-size: 13px; color: #374151; margin-bottom: 8px;
}
.lt-draft-count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    color: var(--primary-500); background: #eef2ff;
    border-radius: 10px; padding: 1px 8px;
}
.lt-draft-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.lt-draft-no {
    flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
    background: #eef2ff; color: var(--primary-500);
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.lt-draft-row input {
    height: 34px; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 0 10px; font-size: 13px; background: #fafafa;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.lt-draft-row input:focus {
    outline: none; border-color: var(--primary-500); background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}
.lt-draft-row .lt-draft-title { flex: 0 0 220px; }
.lt-draft-row .lt-draft-target { flex: 1; min-width: 0; }
.lt-draft-del { flex-shrink: 0; }
.lt-draft-add {
    width: 100%; padding: 6px 0; cursor: pointer;
    border: 1px dashed #c7d2fe; border-radius: 8px; background: transparent;
    color: var(--primary-500); font-size: 12px; font-weight: 600;
    transition: background .15s;
}
.lt-draft-add:hover { background: #eef2ff; }
@media (max-width: 640px) {
    .lt-draft-row { flex-wrap: wrap; }
    .lt-draft-row .lt-draft-title { flex: 1 1 0; min-width: 0; }
    .lt-draft-row .lt-draft-target { flex: 1 1 100%; }
}

/* 年度里程碑（目标行手风琴） */
.lt-goal-title-cell { cursor: pointer; }
.lt-goal-title-cell:hover .lt-goal-title-line b { color: var(--primary-500); }
.lt-goal-title-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lt-ms-arrow {
    color: #9ca3af; font-size: 11px; transition: transform .2s;
    display: inline-block; flex-shrink: 0;
}
.lt-goal-row.open .lt-ms-arrow { transform: rotate(90deg); }
.lt-ms-badge {
    font-size: 11px; font-weight: 600; color: var(--primary-500);
    background: #eef2ff; border-radius: 10px; padding: 1px 8px; white-space: nowrap;
}
.lt-ms-badge-empty { color: #9ca3af; background: #f3f4f6; }
.lt-ms-detail > td {
    background: #f8f9ff; border-bottom: 1px solid var(--border, #e5e7eb);
    padding: 8px 8px 10px 34px;
}
.lt-table tbody tr.lt-ms-detail:hover { background: #f8f9ff; }
.lt-ms-list { margin-top: 2px; }
.lt-ms {
    display: flex; gap: 8px; align-items: center;
    padding: 4px 0; font-size: 13px;
    border-bottom: 1px dashed #f0f0f0;
}
.lt-ms:last-child { border-bottom: none; }
.lt-ms-year {
    flex-shrink: 0; color: var(--primary-500); font-size: 12px;
    background: #eef2ff; border-radius: 8px; padding: 1px 8px;
}
.lt-ms-title { flex: 1; }
.lt-ms.done .lt-ms-title { text-decoration: line-through; color: #9ca3af; }
.lt-ms .btn-compact { flex-shrink: 0; }

/* 里程碑行内编辑 */
.lt-ms.lt-ms-editing {
    background: #fff; border-radius: 8px; padding: 6px 8px;
    border-bottom: 1px dashed #f0f0f0;
}
.lt-ms-editing select, .lt-ms-editing input[type="text"] {
    height: 30px; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 0 8px; font-size: 12px; background: #fff;
}
.lt-ms-editing input[type="text"] { flex: 1; min-width: 0; }
.lt-ms-editing select:focus, .lt-ms-editing input[type="text"]:focus {
    outline: none; border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}

/* 目标行（总表单元格内） */
.lt-goal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lt-goal-pct { font-weight: 700; color: var(--primary-500); }
.lt-progress {
    height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; margin: 6px 0;
}
.lt-progress i {
    display: block; height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--secondary));
    transition: width .3s;
}
.lt-goal-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }

/* 手机端：目标总表由表格改为卡片式堆叠（DOM 不变，仅重排） */
@media (max-width: 768px) {
    /* 素养雷达卡片头部（标题 + 孩子选择 + 两个按钮）允许换行 */
    #page-finance .card-title.nowrap { flex-wrap: wrap; }
    .lt-table thead { display: none; }
    .lt-table, .lt-table tbody, .lt-table tr, .lt-table td {
        display: block; width: 100%; box-sizing: border-box;
    }
    .lt-table tbody tr.lt-goal-row {
        padding: 10px 10px 8px;
        border-bottom: 1px solid var(--border, #e5e7eb);
    }
    .lt-goal-row > td { border-bottom: none; padding: 3px 0; }
    .lt-td-progress { min-width: 0; }
    .lt-td-actions {
        white-space: normal; display: flex; flex-wrap: wrap; gap: 6px;
    }
    .lt-td-actions .btn-compact { margin: 0; flex: 1 1 auto; }
    /* 展开的周度/年度任务详情：缩小缩进，任务行允许换行 */
    .lt-ms-detail > td { padding: 8px 10px 10px 24px; }
    .lt-ms { flex-wrap: wrap; gap: 6px; }
    .lt-ms-title { flex: 1 1 55%; min-width: 0; }
    /* 里程碑行内编辑：标题输入框独占一行，按钮换行 */
    .lt-ms-editing { flex-wrap: wrap; }
    .lt-ms-editing input[type="text"] { flex: 1 1 100%; order: -1; }
}


