/* ===== 智慧作业管家 - 校园风格设计 ===== */

/* ===== 变量 ===== */
:root {
    --c-primary: #2563eb;
    --c-primary-light: #eff6ff;
    --c-primary-dark: #1d4ed8;
    --c-secondary: #10b981;
    --c-secondary-light: #ecfdf5;
    --c-danger: #ef4444;
    --c-danger-light: #fef2f2;
    --c-warning: #f59e0b;
    --c-warning-light: #fffbeb;
    --c-success: #10b981;
    --c-success-light: #ecfdf5;
    --c-info: #3b82f6;
    --c-info-light: #eff6ff;
    --c-bg: #f8fafc;
    --c-card: #ffffff;
    --c-border: #e2e8f0;
    --c-border-light: #f1f5f9;
    --c-text: #0f172a;
    --c-text-secondary: #475569;
    --c-text-muted: #94a3b8;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease-in-out;
    --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
}

/* ===== 重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--c-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--c-primary-dark);
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

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

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

/* 页面进入动画 */
.main-content {
    animation: pageEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 卡片和元素的交错动画 */
.card, .stat-card, .chart-container, .item-card {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }

/* 侧边栏链接hover平滑过渡 */
.sidebar nav a {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 按钮点击反馈 */
.btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: scale(0.96);
}

/* 表格行hover效果 */
table tbody tr {
    transition: background-color 0.2s ease;
}

/* 模态框动画增强 */
.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

.modal {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 页面切换时的加载指示器 */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
    z-index: 10000;
    animation: loadingBar 0.8s ease forwards;
}

@keyframes loadingBar {
    0% { width: 0; }
    50% { width: 70%; }
    100% { width: 100%; opacity: 0; }
}

/* ===== 应用容器 ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 240px;
    background: var(--c-card);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.logo-area {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--c-border);
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.3;
}

.logo-sub {
    font-size: 11px;
    color: var(--c-text-muted);
    margin-top: 2px;
}

.sidebar nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-label {
    font-size: 12px;
    color: var(--c-text-muted);
    padding: 8px 12px;
    margin-bottom: 4px;
    font-weight: 500;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--c-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    margin-bottom: 4px;
}

.sidebar nav a:hover {
    background: var(--c-bg);
    color: var(--c-primary);
}

.sidebar nav a.active {
    background: var(--c-primary-light);
    color: var(--c-primary);
    font-weight: 500;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--c-border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--c-primary-light);
    color: var(--c-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
}

.user-role {
    font-size: 12px;
    color: var(--c-text-muted);
}

.logout-btn {
    font-size: 13px;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.logout-btn:hover {
    color: var(--c-danger);
    background: var(--c-danger-light);
}

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    background: var(--c-bg);
    min-height: 100vh;
}

/* ===== 页面头部 ===== */
.page-header {
    margin-bottom: 28px;
    animation: fadeIn 0.4s ease;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 6px;
}

.page-header p {
    font-size: 14px;
    color: var(--c-text-muted);
}

/* ===== 欢迎横幅 ===== */
.welcome-banner {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    color: white;
    margin-bottom: 28px;
    animation: fadeIn 0.4s ease;
}

.welcome-banner h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-banner p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.8;
}

