/* ========== 全局变量 ========== */
:root {
  --primary: #1cbbb4;
  --primary-light: rgba(28, 187, 180, 0.1);
  --primary-light-2: rgba(28, 187, 180, 0.5);
  --text-dark: #3a3838;
  --text-gray: #666;
  --text-light: #cfcfcf;
  --bg-light: #f5f7fa;
  --white: #ffffff;
  --border: #e8e8e8;
  --footer-bg: #3a3838;
}

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

html, body {
  width: 100%;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary);
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== 头部导航 ========== */
.header {
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 40px;
}

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

.logo img {
  height: 40px;
  width: auto;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.5px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.nav-item {
  padding: 8px 18px;
  font-size: 15px;
  color: var(--text-dark);
  border-radius: 4px;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
}

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

.nav-item.active::after {
  content: "";
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-light);
  border-radius: 20px;
  padding: 6px 14px;
  width: 220px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 13px;
  color: var(--text-dark);
}

.search-box input::placeholder {
  color: #999;
}

.search-box .search-icon {
  color: var(--text-gray);
  font-size: 14px;
  cursor: pointer;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-links a {
  font-size: 14px;
  color: var(--text-gray);
}

.auth-links .btn-login {
  padding: 6px 18px;
  background: var(--primary);
  color: var(--white) !important;
  border-radius: 16px;
  transition: opacity 0.2s;
}

.auth-links .btn-login:hover {
  opacity: 0.9;
}

/* ========== 轮播图 ========== */
.banner {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.swiper {
  width: 100%;
  height: 400px;
  position: relative;
}

.swiper-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
}

.swiper-slide {
  min-width: 100%;
  height: 100%;
}

.swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.swiper-pagination {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.swiper-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s;
}

.swiper-dot.active {
  background: var(--white);
  width: 24px;
  border-radius: 5px;
}

.swiper-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.swiper-arrow:hover {
  background: rgba(0, 0, 0, 0.4);
}

.swiper-arrow.prev {
  left: 20px;
}

.swiper-arrow.next {
  right: 20px;
}

/* ========== 卡片导航 ========== */
.card-section {
  padding: 40px 0;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s;
  aspect-ratio: 4 / 3;
}

.card-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(28, 187, 180, 0.2);
}

.card-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.card-item:hover img {
  transform: scale(1.05);
}

.card-item .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: var(--white);
}

.card-item .card-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

.card-item .card-subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 4px;
}

/* ========== 题库分类区 ========== */
.category-section {
  padding: 40px 0;
}

.category-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.category-tab {
  padding: 8px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.category-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.category-tab.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* ========== 页脚 ========== */
.footer {
  background: var(--footer-bg);
  color: var(--text-light);
  padding: 40px 0 20px;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

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

.footer-logo img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
}

.footer-logo-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
}

.footer-info {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
}

.footer-info a {
  color: var(--text-light);
}

.footer-info a:hover {
  color: var(--primary);
}

.footer-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #999;
}

/* ========== 悬浮按钮 ========== */
.float-buttons {
  position: fixed;
  right: 20px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}

.float-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(28, 187, 180, 0.3);
  transition: all 0.2s;
  font-size: 20px;
}

.float-btn:hover {
  transform: scale(1.1);
}

.float-btn.up {
  display: none;
}

.float-btn.up.show {
  display: flex;
}

/* ========== 题库页面 ========== */
.breadcrumb {
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-gray);
}

.breadcrumb a {
  color: var(--text-gray);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  margin: 0 8px;
  color: #ccc;
}

.breadcrumb .current {
  color: var(--text-dark);
}

.qbank-layout {
  display: flex;
  gap: 24px;
  padding-bottom: 40px;
}

.qbank-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  height: fit-content;
  position: sticky;
  top: 84px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--text-dark);
}

.sidebar-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-item.active {
  background: var(--primary);
  color: var(--white);
}

.sidebar-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.qbank-main {
  flex: 1;
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  min-height: 500px;
}

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

.qbank-title {
  font-size: 20px;
  font-weight: 600;
}

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

.btn {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-dark);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 分类选择弹窗 */
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 720px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

.modal-close {
  font-size: 20px;
  color: #999;
  cursor: pointer;
  background: none;
  border: none;
}

.modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.modal-categories {
  width: 200px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 0;
}

.modal-cat-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.modal-cat-item:hover {
  background: var(--bg-light);
}

.modal-cat-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.modal-cat-item .arrow {
  margin-left: auto;
  font-size: 12px;
  color: #ccc;
}

.modal-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.modal-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-search input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  font-size: 14px;
}

.modal-search input:focus {
  border-color: var(--primary);
}

.modal-search button {
  padding: 8px 16px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.sub-category-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sub-cat-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  transition: all 0.2s;
}

.sub-cat-item:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sub-cat-item.selected {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.modal-empty {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}

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

/* 题库列表 */
.paper-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.paper-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.paper-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(28, 187, 180, 0.1);
}

.paper-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.paper-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-gray);
}

.paper-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .header-inner {
    height: 56px;
    gap: 16px;
  }

  .logo-text {
    font-size: 18px;
  }

  .nav {
    display: none;
  }

  .search-box {
    width: 140px;
  }

  .swiper {
    height: 200px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-item .card-title {
    font-size: 18px;
  }

  .qbank-layout {
    flex-direction: column;
  }

  .qbank-sidebar {
    width: 100%;
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 8px;
    flex-wrap: wrap;
  }

  .qbank-current {
    width: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    margin-right: 0;
    text-align: left;
  }
  .qbank-current-label { margin-bottom: 0; }
  .qbank-current-name {
    flex: 1;
    margin-bottom: 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .qbank-current-btn { width: auto; padding: 6px 14px; }

  .sidebar-item {
    flex-shrink: 0;
  }

  .paper-list {
    grid-template-columns: 1fr;
  }

  .modal-body {
    flex-direction: column;
  }

  .modal-categories {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }

  .modal-cat-item {
    flex-shrink: 0;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* 加载动画 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
}

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

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

.loading-text {
  color: var(--primary);
  font-size: 14px;
}
