/* 及简乐享 Demo - 基础样式 */

:root {
  --primary-color: #1890ff;
  --primary-light: #e6f7ff;
  --primary-dark: #096dd9;
  --success-color: #52c41a;
  --warning-color: #faad14;
  --danger-color: #f5222d;
  --purple-color: #722ed1;
  --cyan-color: #13c2c2;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f7fa;
  --bg-hover: #f0f2f5;
  --border-color: #e8e8e8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --transition: all 0.25s ease;
}

/* 深色主题 */
.dark-theme {
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --text-muted: #777;
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-hover: #0f3460;
  --border-color: #2a2a4a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

a { color: var(--primary-color); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: linear-gradient(180deg, #001529 0%, #002140 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1890ff, #36cfc9);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  transition: var(--transition);
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-item.active {
  color: #fff;
  background: rgba(24,144,255,0.2);
  border-left-color: var(--primary-color);
}

.icon { width: 18px; text-align: center; font-style: normal; }
.icon-home::before { content: '🏠'; }
.icon-doc::before { content: '📄'; }
.icon-qa::before { content: '❓'; }
.icon-course::before { content: '🎓'; }
.icon-exam::before { content: '📝'; }
.icon-map::before { content: '🗺'; }
.icon-activity::before { content: '🎯'; }
.icon-vote::before { content: '📊'; }
.icon-forum::before { content: '💬'; }
.icon-live::before { content: '📺'; }
.icon-cert::before { content: '🏆'; }
.icon-admin::before { content: '⚙'; }
.icon-bell::before { content: '🔔'; }
.icon-theme::before { content: '🌓'; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1890ff, #722ed1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.user-name {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-secondary);
}

/* 顶部栏 */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  z-index: 50;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px 8px;
}

.search-bar {
  flex: 1;
  max-width: 500px;
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.search-btn {
  padding: 8px 16px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}

.search-btn:hover { background: var(--primary-dark); }

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

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  font-size: 16px;
}

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

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--danger-color);
  color: #fff;
  font-size: 11px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* 页面容器 */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  scroll-behavior: smooth;
}

.page {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
}

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

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

/* 通知面板 */
.notification-panel {
  position: fixed;
  top: var(--topbar-height);
  right: 20px;
  width: 380px;
  max-height: 500px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

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

.notification-header h3 { font-size: 16px; }

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.notification-item:hover { background: var(--bg-hover); }
.notification-item.read { opacity: 0.6; }

.notification-icon { font-size: 20px; flex-shrink: 0; }

.notification-content { flex: 1; min-width: 0; }

.notification-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
}

.notification-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notification-dot {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

.modal-content.large { max-width: 800px; }
.modal-content.medium { max-width: 600px; }

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

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

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  border-left: 4px solid var(--primary-color);
  font-size: 14px;
}

.toast.show { transform: translateX(0); }
.toast-success { border-left-color: var(--success-color); }
.toast-error { border-left-color: var(--danger-color); }
.toast-warning { border-left-color: var(--warning-color); }
.toast-icon { font-size: 16px; }

.hidden { display: none !important; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success-color); color: #fff; }
.btn-outline { background: var(--bg-primary); color: var(--text-primary); border-color: var(--border-color); }
.btn-outline:hover { border-color: var(--primary-color); color: var(--primary-color); }
.btn-outline.active { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-text { background: none; border: none; color: var(--primary-color); cursor: pointer; padding: 4px 8px; font-size: 13px; }
.btn-text:hover { opacity: 0.8; }

/* 表单 */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 500; font-size: 14px; color: var(--text-primary); }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.form-input, .form-select, .form-textarea {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.form-textarea { resize: vertical; min-height: 80px; }
.inline-select { width: auto; padding: 6px 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.file-upload {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.file-upload:hover { border-color: var(--primary-color); background: var(--primary-light); }
.file-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-upload p { color: var(--text-muted); }

/* 工具类 */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-muted { color: var(--text-muted) !important; }
.small { font-size: 12px !important; }

.link-more {
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition);
}

.link-more:hover { color: var(--primary-color); }

/* 进度条 */
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 3px;
  line-height: 1.6;
}

.tag-default { background: var(--bg-hover); color: var(--text-secondary); }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-red { background: #fff1f0; color: #f5222d; }
.tag-orange { background: #fff7e6; color: #fa8c16; }

.dark-theme .tag-blue { background: rgba(24,144,255,0.15); }
.dark-theme .tag-green { background: rgba(82,196,26,0.15); }
.dark-theme .tag-red { background: rgba(245,34,45,0.15); }
.dark-theme .tag-orange { background: rgba(250,140,22,0.15); }

/* 头像 */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-xs { width: 24px; height: 24px; font-size: 11px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

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

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

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.switch input:checked + .slider { background: var(--primary-color); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { left: 0; }
  .sidebar-toggle { display: block; }
  .page { padding: 16px; }
  .search-bar { max-width: 300px; }
  .notification-panel { width: calc(100% - 20px); right: 10px; }

  .modal-content { width: 95%; max-height: 90vh; }

  .home-grid { grid-template-columns: 1fr !important; }
  .course-grid { grid-template-columns: 1fr !important; }
  .docs-layout { flex-direction: column; }
  .docs-sidebar { width: 100% !important; }
  .qa-layout { flex-direction: column; }
  .qa-sidebar { width: 100% !important; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }
.dark-theme ::-webkit-scrollbar-thumb { background: #555; }
