/* ═══════════════════════════════════════════════════════════
   DeutschLernen · 学生中心样式
   品牌色与教师端统一
   ═══════════════════════════════════════════════════════════ */
:root {
  --accent: #e94560;
  --accent-light: #ff6b6b;
  --accent-bg: rgba(233, 69, 96, 0.08);
  --primary: #1a1a2e;
  --secondary: #16213e;
  --bg: #f0f2f5;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1a1a2e;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --sidebar-w: 200px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont,
               'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── 通用 ── */
.btn-sm {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  background: transparent;
  color: var(--text-dim);
  transition: all 0.15s;
}
.btn-sm.btn-success {
  color: var(--success);
  border-color: var(--success);
}
.btn-sm.btn-success:hover { background: var(--success-bg); }

input, select {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  color: var(--text);
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ── 登录/激活视图 ── */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.auth-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 28px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.1);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}
.brand-logo-img {
  width: 161px;
  height: auto;
  max-height: 69px;
  object-fit: contain;
}
.sidebar-brand-img {
  width: 160px;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  margin: 0 auto;
}
.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.brand-name span {
  color: var(--text-dim);
  font-weight: 400;
}
.tab-row {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
.tab-btn.active {
  background: var(--accent);
  color: #fff;
}
.auth-form {
  margin-top: 6px;
}
.auth-title {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  margin: 5px 0 16px;
}
.auth-hint {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}
/* ── 滑块验证码悬浮层 ── */
.captcha-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
}

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

.captcha-modal {
  background: var(--panel);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 320px;
  position: relative;
}

.captcha-modal-title {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text);
}

.captcha-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.captcha-close-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* 登录弹窗中的验证码容器改为隐藏 */
#login-captcha-container {
  display: none !important;
}

/* 注册弹窗中的验证码容器改为隐藏 */
#register-captcha-container {
  display: none !important;
}

/* 找回密码弹窗中的验证码容器改为隐藏 */
#reset-captcha-container {
  display: none !important;
}

.form-group { margin-bottom: 10px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group { flex: 1; }
.auth-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
  margin-bottom: 6px;
}
.auth-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  transition: filter 0.15s;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-links {
  text-align: center;
  margin-top: 14px;
}
.auth-links a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }

/* ── 激活成功视图 ── */
.success-box {
  text-align: center;
}
.success-icon {
  width: 56px;
  height: 56px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 14px;
}
.success-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.success-warning {
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 500;
}
.account-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 0 auto 14px;
  max-width: 280px;
}
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
.account-row + .account-row {
  border-top: 1px solid var(--border);
}
.account-label {
  font-size: 13px;
  color: var(--text-dim);
}
.account-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'SF Mono', 'Consolas', monospace;
}
.success-reminder {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.success-reminder strong { color: var(--accent); }

/* ── 管理布局 ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-bg);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sidebar-logo .brand-name { font-size: 16px; }
.sidebar-user {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}
.sidebar-user strong { color: var(--accent); }
.sidebar-nav {
  flex: 1;
  padding: 14px 12px 18px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  transition: all 0.15s;
  margin-bottom: 4px;
}
.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}
.nav-icon { font-size: 16px; width: 22px; }
.sidebar-footer {
  padding: 14px 14px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
}
.logout-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

/* ── 主内容区 ── */
.main {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  max-width: 1000px;
  background: #fafbfc;
}
.main-header {
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.main-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.main-desc {
  font-size: 13px;
  color: var(--text-dim);
}
.hw-summary {
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 12px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

/* ── 账户信息 ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.info-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.info-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.info-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.info-value strong {
  color: var(--accent);
  font-size: 18px;
}

/* ── 我的作业 ── */
.hw-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.hw-pending {
  border-left: 4px solid var(--warning);
  background: #fefefe;
}
.hw-done {
  border-left: 4px solid var(--success);
  background: #fafafa;
}
.hw-info { flex: 1; }
.hw-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.hw-title code {
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--accent);
  font-weight: 700;
}
.hw-meta {
  font-size: 12px;
  color: var(--text-dim);
}
.hw-action { margin-left: 12px; }

/* ── 我的应用 ── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.app-card {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  background: var(--panel);
}
.app-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.app-card-coming {
  opacity: 0.55;
  filter: grayscale(0.8);
  cursor: default;
}
.app-card-coming:hover {
  box-shadow: var(--shadow);
  transform: none;
  opacity: 0.65;
}
.app-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}
.app-icon {
  font-size: 24px;
  margin-right: 12px;
}
.app-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
.app-arrow {
  color: var(--accent);
  font-size: 18px;
}

/* ── 标签 ── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.tag-done { background: var(--success-bg); color: var(--success); }

/* ── 文字辅助 ── */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.error-msg {
  color: var(--danger);
  font-size: 13px;
  padding: 12px;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
}
.empty-msg {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%; min-width: 0;
    height: auto; position: relative;
  }
  .sidebar-header { padding: 12px 14px 10px; }
  .sidebar-nav {
    display: flex; flex-wrap: wrap;
    gap: 4px; padding: 8px;
  }
  .nav-item {
    flex: 1; min-width: 60px;
    justify-content: center;
    padding: 8px 6px;
    font-size: 13px;
  }
  .nav-icon { font-size: 14px; width: 18px; }
  .main { padding: 14px; background: var(--bg); }
  .info-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .app-grid { grid-template-columns: 1fr 1fr; }

  /* 登录/注册弹窗适配 */
  .auth-card { padding: 20px 18px; max-width: 100%; }
  .auth-title { font-size: 15px; }
  .brand-name { font-size: 17px; }
  .brand-logo-img { max-height: 50px; }

  /* 滑块验证悬浮层适配 */
  .captcha-modal { max-width: 280px; padding: 16px; }

  /* 注册成功视图适配 */
  .success-icon { width: 44px; height: 44px; font-size: 22px; }
  .account-box { max-width: 100%; padding: 12px; }

  /* 模态框适配 */
  .modal-content {
    width: 94%; max-width: 100%;
    max-height: 85vh;
    border-radius: 12px;
  }

  /* 表格横向滚动 */
  .main { overflow-x: hidden; }
}

@media (max-width: 400px) {
  .app-grid { grid-template-columns: 1fr; }
  .app-card { padding: 10px 12px; }
  .app-icon { font-size: 20px; margin-right: 8px; }
  .auth-card { padding: 16px 14px; border-radius: 12px; }
  .tab-btn { font-size: 13px; padding: 8px; }
}

/* ── 模态框 ── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--panel);
  border-radius: var(--radius);
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 22px;
}

/* ── 输入框带按钮 ── */
.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
}

.sms-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.sms-btn:hover:not(:disabled) {
  background: var(--accent-light);
}

.sms-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

/* ── 分隔线 ── */
.optional-divider {
  text-align: center;
  margin: 20px 0 15px 0;
  position: relative;
}

.optional-divider::before,
.optional-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 80px);
  height: 1px;
  background: var(--border);
}

.optional-divider::before {
  left: 0;
}

.optional-divider::after {
  right: 0;
}

.optional-divider span {
  background: var(--panel);
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── 必填标记 ── */
.required {
  color: var(--danger);
  margin-left: 2px;
}

/* ── 链接样式 ── */
.auth-links {
  text-align: center;
  margin-top: 15px;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ── 成功消息 ── */
.auth-success {
  color: var(--success);
  font-size: 13px;
  padding: 12px;
  background: var(--success-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
}