/* ===== 数据卡片网格 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--c-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeIn 0.4s ease;
}

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

.stat-icon {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--c-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--c-text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--c-text);
}

/* ===== 卡片 ===== */
.card {
    background: var(--c-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
    animation: fadeIn 0.4s ease;
    padding: 28px;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
}

.card-body {
    padding: 24px;
}

/* ===== 列表项 ===== */
.item-card {
    padding: 20px 24px;
    border-bottom: 1px solid var(--c-border);
    transition: var(--transition);
    border-left: 4px solid var(--c-primary);
    background: var(--c-card);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.item-card:last-child {
    border-bottom: none;
}

.item-card:hover {
    box-shadow: var(--shadow-md);
}

.item-card.mastered {
    border-left-color: var(--c-success);
    opacity: 0.8;
}

/* ===== 标签 ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: var(--c-primary-light);
    color: var(--c-primary);
}

.badge-success {
    background: var(--c-success-light);
    color: var(--c-success);
}

.badge-warning {
    background: var(--c-warning-light);
    color: var(--c-warning);
}

.badge-danger {
    background: var(--c-danger-light);
    color: var(--c-danger);
}

.badge-info {
    background: var(--c-info-light);
    color: var(--c-info);
}

.badge-gray {
    background: var(--c-border-light);
    color: var(--c-text-secondary);
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--c-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--c-primary-dark);
    box-shadow: 0 4px 12px rgba(74,144,226,0.3);
}

.btn-secondary {
    background: var(--c-bg);
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
}

.btn-secondary:hover {
    background: var(--c-border);
}

.btn-success {
    background: var(--c-success);
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: var(--c-danger);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: var(--c-warning);
    color: white;
}

.btn-warning:hover {
    background: #d68910;
}

.btn-outline {
    background: var(--c-card);
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
}

.btn-outline:hover {
    background: var(--c-bg);
    border-color: var(--c-text-muted);
}

.btn-ghost {
    background: transparent;
    color: var(--c-text-secondary);
}

.btn-ghost:hover {
    background: var(--c-bg);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--c-text);
    background: var(--c-card);
    transition: var(--transition);
    font-family: var(--font-family);
    outline: none;
}

.form-control:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(74,144,226,0.1);
}

.form-control::placeholder {
    color: var(--c-text-muted);
}

select.form-control {
    appearance: auto;
    cursor: pointer;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
    line-height: 1.6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== 选项卡 ===== */
.tabs {
    display: flex;
    background: var(--c-bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--c-card);
    color: var(--c-primary);
    box-shadow: var(--shadow);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ===== 学生端选项卡 ===== */
.student-tabs {
    display: flex;
    gap: 8px;
    background: var(--c-bg);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 32px;
    border: 1px solid var(--c-border-light);
}

.student-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.student-tab:hover {
    color: var(--c-text-secondary);
}

.student-tab.active {
    background: var(--c-card);
    color: var(--c-primary);
    box-shadow: var(--shadow-sm);
}

/* ===== 空状态 ===== */
.empty-state {
    padding: 48px 24px;
    text-align: center;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--c-text-muted);
    font-size: 14px;
}

/* ===== 加载状态 ===== */
.loading-state {
    padding: 32px;
    text-align: center;
}

.loading-state p {
    color: var(--c-text-muted);
    font-size: 14px;
}

.loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    background: var(--c-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid var(--c-success);
}

.toast.error {
    border-left-color: var(--c-danger);
}

.toast.info {
    border-left-color: var(--c-primary);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== 进度条 ===== */
.progress {
    height: 8px;
    background: var(--c-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--c-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===== 图表容器 ===== */
.chart-container {
    background: var(--c-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--c-border);
    padding: 24px;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease;
}

.chart-container h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--c-text);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--c-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    animation: scaleIn 0.25s ease;
}

.modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--c-border-light);
}

/* ===== 智能报告 ===== */
.ai-report {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    line-height: 1.7;
    font-size: 14px;
    color: var(--c-text);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ai-report::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--c-primary);
}

.ai-report-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--c-primary);
    font-size: 18px;
}

/* ===== 排行榜 ===== */
.ranking-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--c-border-light);
    transition: background var(--transition);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: var(--c-bg);
}

.rank-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 16px;
    font-size: 14px;
}

