/* ==========================================================================
   面试工作台 - 布局与响应式控制规范 (layout.css)
   移动端极致优化，强制防挤压、防缓存、防换行
   ========================================================================== */

/* 桌面与移动端显隐工具类 (强行覆盖，防样式层叠丢失) */
.mobile-only {
  display: none !important;
}

.desktop-only {
  display: flex !important;
}

/* 1. 顶部导航栏 */
.top-navbar {
  height: 50px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: rgba(2, 132, 199, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(2, 132, 199, 0.4);
  border-radius: 4px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  gap: 6px;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab-btn:hover {
  color: #ffffff;
  background: var(--bg-subtle);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: var(--accent-blue);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* 2. 主页面网格容器 */
.app-container {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

/* 刷题工作台三栏布局 (PC 端) */
.quiz-layout-grid {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

/* 左侧分类导航栏 */
.category-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1rem;
}

.sidebar-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}

.cat-item-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}

.cat-item-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.cat-item-btn.active {
  background: rgba(2, 132, 199, 0.15);
  border-color: rgba(2, 132, 199, 0.4);
  color: var(--accent-cyan);
  font-weight: 700;
}

.cat-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
}

/* 中间答题主舞台 */
.main-stage-col {
  min-width: 0;
  width: 100%;
}

/* 右侧做题看板与网格 */
.status-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1rem;
}

.panel-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  font-family: var(--font-mono);
}

/* 难度筛选按钮组 */
.difficulty-filter-group {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
}

.diff-filter-btn {
  flex: 1;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 6px 0;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 600;
  transition: all 0.15s ease;
}

.diff-filter-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

/* 题目序号跳转网格 */
.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.grid-num-btn {
  height: 36px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  transition: all 0.15s ease;
}

.grid-num-btn:hover {
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.grid-num-btn.current {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.grid-num-btn.correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-green);
  color: #34d399;
}

.grid-num-btn.wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: #f87171;
}

/* 3. 移动端专用组件规范 */
.mobile-category-bar {
  display: none;
  overflow-x: auto;
  white-space: nowrap;
  gap: 6px;
  padding: 4px 0;
  margin-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.mobile-category-bar::-webkit-scrollbar {
  display: none;
}

.mobile-cat-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mobile-cat-pill.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-cyan);
}

.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: rgba(17, 24, 39, 0.98);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 3px 6px;
}

.bottom-tab-btn.active {
  color: var(--accent-cyan);
}

.bottom-tab-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* 移动端底部抽屉题卡 (BottomSheet Drawer) */
.bottom-sheet-drawer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 75vh;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-strong);
  border-radius: 16px 16px 0 0;
  z-index: 150;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  flex-direction: column;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 140;
}

/* ==========================================================================
   4. 移动端彻底优化断点 (<= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  /* 强制显隐切换 */
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: inline-block !important;
  }

  .quiz-layout-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .category-sidebar, .status-sidebar {
    display: none !important;
  }
  .mobile-category-bar {
    display: flex;
  }
  .mobile-bottom-bar {
    display: flex;
  }

  /* 顶部导航极度精简，确保标题绝对单行不折行 */
  .top-navbar {
    height: 44px;
    padding: 0 0.75rem;
  }
  .brand-title {
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: nowrap;
  }
  .header-status {
    gap: 0;
  }

  /* 移动端主容器贴边展开，把所有屏幕宽度让给题目 */
  .app-container {
    padding: 0.35rem 0.5rem;
    padding-bottom: 65px; /* 留出底部导航空间 */
  }
}

/* 移动端强制高优先级隐藏与防折行 */
@media (max-width: 1024px) {
  .top-navbar .brand-badge,
  .top-navbar .desktop-only,
  .top-navbar .nav-links,
  .top-navbar #grid-stat-summary {
    display: none !important;
  }
  .top-navbar .brand-title {
    white-space: nowrap !important;
    font-size: 1.05rem !important;
    line-height: 1 !important;
  }
  .top-navbar #mobile-stat-badge {
    display: inline-block !important;
  }
}
