/* =========================================
   考尔快交规 PC 端 - 公共样式 v5
   完全参照桌面截图样式
   ========================================= */

:root {
  /* 主色 - Element UI风格蓝 */
  --primary: #4a7cf7;
  --primary-light: #ecf5ff;
  --primary-dark: #3a6de5;
  
  /* Element UI蓝 */
  --el-blue: #1890ff;
  --el-blue-light: #e6f7ff;
  
  /* 成功绿 */
  --success: #61ca2a;
  --success-light: #f6ffed;
  
  /* 警告橙 */
  --warning: #fa8c16;
  --warning-light: #fff7e6;
  
  /* 错误红 */
  --danger: #ff4d4f;
  --danger-light: #fff2f0;
  
  /* 文字 */
  --text-primary: #333333;
  --text-regular: #666666;
  --text-secondary: #999999;
  --text-placeholder: #cccccc;
  
  /* 边框 */
  --border-base: #e5e5e5;
  --border-light: #f0f0f0;
  
  /* 背景 */
  --bg-page: #f5f7fa;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  
  /* 阴影 */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  
  /* 圆角 */
  --radius: 4px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  
  /* 过渡 */
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== 首页布局 ==================== */

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* === Header - 蓝色背景 === */
.site-header {
  background: var(--primary);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 200;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 15px;
  transition: var(--transition);
}

.header-nav a:hover,
.header-nav a.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.header-contact {
  color: #fff;
  font-size: 14px;
}

.header-contact a {
  color: #fff;
  text-decoration: none;
}

/* === Hero - 白底蓝边 === */
.hero-section {
  background: var(--bg-white);
  padding: 32px 0;
  border-bottom: 3px solid var(--primary);
}

.hero-section .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-left h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.hero-left .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.hero-stats {
  display: flex;
  gap: 32px;
}

.hero-stat {
  text-align: center;
  padding: 16px 28px;
  background: var(--primary-light);
  border-radius: var(--radius-lg);
}

.hero-stat .num {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.hero-stat .label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === Tab切换 - 药片样式 === */
.tab-bar {
  background: var(--bg-white);
  padding: 20px 0;
  border-bottom: 1px solid var(--border-light);
}

.tab-bar .container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tab-item {
  padding: 10px 32px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-regular);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-base);
  background: var(--bg-white);
}

.tab-item:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* === 主内容区 === */
.main-content {
  flex: 1;
  padding: 24px 0;
}

/* === 区块卡片 === */
.section-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

/* === 车型网格 - 5列 === */
.car-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}

.car-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  border: 2px solid transparent;
}

.car-card:hover {
  border-color: var(--success);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.car-card .icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.car-card .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.car-card .desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* === 功能入口 - 4列 === */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.feature-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  border: 1px solid var(--border-light);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.feature-card .icon-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-bottom: 16px;
}

.feature-card .icon-wrap.blue { background: var(--el-blue-light); color: var(--el-blue); }
.feature-card .icon-wrap.green { background: var(--success-light); color: var(--success); }
.feature-card .icon-wrap.orange { background: var(--warning-light); color: var(--warning); }
.feature-card .icon-wrap.red { background: var(--danger-light); color: var(--danger); }

.feature-card .title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.feature-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* === 学习记录 - 2列 === */
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  border: 1px solid transparent;
}

.history-card:hover {
  background: var(--bg-white);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.history-card .icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.history-card .icon-wrap.blue { background: var(--el-blue-light); color: var(--el-blue); }
.history-card .icon-wrap.orange { background: var(--warning-light); color: var(--warning); }

.history-card .info {
  flex: 1;
}

.history-card .info .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.history-card .info .meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* === Footer - 蓝色背景 === */
.site-footer {
  background: var(--primary);
  padding: 24px 0;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  text-align: center;
  margin-top: auto;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer a {
  color: #fff;
  text-decoration: none;
}

/* ==================== 练习页面布局 ==================== */

/* 顶部栏 - 白色背景 */
.practice-topbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 0;
}

.practice-topbar .container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-base);
  background: none;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.topbar-back:hover {
  background: var(--bg-page);
  border-color: var(--el-blue);
  color: var(--el-blue);
}

.topbar-info {
  flex: 1;
  min-width: 0;
}