.rank-1 {
    background: linear-gradient(135deg, #FBBF24, #F59E0B);
    color: white;
}

.rank-2 {
    background: linear-gradient(135deg, #D1D5DB, #9CA3AF);
    color: white;
}

.rank-3 {
    background: linear-gradient(135deg, #FCD34D, #D97706);
    color: white;
}

.rank-other {
    background: var(--c-border-light);
    color: var(--c-text-muted);
}

/* ===== 知识点掌握度 ===== */
.knowledge-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--c-border-light);
}

.knowledge-item:last-child {
    border-bottom: none;
}

.knowledge-name {
    width: 120px;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.knowledge-bar {
    flex: 1;
    height: 8px;
    background: var(--c-border-light);
    border-radius: 4px;
    margin: 0 16px;
    overflow: hidden;
}

.knowledge-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.knowledge-percent {
    width: 50px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
}

/* ===== 评论 ===== */
.comment-item {
    background: var(--c-bg);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 10px;
}

/* ===== 个人资料卡片 ===== */
.profile-card {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

.profile-card .profile-name {
    font-size: 20px;
    font-weight: 600;
}

.profile-card .profile-level {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 4px;
}

.profile-stats {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

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

.profile-stat-value {
    font-size: 24px;
    font-weight: 600;
}

.profile-stat-label {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

/* ===== 小组卡片 ===== */
.group-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.group-card {
    background: var(--c-card);
    border-radius: var(--radius);
    border: 1px solid var(--c-border-light);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.group-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--c-primary);
}

.group-card .group-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--c-primary-light);
    color: var(--c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    margin: 0 auto 14px;
}

.group-card h5 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.group-card p {
    font-size: 13px;
    color: var(--c-text-muted);
}

/* ===== 徽章网格 ===== */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.badge-item {
    text-align: center;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
}

.badge-item:hover {
    transform: scale(1.05);
}

.badge-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 12px;
    font-weight: 600;
}

.badge-icon-circle.earned {
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(74,144,226,0.3);
}

.badge-icon-circle.locked {
    background: var(--c-border-light);
    color: var(--c-text-muted);
}

/* ===== 主题选择 ===== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.theme-card {
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    border-radius: var(--radius);
    overflow: hidden;
}

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

.theme-card.active {
    border-color: var(--c-primary);
}

.theme-preview {
    height: 80px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.theme-default {
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
}

.theme-ocean {
    background: linear-gradient(135deg, #0EA5E9, #06B6D4);
}

.theme-forest {
    background: linear-gradient(135deg, #22C55E, #10B981);
}

.theme-sunset {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
}

/* ===== 计划卡片 ===== */
.plan-card {
    background: var(--c-card);
    border-radius: var(--radius);
    border: 1px solid var(--c-border-light);
    padding: 20px;
    margin-bottom: 12px;
    border-left: 4px solid var(--c-primary);
    transition: all var(--transition);
}

.plan-card:hover {
    box-shadow: var(--shadow);
}

.plan-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: var(--c-warning-light);
    color: var(--c-warning);
}

.status-in_progress {
    background: var(--c-info-light);
    color: var(--c-info);
}

.status-completed {
    background: var(--c-success-light);
    color: var(--c-success);
}

/* ===== 表格 ===== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    background: var(--c-bg);
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-secondary);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}

table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--c-border-light);
    font-size: 14px;
    vertical-align: middle;
}

table tbody tr:hover {
    background: var(--c-bg);
}

table tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .group-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 64px;
    }
    .sidebar .logo-text,
    .sidebar .logo-sub,
    .sidebar nav a span:not(.nav-icon),
    .sidebar .nav-label,
    .sidebar .user-name,
    .sidebar .user-role,
    .sidebar .logout-btn {
        display: none;
    }
    .sidebar .logo-area {
        justify-content: center;
        padding: 16px 8px;
    }
    .sidebar nav a {
        justify-content: center;
        padding: 12px;
    }
    .sidebar .nav-icon {
        font-size: 18px;
    }
    .main-content {
        margin-left: 64px;
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .group-grid {
        grid-template-columns: 1fr;
    }
    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .profile-stats {
        gap: 20px;
    }
}

/* ===== 暗色主题 ===== */
body.dark-theme {
    --c-bg: #1A1A2E;
    --c-card: #16213E;
    --c-text: #E0E0E0;
    --c-text-secondary: #B0B0B0;
    --c-text-muted: #808080;
    --c-border: #2A2A4A;
    --c-border-light: #1E2A4A;
    --c-primary-light: #2A3A5A;
    --c-success-light: #1A3A2A;
    --c-warning-light: #3A3A1A;
    --c-danger-light: #3A1A1A;
    --c-info-light: #1A2A3A;
    background: var(--c-bg);
    color: var(--c-text);
}

body.dark-theme .sidebar {
    background: #16213E;
    border-color: #2A2A4A;
}

body.dark-theme .modal {
    background: #16213E;
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background: #1A1A2E;
    border-color: #2A2A4A;
    color: var(--c-text);
}

body.dark-theme .toast {
    background: #16213E;
}

body.dark-theme table thead th {
    background: #1A1A2E;
}

body.dark-theme .ranking-item:hover,
body.dark-theme table tbody tr:hover {
    background: #1A1A2E;
}

/* ===== 海洋主题 ===== */
body.ocean-theme {
    --c-primary: #0984E3;
    --c-primary-dark: #0773C5;
    --c-bg: #E8F4FC;
}

/* ===== 森林主题 ===== */
body.forest-theme {
    --c-primary: #00B894;
    --c-primary-dark: #00A381;
    --c-bg: #E8F8F5;
}

/* ===== 日落主题 ===== */
body.sunset-theme {
    --c-primary: #F59E0B;
    --c-primary-dark: #D97706;
    --c-bg: #FEF5E7;
}

/* ===== Apple-like responsive refresh ===== */
:root {
    --c-primary: #007aff;
    --c-primary-light: #eef6ff;
    --c-primary-dark: #005ecb;
    --c-secondary: #34c759;
    --c-bg: #f5f5f7;
    --c-card: rgba(255,255,255,0.82);
    --c-border: rgba(15,23,42,0.10);
    --c-border-light: rgba(15,23,42,0.06);
    --c-text: #1d1d1f;
    --c-text-secondary: #515154;
    --c-text-muted: #86868b;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --shadow: 0 12px 34px rgba(0,0,0,0.06);
    --shadow-md: 0 18px 44px rgba(0,0,0,0.09);
    --shadow-lg: 0 28px 70px rgba(0,0,0,0.14);
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
    background:
        radial-gradient(circle at 8% 0%, rgba(0,122,255,0.10), transparent 28%),
        linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 45%, #f2f4f8 100%);
    letter-spacing: 0;
}

.sidebar {
    width: 252px;
    background: rgba(255,255,255,0.74);
    border-right: 1px solid rgba(15,23,42,0.08);
    backdrop-filter: blur(24px);
}

.logo-area,
.sidebar-footer {
    border-color: rgba(15,23,42,0.06);
}

.sidebar nav a {
    border-radius: 12px;
    padding: 11px 14px;
}

.sidebar nav a:hover {
    background: rgba(0,122,255,0.07);
}

.sidebar nav a.active {
    background: rgba(0,122,255,0.12);
    color: #0066d6;
}

.main-content {
    margin-left: 252px;
    width: calc(100% - 252px);
    min-width: 0;
    padding: 34px;
    background: transparent;
}

.page-header h1 {
    font-size: 30px;
    font-weight: 760;
    letter-spacing: 0;
}

.page-header p {
    color: var(--c-text-secondary);
}

.welcome-banner {
    background: linear-gradient(135deg, #007aff 0%, #5ac8fa 100%);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0,122,255,0.18);
}

.card,
.stat-card,
.chart-container,
.item-card,
.modal,
.profile-card,
.group-card,
.plan-card,
.data-card,
.preference-card {
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.card,
.chart-container {
    border-radius: 20px;
}

.stat-card {
    border-radius: 18px;
}

.btn {
    border-radius: 999px;
    min-height: 38px;
    font-weight: 650;
}

.btn-primary {
    background: #007aff;
}

.btn-primary:hover {
    background: #0066d6;
    box-shadow: 0 12px 24px rgba(0,122,255,0.22);
}

.btn-outline,
.btn-secondary {
    background: rgba(255,255,255,0.72);
}

.form-control,
.search-bar input,
.pagination button {
    border-radius: 12px;
    background: rgba(255,255,255,0.86);
}

table thead th {
    background: rgba(245,245,247,0.86);
}

table tbody tr:hover {
    background: rgba(0,122,255,0.045);
}

.badge {
    border-radius: 999px;
}

.toast {
    border-radius: 14px;
    border-left: 0;
    border: 1px solid rgba(15,23,42,0.08);
    backdrop-filter: blur(18px);
}

@media (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }
    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 72px;
    }
    .main-content {
        margin-left: 72px;
        width: calc(100% - 72px);
        padding: 18px;
    }
    .page-header > div[style*="justify-content"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 14px;
    }
    .page-header > div[style*="justify-content"] > div:last-child {
        width: 100%;
        flex-wrap: wrap;
    }
    .page-header > div[style*="justify-content"] > div:last-child .btn {
        flex: 1;
        min-width: 130px;
    }
    .page-header h1 {
        font-size: 24px;
    }
    .welcome-banner {
        padding: 22px;
    }
    .stats-grid,
    .stats-row {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }
    .card,
    .chart-container {
        padding: 20px;
        border-radius: 16px;
    }
    .card-header {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }
    .card-header .search-bar {
        max-width: none !important;
        width: 100%;
        margin-left: 0 !important;
    }
    .table-wrapper {
        margin: 0 -6px;
    }
    table thead th,
    table tbody td {
        padding: 12px 10px;
        font-size: 12px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .modal {
        width: calc(100% - 28px);
        padding: 22px;
    }
    .modal-actions {
        flex-direction: column-reverse;
    }
    .modal-actions .btn {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .main-content {
        padding: 14px 12px;
    }
    .page-header {
        margin-bottom: 18px;
    }
    .student-table th:nth-child(3),
    .student-table td:nth-child(3),
    .student-table th:nth-child(4),
    .student-table td:nth-child(4),
    .student-table th:nth-child(5),
    .student-table td:nth-child(5) {
        display: none;
    }
    .student-table th:nth-child(2),
    .student-table td:nth-child(2) {
        max-width: 96px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .student-table .student-avatar {
        display: none;
    }
    .student-table .student-name {
        display: inline-block;
        max-width: 76px;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }
    .action-btns,
    .table-actions,
    .seed-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .action-btns .btn,
    .table-actions .btn {
        width: 100%;
    }
}

/* ===== 学习偏好卡片 ===== */
.preference-card {
    background: var(--c-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--c-border-light);
}

.preference-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--c-text);
}

.preference-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preference-option {
    padding: 10px 18px;
    border: 2px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-card);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

.preference-option:hover {
    border-color: var(--c-primary);
    background: var(--c-primary-light);
}

.preference-option.active {
    border-color: var(--c-primary);
    background: var(--c-primary);
    color: white;
}

/* ===== 数据管理卡片 ===== */
.data-card {
    background: var(--c-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    gap: 20px;
}

.data-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.data-card-content {
    flex: 1;
}

.data-card-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.data-card-content p {
    font-size: 13px;
    color: var(--c-text-muted);
}

/* ===== 滑块 ===== */
.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--c-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 12px 0;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.range-value {
    display: inline-block;
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--c-primary);
}
