/* =============================================
   教培工作台 - 移动端H5样式
   ============================================= */

/* CSS 变量 */
:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --white: #FFFFFF;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* 主容器 */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

/* 顶部导航 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  font-size: 24px;
}

/* 主内容区域 */
.main-content {
  flex: 1;
  margin-top: 56px;
  margin-bottom: 60px;
  padding: 16px;
  overflow-y: auto;
}

/* 页面切换 */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* 首页样式 */
.welcome-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.welcome-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.welcome-card p {
  opacity: 0.9;
}

/* 功能模块网格 */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.module-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.module-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.module-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.module-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-700);
}

/* 快捷待办 */
.quick-tips {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.quick-tips h3 {
  font-size: 16px;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.quick-item:active {
  background: var(--gray-100);
}

.empty-tip {
  color: var(--gray-400);
  text-align: center;
  padding: 20px;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--gray-500);
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 20px;
}

.nav-label {
  font-size: 12px;
}

/* 页面头部 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 18px;
  color: var(--gray-800);
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
}

.add-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

/* 列表样式 */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.list-item-name {
  font-weight: 600;
  color: var(--gray-800);
}

.list-item-desc {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 2px;
}

.list-item-actions {
  display: flex;
  gap: 8px;
}

.list-item-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.list-item-btn:hover,
.list-item-btn:active {
  opacity: 1;
}

/* 规划页面 */
.plan-date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.plan-date span {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-700);
}

.date-nav {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 14px;
}

.date-nav:active {
  background: var(--gray-100);
}

.plan-student-select {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.plan-student-select label {
  font-size: 14px;
  color: var(--gray-600);
  margin-right: 8px;
}

.plan-student-select select {
  border: none;
  background: none;
  font-size: 16px;
  color: var(--gray-800);
  outline: none;
  width: calc(100% - 80px);
}

/* 规划列表 */
.plans-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.plan-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plan-item-icon {
  font-size: 24px;
}

.plan-item-info h4 {
  font-size: 16px;
  font-weight: 600;
}

.plan-item-info p {
  font-size: 14px;
  color: var(--gray-500);
}

.plan-item-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-tag {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
}

.status-tag.completed {
  background: #D1FAE5;
  color: var(--success);
}

.status-tag.pending {
  background: #FEF3C7;
  color: var(--warning);
}

.plan-actions {
  display: flex;
  gap: 12px;
}

/* 按钮样式 */
.btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  flex: 1;
}

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

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

.btn-primary:active:not(:disabled) {
  background: var(--primary-dark);
}

.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:active:not(:disabled) {
  background: var(--gray-50);
}

.btn-full {
  width: 100%;
}

/* 批改页面 */
.correct-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: var(--white);
  color: var(--gray-800);
}

/* 上传区域 */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.2s;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-area:active {
  border-color: var(--primary);
}

.upload-hint {
  color: var(--gray-400);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
}

/* 批改结果 */
.correct-result {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

.correct-result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 16px;
}

.correct-result-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.accuracy-display {
  text-align: center;
  padding: 20px;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.accuracy-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
}

.accuracy-label {
  font-size: 14px;
  color: var(--gray-500);
}

.error-list {
  margin: 16px 0;
}

.error-item {
  background: #FEF2F2;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}

.error-item h4 {
  font-size: 14px;
  color: var(--danger);
  margin-bottom: 8px;
}

.error-item p {
  font-size: 14px;
  color: var(--gray-600);
  margin: 4px 0;
}

.suggestion-box {
  background: #F0FDF4;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.suggestion-box h4 {
  color: var(--success);
  margin-bottom: 8px;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* 总结页面 */
.summary-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.subject-list {
  margin: 16px 0;
}

.subject-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.subject-name {
  font-weight: 600;
}

.subject-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  width: 100px;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

.progress-text {
  font-size: 14px;
  color: var(--gray-500);
}

.summary-suggestion {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.summary-copy-preview {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  font-size: 14px;
  white-space: pre-wrap;
}

.summary-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* 模态框 */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  background: var(--white);
}

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
}

.modal-content {
  padding: 20px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-item label {
  font-size: 14px;
  color: var(--gray-600);
}

.form-item input,
.form-item select {
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-option {
  width: 44px;
  height: 44px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-option.active {
  border-color: var(--primary);
  background: var(--primary);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 12px;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--gray-800);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 2000;
}

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

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* 加载状态 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}

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

.empty-state-text {
  font-size: 14px;
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--white);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  font-size: 44px;
  text-align: center;
  margin-bottom: 8px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--gray-900);
}

.login-subtitle {
  font-size: 14px;
  text-align: center;
  color: var(--gray-400);
  margin: 6px 0 24px;
}

.login-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  margin-bottom: 12px;
  font-size: 15px;
  color: var(--gray-800);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  outline: none;
  transition: border-color .2s, background .2s;
}

.login-input:focus {
  border-color: var(--primary);
  background: var(--white);
}

.login-error {
  min-height: 20px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--danger);
}

.login-btn {
  width: 100%;
  height: 46px;
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity .2s;
}

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

.login-hint {
  margin-top: 18px;
  font-size: 12px;
  text-align: center;
  color: var(--gray-400);
}

/* 顶部用户名与退出 */
.user-name {
  font-size: 13px;
  color: var(--gray-600);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  padding: 5px 12px;
  font-size: 13px;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary-light);
  border-radius: 8px;
  cursor: pointer;
}
