/* ==========================================================================
   app.css — 材料科学基础 - 云端同步网页版
   由原 index.html 内联 <style> 原样外置（规则、选择器、数值完全未改动）。
   外置后浏览器可缓存本文件，二次访问不再重复解析样式，首屏更快。
   ========================================================================== */

:root {
  --primary-color: #1a237e;
  --primary-gradient: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
  --bg-color: #f0f2f5;
  --text-color: #333;
  --card-bg: #ffffff;
  --nav-height-top: 70px;
  --nav-height-bottom: 50px;
  --nav-bg-color: #0d47a1;
}

[data-theme="eye-care"] {
  --primary-color: #2e7d32;
  --primary-gradient: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  --bg-color: #f1f8e9;
  --text-color: #333;
  --card-bg: #ffffff;
  --nav-bg-color: #1b5e20;
}

[data-theme="gray"] {
  --primary-color: #424242;
  --primary-gradient: linear-gradient(135deg, #424242 0%, #212121 100%);
  --bg-color: #eeeeee;
  --text-color: #212121;
  --card-bg: #fafafa;
  --nav-bg-color: #212121;
}

/* 新增：建大红色主题 */
[data-theme="red"] {
  --primary-color: #a3202b;
  --primary-gradient: linear-gradient(135deg, #a3202b 0%, #701219 100%);
  --bg-color: #fdf4f4;
  --text-color: #333;
  --card-bg: #ffffff;
  --nav-bg-color: #7d1720;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: var(--bg-color); color: var(--text-color); line-height: 1.6; transition: background 0.3s; }

#loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255,255,255,0.9); z-index: 10000;
  display: none; flex-direction: column; justify-content: center; align-items: center;
  transition: opacity 0.3s;
}
#loading-overlay.show { display: flex; }
.spinner {
  width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-color);
  border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.sync-status {
  position: fixed; top: 0; left: 0; width: 100%;
  background: #4caf50; color: white; text-align: center;
  padding: 5px; font-size: 12px; z-index: 10001;
  transform: translateY(-100%); transition: transform 0.3s;
}
.sync-status.visible { transform: translateY(0); }
.sync-status.error { background: #f44336; }
.sync-status.saving { background: #ff9800; }

#auth-view { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #1a237e; display: flex; justify-content: center; align-items: center; z-index: 9999; transition: opacity 0.5s; }
.auth-container {
  background: white; padding: 40px; border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  width: 100%; max-width: 550px;
  text-align: center; position: relative; overflow: hidden;
}
.auth-header h2 {
  color: var(--primary-color); margin-bottom: 10px; font-size: 22px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auth-header p { color: #666; margin-bottom: 30px; font-size: 14px; }

.auth-tabs { display: flex; margin-bottom: 25px; border-bottom: 2px solid #eee; }
.auth-tab { flex: 1; padding: 10px; cursor: pointer; font-weight: bold; color: #999; transition: all 0.3s; }
.auth-tab.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); margin-bottom: -2px; }

.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; margin-bottom: 6px; color: #555; font-size: 13px; font-weight: 500; }
.input-group input, .input-group select { width: 100%; padding: 10px 15px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.3s; }
.input-group input:focus, .input-group select:focus { border-color: var(--primary-color); }

.auth-btn { width: 100%; padding: 12px; background: var(--primary-gradient); color: white; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; margin-top: 10px; }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.error-msg { color: #e91e63; font-size: 13px; margin-top: 10px; display: none; }

.demo-hint { margin-top: 20px; font-size: 12px; color: #666; background: #f5f5f5; padding: 10px; border-radius: 6px; text-align: left; line-height: 1.8;}

/* 新增：登录表单的“记住信息 / 同意协议”勾选项 */
.auth-options { margin-top: 4px; text-align: left; }
.checkbox-line { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: #555; cursor: pointer; margin-bottom: 8px; }
.checkbox-line input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--primary-color); cursor: pointer; flex: none; }
.checkbox-line a { color: var(--primary-color); text-decoration: underline; }

/* 新增：用户协议与隐私政策正文 */
.terms-body { max-height: 50vh; overflow-y: auto; font-size: 13px; color: #555; line-height: 1.9; text-align: left; border: 1px solid #eee; border-radius: 8px; padding: 15px; background: #fafafa; }
.terms-body h4 { color: var(--primary-color); font-size: 14px; margin: 12px 0 4px; }
.terms-body h4:first-child { margin-top: 0; }

#course-view { display: none; }

.navbar {
  background: var(--nav-bg-color);
  padding: 0 40px; position: fixed; width: 100%; top: 0; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.3); transition: background 0.3s;
}
.nav-top {
  max-width: 1200px; margin: 0 auto; display: flex;
  justify-content: space-between; align-items: center; height: var(--nav-height-top);
}
.nav-bottom {
  max-width: 1200px; margin: 0 auto; display: flex;
  justify-content: center; align-items: center; height: var(--nav-height-bottom);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.nav-logo { color: white; font-size: 28px; font-weight: bold; white-space: nowrap; flex-shrink: 0; }
.nav-logo span { color: #64b5f6; font-size: 24px; }
.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 18px; padding: 6px 16px; border-radius: 20px; transition: all 0.3s; white-space: nowrap; }
.nav-links a:hover { color: white; background: rgba(255,255,255,0.15); }
.user-info { color: white; font-size: 13px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; }
.role-badge { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.logout-btn, .settings-btn { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 4px 12px; border-radius: 15px; cursor: pointer; font-size: 12px; margin-left: 5px; }
.logout-btn:hover, .settings-btn:hover { background: rgba(255,255,255,0.3); }

.export-btn, .sync-btn, .stats-btn {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: white;
  padding: 4px 12px; border-radius: 15px; cursor: pointer; font-size: 12px;
  display: none; margin-left: 5px;
}
.export-btn:hover, .sync-btn:hover, .stats-btn:hover { background: rgba(255,255,255,0.3); }
.sync-btn { background: rgba(33, 150, 243, 0.8); }
.stats-btn { background: rgba(156, 39, 176, 0.8); }
.export-btn { background: rgba(76, 175, 80, 0.8); }

.hero {
  margin-top: calc(var(--nav-height-top) + var(--nav-height-bottom));
  background: var(--nav-bg-color);
  padding: 80px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}
.hero::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(circle at 30% 40%, rgba(0, 150, 255, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(0, 220, 255, 0.15) 0%, transparent 40%);
  animation: pulseGlow 8s ease-in-out infinite;
  z-index: 0;
}
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* 新增：Hero内容包装器，用于添加羽化背景框 */
.hero-content-wrapper {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 40px 60px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.85); /* 半透明白色填充 */
  box-shadow: 0 0 60px 20px rgba(255, 255, 255, 0.6); /* 宽大的羽化过渡效果 */
  backdrop-filter: blur(5px); /* 轻微模糊背景，增强文字对比度 */
  max-width: 90%;
}

.hero h1 { color: var(--primary-color); font-size: 42px; margin-bottom: 15px; text-shadow: none; }
.hero p { color: #333; font-size: 18px; max-width: 600px; margin: 0 auto; }
.hero-tags { margin-top: 25px; display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }
.hero-tag {
  background: rgba(26, 35, 126, 0.1); color: var(--primary-color); padding: 6px 18px; border-radius: 20px; font-size: 14px;
  border: 1px solid rgba(26, 35, 126, 0.2); cursor: default; transition: all 0.3s;
}
.teacher-mode .hero-tag.editable { cursor: pointer; background: rgba(26, 35, 126, 0.15); border-color: #ff9800; }
.teacher-mode .hero-tag.editable:hover { background: rgba(26, 35, 126, 0.25); }
.add-hero-tag-btn {
  background: transparent; border: 1px dashed var(--primary-color); color: var(--primary-color);
  padding: 6px 18px; border-radius: 20px; font-size: 14px; cursor: pointer; transition: all 0.3s;
}
.add-hero-tag-btn:hover { background: rgba(26, 35, 126, 0.1); }

/* 新增：更换背景按钮样式 - 调整为深色背景以适应白色框内或保持独立 */
.change-hero-bg-btn {
  margin-top: 20px;
  background: var(--primary-color);
  border: none;
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.change-hero-bg-btn:hover {
  background: #0d47a1;
  transform: translateY(-2px);
}

.view-count {
  margin-top: 15px; color: #666; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

.main-content { max-width: 1200px; margin: 0 auto; padding: 40px 20px; }
.section { margin-bottom: 50px; }
.section-title { font-size: 28px; color: var(--primary-color); margin-bottom: 30px; padding-left: 15px; border-left: 4px solid var(--primary-color); display: flex; align-items: center; gap: 10px; }

.teacher-card { background: var(--card-bg); border-radius: 16px; padding: 40px; display: flex; gap: 40px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); position: relative; margin-bottom: 20px; transition: background 0.3s; }
.teacher-avatar-wrapper {
  width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0; position: relative;
  background: var(--primary-gradient); display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: default;
}
.teacher-avatar-img { width: 100%; height: 100%; object-fit: cover; display: none; }
.teacher-avatar-text { color: white; font-size: 50px; font-weight: bold; }

.teacher-mode .teacher-avatar-wrapper.uploadable { cursor: pointer; border: 3px dashed transparent; transition: all 0.3s; }
.teacher-mode .teacher-avatar-wrapper.uploadable:hover { border-color: #ff9800; opacity: 0.9; }
.teacher-mode .teacher-avatar-wrapper.uploadable::after {
  content: '📷 更换'; position: absolute; bottom: 0; left: 0; width: 100%;
  background: rgba(0,0,0,0.6); color: white; font-size: 12px; text-align: center;
  padding: 4px 0; opacity: 0; transition: opacity 0.3s;
}
.teacher-mode .teacher-avatar-wrapper.uploadable:hover::after { opacity: 1; }

.teacher-info { flex: 1; }
.teacher-info h3 { font-size: 24px; color: var(--primary-color); margin-bottom: 5px; }
.teacher-info .title { color: #666; font-size: 15px; margin-bottom: 15px; }
.teacher-info .bio { color: #555; font-size: 15px; line-height: 1.8; margin-bottom: 20px; }
.teacher-tags { display: flex; gap: 10px; flex-wrap: wrap; }
.teacher-tag { background: #e8eaf6; color: var(--primary-color); padding: 5px 14px; border-radius: 15px; font-size: 13px; }

.add-teacher-btn {
  background: var(--card-bg); border: 2px dashed var(--primary-color); border-radius: 16px; padding: 40px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--primary-color); font-size: 18px; cursor: pointer; transition: all 0.3s; margin-bottom: 20px;
}
.add-teacher-btn:hover { background: #e8eaf6; }

.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 5000; display: none;
  justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: white; border-radius: 16px; padding: 35px; width: 100%; max-width: 520px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-box h3 { color: var(--primary-color); margin-bottom: 20px; font-size: 20px; }
.modal-box label { display: block; font-size: 13px; color: #666; margin-bottom: 5px; margin-top: 12px; }
.modal-box input, .modal-box textarea, .modal-box select {
  width: 100%; padding: 10px; border: 2px solid #e0e0e0; border-radius: 8px;
  font-family: inherit; font-size: 14px; outline: none; transition: border-color 0.3s;
}
.modal-box input:focus, .modal-box textarea:focus { border-color: var(--primary-color); }
.modal-box textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; gap: 10px; margin-top: 25px; justify-content: flex-end; }
.modal-actions button { padding: 10px 24px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }

.edit-btn {
  position: absolute; top: 20px; right: 20px;
  background: #ff9800; color: white; border: none;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; gap: 5px; z-index: 2;
}
.edit-btn:hover { background: #f57c00; }

.del-teacher-btn {
  position: absolute; top: 20px; right: 110px;
  background: #f44336; color: white; border: none;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font-size: 12px; z-index: 2;
}
.del-teacher-btn:hover { background: #d32f2f; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; }
.course-item {
  background: var(--card-bg); border-radius: 12px; padding: 25px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border-left: 4px solid var(--primary-color); position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  padding-right: 25px;
  padding-bottom: 80px;
}
.course-item.dragging { opacity: 0.5; border: 2px dashed var(--primary-color); }
.course-item.drag-over { transform: scale(1.02); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

.drag-handle {
  position: absolute; top: 15px; right: 15px; left: auto; cursor: grab; color: #999; font-size: 18px;
  padding: 5px; display: none; z-index: 10;
}
.drag-handle:active { cursor: grabbing; }
.teacher-mode .drag-handle { display: block; }

/* 教师卡片拖拽按钮 */
.drag-handle-teacher {
  position: absolute; bottom: 20px; right: 20px; cursor: grab; color: #999; font-size: 16px;
  padding: 5px; display: none; z-index: 10; background: rgba(255,255,255,0.8); border-radius: 4px;
}
.drag-handle-teacher:active { cursor: grabbing; }
.teacher-mode .drag-handle-teacher { display: block; }

.course-item-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.course-number { width: 36px; height: 36px; background: var(--primary-color); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: bold; flex-shrink: 0; }
.course-item h4 { font-size: 17px; color: var(--primary-color); line-height: 1.4; word-break: break-word; text-align: left; }
.course-item p { color: #666; font-size: 14px; line-height: 1.7; margin-bottom: 10px; }
.course-meta { font-size: 13px; color: #999; margin-bottom: 15px; }

.add-course-btn {
  background: var(--card-bg); border: 2px dashed var(--primary-color); border-radius: 12px; padding: 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--primary-color); font-size: 16px; cursor: pointer; transition: all 0.3s; min-height: 200px;
}
.add-course-btn:hover { background: #e8eaf6; }
.add-course-btn .plus-icon { font-size: 36px; }

.course-actions-group {
  position: absolute; bottom: 20px; left: 25px; right: 25px;
  display: flex; flex-direction: row; gap: 15px; z-index: 5;
}
.course-edit-btn {
  flex: 1; background: #ff9800; color: white; border: none;
  padding: 10px 0; border-radius: 6px; cursor: pointer; font-size: 14px;
  white-space: nowrap; transition: background 0.2s;
}
.course-edit-btn:hover { background: #f57c00; }

.course-del-btn {
  flex: 1; background: #f44336; color: white; border: none;
  padding: 10px 0; border-radius: 6px; cursor: pointer; font-size: 14px;
  white-space: nowrap; transition: background 0.2s;
}
.course-del-btn:hover { background: #d32f2f; }

.resource-section { border-top: 1px dashed #e0e0e0; padding-top: 15px; margin-top: 15px; }
.resource-title { font-size: 14px; font-weight: bold; color: #333; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.add-res-btn { font-size: 12px; background: #e3f2fd; color: #1976d2; border: 1px solid #90caf9; padding: 4px 10px; border-radius: 12px; cursor: pointer; }
.resource-list { display: flex; flex-direction: column; gap: 8px; }
.res-item { display: flex; align-items: center; gap: 10px; background: #f8f9fa; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.res-icon { font-size: 18px; }
.res-link { color: #1976d2; text-decoration: none; flex: 1; word-break: break-all; cursor: pointer; }
.res-link:hover { text-decoration: underline; }
.del-res-btn { color: #f44336; cursor: pointer; font-size: 12px; display: none; margin-left: 10px; }
.rename-res-btn { color: #1976d2; cursor: pointer; font-size: 12px; display: none; margin-left: 10px; font-weight: bold; }
.teacher-mode .del-res-btn, .teacher-mode .rename-res-btn { display: block; }

.inline-form { display: none; background: #fffde7; padding: 15px; border-radius: 8px; margin-top: 10px; border: 1px solid #fff59d; }
.inline-form.active { display: block; }
.inline-form input, .inline-form select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; margin-bottom: 8px; width: 100%; font-size: 13px; }
.inline-form .form-actions { display: flex; gap: 10px; }

.res-tab-bar { display: flex; gap: 0; margin-bottom: 12px; }
.res-tab { flex: 1; padding: 8px; text-align: center; font-size: 13px; cursor: pointer; border: 1px solid #ccc; background: #f5f5f5; color: #666; transition: all 0.2s; }
.res-tab:first-child { border-radius: 6px 0 0 6px; }
.res-tab:last-child { border-radius: 0 6px 6px 0; }
.res-tab.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.res-tab-panel { display: none; }
.res-tab-panel.active { display: block; }
.file-upload-area {
  border: 2px dashed #ccc; border-radius: 8px; padding: 20px; text-align: center;
  cursor: pointer; transition: all 0.3s; margin-bottom: 8px; position: relative;
  color: #999; font-size: 13px;
}
.file-upload-area:hover { border-color: var(--primary-color); background: #f8f9ff; }
.file-upload-area input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-upload-area.has-file { border-color: #4caf50; background: #e8f5e9; color: #2e7d32; }

.qa-container { background: var(--card-bg); border-radius: 16px; padding: 30px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.qa-input-area { display: flex; gap: 10px; margin-bottom: 20px; }
.qa-input-area input { flex: 1; padding: 12px 18px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 14px; outline: none; }
.qa-input-area button { padding: 12px 24px; background: var(--primary-color); color: white; border: none; border-radius: 10px; cursor: pointer; }
.qa-list { display: flex; flex-direction: column; gap: 15px; }
.qa-item { padding: 20px; background: #f8f9ff; border-radius: 10px; border-left: 3px solid var(--primary-color); position: relative; }

.qa-question {
  font-size: 15px; color: #333; font-weight: 500; margin-bottom: 10px;
  max-height: 150px; overflow-y: auto; word-break: break-word;
}
.qa-meta { font-size: 12px; color: #999; margin-bottom: 10px; }
.qa-answer {
  background: #e8eaf6; padding: 12px; border-radius: 8px; font-size: 14px; color: #333; margin-top: 10px; border-left: 3px solid #3f51b5;
  max-height: 200px; overflow-y: auto; word-break: break-word;
}
.qa-answer-label { font-weight: bold; color: var(--primary-color); margin-right: 5px; }
.reply-area { margin-top: 10px; display: none; }
.reply-area.active { display: block; }
.reply-textarea { width: 100%; min-height: 60px; padding: 10px; border: 1px solid #c5cae9; border-radius: 6px; font-family: inherit; font-size: 13px; margin-bottom: 8px; }
.reply-btns { display: flex; gap: 10px; }
.reply-btns button { padding: 6px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }

.del-qa-btn {
  position: absolute; top: 10px; right: 10px;
  background: #ffebee; color: #c62828; border: 1px solid #ffcdd2;
  padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px;
  display: none; transition: all 0.2s;
}
.del-qa-btn:hover { background: #ef9a9a; color: white; }
.teacher-mode .del-qa-btn { display: block; }

/* 问答置顶按钮 */
.pin-qa-btn {
  position: absolute; top: 10px; right: 100px;
  background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9;
  padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px;
  display: none; transition: all 0.2s;
}
.pin-qa-btn:hover { background: #bbdefb; }
.teacher-mode .pin-qa-btn { display: block; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.book-card {
  background: var(--card-bg); border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  padding-bottom: 70px;
  border: 2px solid transparent;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

.book-card.dragging { opacity: 0.5; border: 2px dashed var(--primary-color); }
.book-card.drag-over { transform: scale(1.02); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

.drag-handle-book {
  position: absolute; top: 10px; right: 10px; left: auto; cursor: grab; color: #999; font-size: 16px;
  padding: 5px; display: none; z-index: 10; background: rgba(255,255,255,0.8); border-radius: 4px;
}
.drag-handle-book:active { cursor: grabbing; }
.teacher-mode .drag-handle-book { display: block; }

.book-cover {
  width: auto; height: 200px; aspect-ratio: 210 / 297;
  background: #f0f2f5; border-radius: 8px; margin: 0 auto 15px auto;
  display: flex; align-items: center; justify-content: center;
  color: #999; font-size: 40px; overflow: hidden; position: relative;
}
.book-cover img { width: 100%; height: 100%; object-fit: contain; }
.book-info h4 { font-size: 16px; color: var(--primary-color); margin-bottom: 5px; line-height: 1.4; }
.book-author { font-size: 13px; color: #666; margin-bottom: 8px; }
.book-desc { font-size: 13px; color: #888; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.book-actions-bottom {
  position: absolute; bottom: 15px; left: 20px; right: 20px;
  display: flex; gap: 10px; z-index: 5;
}
.book-action-btn-bottom {
  flex: 1; padding: 8px 0; border: none; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: white;
  transition: background 0.2s; display: none;
  align-items: center; justify-content: center;
}
.teacher-mode .book-action-btn-bottom { display: flex; }

.btn-edit-book-bottom { background: #ff9800; }
.btn-edit-book-bottom:hover { background: #f57c00; }

.btn-del-book-bottom { background: #f44336; }
.btn-del-book-bottom:hover { background: #d32f2f; }

.add-book-btn {
  background: var(--card-bg); border: 2px dashed var(--primary-color); border-radius: 12px; padding: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--primary-color); font-size: 16px; cursor: pointer; transition: all 0.3s; min-height: 280px;
}
.add-book-btn:hover { background: #e8eaf6; }

/* 生活案例思考 / 视野拓展 模块 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.media-card {
  background: var(--card-bg); border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06); position: relative;
  transition: transform 0.2s, box-shadow 0.2s; padding-bottom: 70px;
  border: 2px solid transparent;
}
.media-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.media-card.dragging { opacity: 0.5; border: 2px dashed var(--primary-color); }
.media-card.drag-over { transform: scale(1.02); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

.drag-handle-media {
  position: absolute; top: 10px; right: 10px; left: auto; cursor: grab; color: #999; font-size: 16px;
  padding: 5px; display: none; z-index: 10; background: rgba(255,255,255,0.8); border-radius: 4px;
}
.drag-handle-media:active { cursor: grabbing; }
.teacher-mode .drag-handle-media { display: block; }

.media-preview {
  width: 100%; height: 180px; background: #f0f2f5; border-radius: 8px;
  margin-bottom: 15px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: contain; }
.media-link-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--primary-color); text-decoration: none; font-size: 15px;
  padding: 20px; text-align: center; word-break: break-all;
}
.media-link-box:hover { text-decoration: underline; }
.media-link-icon { font-size: 40px; }

.media-info h4 { font-size: 16px; color: var(--primary-color); margin-bottom: 5px; line-height: 1.4; word-break: break-word; }
.media-desc { font-size: 13px; color: #888; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }

.media-actions-bottom {
  position: absolute; bottom: 15px; left: 20px; right: 20px;
  display: flex; gap: 10px; z-index: 5;
}
.media-action-btn-bottom {
  flex: 1; padding: 8px 0; border: none; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: white;
  transition: background 0.2s; display: none;
  align-items: center; justify-content: center;
}
.teacher-mode .media-action-btn-bottom { display: flex; }
.btn-edit-media-bottom { background: #ff9800; }
.btn-edit-media-bottom:hover { background: #f57c00; }
.btn-del-media-bottom { background: #f44336; }
.btn-del-media-bottom:hover { background: #d32f2f; }

.add-media-btn {
  background: var(--card-bg); border: 2px dashed var(--primary-color); border-radius: 12px; padding: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--primary-color); font-size: 16px; cursor: pointer; transition: all 0.3s; min-height: 200px;
}
.add-media-btn:hover { background: #e8eaf6; }

.more-card {
  background: #f8f9fa; border: 2px dashed #ccc; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 280px; cursor: pointer; transition: all 0.3s; color: #666;
}
.more-card:hover { background: #e8eaf6; border-color: var(--primary-color); color: var(--primary-color); }
.more-icon { font-size: 40px; margin-bottom: 10px; }
.more-text { font-size: 16px; font-weight: bold; }

.status-bar {
  background: #e8f5e9; color: #2e7d32; padding: 8px; text-align: center; font-size: 13px;
  border-bottom: 1px solid #c8e6c9; display: none; position: fixed; top: calc(var(--nav-height-top) + var(--nav-height-bottom)); width: 100%; z-index: 999;
}
.status-bar.error { background: #ffebee; color: #c62828; border-color: #ffcdd2; }

.footer { background: var(--primary-color); color: rgba(255,255,255,0.7); text-align: center; padding: 30px; font-size: 14px; margin-top: 50px; }

.btn-primary { background: var(--primary-color); color: white; }
.btn-success { background: #4caf50; color: white; }
.btn-cancel { background: #9e9e9e; color: white; }

.preview-modal-content {
  position: fixed; top: 15%; left: 50%; transform: translateX(-50%);
  width: 80%; max-width: 900px; height: 70vh;
  background: white; border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 6000;
  transition: all 0.2s ease;
}
.preview-modal-content.maximized {
  top: 0; left: 0; width: 100%; height: 100%; max-width: 100%; border-radius: 0; transform: none;
}
.preview-header {
  padding: 12px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center;
  background: #f8f9fa; user-select: none;
}
.preview-header h3 { margin: 0; font-size: 16px; color: var(--primary-color); }
.preview-controls { display: flex; gap: 8px; }
.preview-ctrl-btn {
  background: transparent; border: none; color: #666; font-size: 16px; cursor: pointer;
  width: 30px; height: 30px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.preview-ctrl-btn:hover { background: #e0e0e0; }
.preview-ctrl-btn.close-btn:hover { background: #f44336; color: white; }

.preview-body {
  flex: 1; overflow: auto; padding: 20px; display: flex; justify-content: center; align-items: center; background: #333;
  position: relative;
}
.preview-footer {
  padding: 15px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; background: white;
}

.preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-pdf { width: 100%; height: 100%; border: none; }
.preview-video { max-width: 100%; max-height: 100%; }
.preview-fallback { text-align: center; color: white; padding: 40px; }
.preview-fallback p { margin-bottom: 20px; font-size: 16px; }

.close-preview-btn {
  background: var(--primary-color); color: white; border: none; padding: 8px 20px;
  border-radius: 20px; cursor: pointer;
}
.download-btn {
  background: #4caf50; color: white; border: none; padding: 8px 20px;
  border-radius: 20px; cursor: pointer; text-decoration: none; display: inline-block;
}

@media (max-width: 768px) {
  .teacher-card { flex-direction: column; align-items: center; text-align: center; }
  .course-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .hero { margin-top: calc(var(--nav-height-top) + var(--nav-height-bottom)); }
  .modal-box { margin: 20px; }
  .preview-modal-content { width: 95%; height: 80vh; top: 10%; }
  .preview-modal-content.maximized { width: 100%; height: 100%; top: 0; }
  .course-item { padding-right: 25px; padding-bottom: 80px; }
  .course-actions-group { bottom: 15px; left: 15px; right: 15px; gap: 10px; }
  .book-card { padding-bottom: 70px; }

  .navbar { padding: 0 15px; }
  .nav-top { height: 50px; }
  .nav-bottom { height: 36px; }
  .nav-logo { font-size: 20px; }
  .nav-logo span { font-size: 18px; }
  .nav-links { gap: 10px; }
  .nav-links a { font-size: 14px; padding: 4px 10px; }
  .user-info { font-size: 11px; gap: 5px; }
  .role-badge, .logout-btn, .export-btn, .sync-btn, .stats-btn, .settings-btn { font-size: 10px; padding: 2px 6px; }

  /* 移动端适配 Hero 内容框 */
  .hero-content-wrapper {
    padding: 20px 30px;
    width: 95%;
  }
}