.topbar-info .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.topbar-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.progress-bar {
  width: 160px;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--el-blue);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.topbar-progress .text {
  font-size: 14px;
  font-weight: 600;
  color: var(--el-blue);
  white-space: nowrap;
}

/* 主体布局 */
.practice-layout {
  display: flex;
  gap: 24px;
  padding: 24px 0;
}

.practice-main {
  flex: 1;
  min-width: 0;
}

.practice-sidebar {
  width: 300px;
  flex-shrink: 0;
}

/* 题目卡片 */
.question-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.question-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.question-tag.judgment { background: var(--el-blue-light); color: var(--el-blue); }
.question-tag.single { background: var(--success-light); color: var(--success); }
.question-tag.multi { background: var(--warning-light); color: var(--warning); }

.question-index {
  font-size: 14px;
  color: var(--text-secondary);
}

.question-content {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.question-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 16px 0;
}

/* 选项 */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
}

.option-item:hover:not(.disabled) {
  border-color: var(--el-blue);
  background: var(--el-blue-light);
}

.option-item.selected {
  border-color: var(--el-blue);
  background: var(--el-blue-light);
}

.option-item.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.option-item.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.option-item.disabled {
  cursor: not-allowed;
}

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.option-item.selected .option-letter {
  background: var(--el-blue);
  color: #fff;
}

.option-item.correct .option-letter {
  background: var(--success);
  color: #fff;
}

.option-item.wrong .option-letter {
  background: var(--danger);
  color: #fff;
}

.option-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  padding-top: 5px;
}

/* 解析 */
.analysis-box {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--el-blue);
}

.analysis-box.correct { border-left-color: var(--success); }
.analysis-box.wrong { border-left-color: var(--danger); }

.analysis-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.analysis-box p {
  color: var(--text-regular);
  font-size: 14px;
}

/* 底部操作栏 */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.bottom-bar .left,
.bottom-bar .right {
  display: flex;
  gap: 12px;
}

/* 侧边栏 */
.sidebar-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.sidebar-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-stat {
  text-align: center;
}

.sidebar-stat .num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-stat .num.blue { color: var(--el-blue); }
.sidebar-stat .num.green { color: var(--success); }
.sidebar-stat .num.red { color: var(--danger); }

.sidebar-stat .label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-actions .btn {
  width: 100%;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  gap: 6px;
}

.btn-primary {
  background: var(--el-blue);
  color: #fff;
}

.btn-primary:hover {
  background: #40a9ff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-base);
  color: var(--text-regular);
}

.btn-outline:hover {
  border-color: var(--el-blue);
  color: var(--el-blue);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* 答题卡弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-page);
}

.answer-sheet {
  padding: 24px;
}

.answer-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 登录类型切换标签 */
.login-type-switch {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  background: var(--bg-page);
  border-radius: var(--radius);
  padding: 2px;
}

.login-type-tab {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: var(--radius);
  user-select: none;
}

.login-type-tab:hover {
  color: var(--primary);
}

.login-type-tab.active {
  background: var(--bg-white);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.answer-legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.answer-legend .dot {
  width: 14px;
  height: 14px;
  border-radius: var(--radius);
}

.answer-legend .dot.done { background: var(--el-blue); }
.answer-legend .dot.correct { background: var(--success); }
.answer-legend .dot.wrong { background: var(--danger); }
.answer-legend .dot.current { border: 2px solid var(--el-blue); background: #fff; }

.answer-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 10px;
}

.sheet-num {
  aspect-ratio: 1;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  background: var(--bg-white);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-num:hover {
  border-color: var(--el-blue);
}

.sheet-num.current {
  border-color: var(--el-blue);
  background: var(--el-blue);
  color: #fff;
}

.sheet-num.correct {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.sheet-num.wrong {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.sheet-num.answered {
  background: var(--border-light);
}

/* Toast */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 1000;
  animation: fadeInOut 2.5s ease;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15%, 85% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Loading */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-light);
  border-top-color: var(--el-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 响应式 */
@media (max-width: 992px) {
  .car-grid { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .practice-sidebar { display: none; }
  .hero-section .container { flex-direction: column; gap: 24px; }
}

@media (max-width: 768px) {
  .car-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 16px; }
  .hero-left h1 { font-size: 22px; }
  .header-nav { display: none; }
}

/* 辅助类 */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--el-blue); }
.hidden { display: none; }
