@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --sme-bg: #0b0f19;          
  --sme-surface: #111827;     
  --sme-card: #1f2937;        
  --sme-border: #374151;      
  --sme-text: #f9fafb;        
  --sme-muted: #9ca3af;       
  --sme-brand: #10b981;       
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background: var(--sme-bg); color: var(--sme-text); min-height: 100vh; overflow: hidden; }

/* ==========================================================================
   关键修复：通过 flex-direction: row 锁死左右两栏并排排列结构
   ========================================================================== */
.app-layout { 
  display: flex !important;       
  flex-direction: row !important; 
  width: 100vw; 
  height: 100vh; 
  overflow: hidden; 
}

/* 固定左侧导航栏，缩进为0防止被挤压 */
aside { 
  width: 270px; 
  height: 100%;                  
  background: var(--sme-surface); 
  border-right: 1px solid rgba(55, 65, 81, 0.6); 
  padding: 28px 16px; 
  display: flex; 
  flex-direction: column; 
  flex-shrink: 0;                
}

.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; cursor: pointer; margin-bottom: 24px; padding: 0 4px; }
.logo-box { background: var(--sme-brand); color: white; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.nav-link { background: none; border: none; text-align: left; padding: 11px 14px; border-radius: 10px; color: var(--sme-muted); font-weight: 600; font-size: 0.88rem; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.2s; }
.nav-link:hover, .nav-link.active { background: #1e293b; color: #34d399; }
.nav-link:disabled { opacity: 0.15; cursor: not-allowed; }

/* User profile pinned to bottom */
.user-profile { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  border-top: 1px solid var(--sme-border); 
  padding: 16px 4px 0; 
  margin-top: auto; 
}
.user-avatar { 
  width: 36px; 
  height: 36px; 
  background: #374151; 
  border-radius: 50%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 700; 
  color: white; 
  font-size: 0.85rem;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.u-name { font-size: 0.85rem; font-weight: 600; color: var(--sme-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-status { font-size: 0.75rem; color: var(--sme-muted); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.u-status:hover { color: #ef4444; }

/* 右侧独立主区域：全盘接管大面积滚动 */
main { 
  flex: 1; 
  height: 100%; 
  overflow-y: auto; 
  background: #090d16; 
}
.main-section { padding: 48px; display: none; }
.main-section.active { display: block; }

.section-title-wrap h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; color: var(--sme-text); }
.section-title-wrap p { color: var(--sme-muted); font-size: 0.95rem; margin-top: 8px; }

/* 选科卡片栅格 */
.sme-course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; margin-top: 36px; }
.sme-card { background: var(--sme-surface); border: 1px solid rgba(55, 65, 81, 0.5); border-radius: 16px; overflow: hidden; transition: all 0.25s ease; }
.sme-card:hover { transform: translateY(-5px); border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 12px 24px rgba(0,0,0,0.4); }
.card-top-indicator { height: 4px; width: 100%; }
.color-physics { background: #3b82f6; }
.color-math { background: #f59e0b; }

.sme-card-body { padding: 28px; }
.sme-subject-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 16px; background: #1f2937; }
.icon-blue { color: #3b82f6; } .icon-amber { color: #f59e0b; }
.sme-card h3 { font-size: 1.25rem; font-weight: 700; color: var(--sme-text); }
.sme-card p { font-size: 0.88rem; color: var(--sme-muted); margin-top: 8px; line-height: 1.5; }

.sme-level-selector { display: flex; gap: 10px; margin-top: 24px; }
.sme-level-selector button { flex: 1; padding: 11px; background: #1f2937; border: 1px solid #374151; color: white; border-radius: 10px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.sme-level-selector button:hover { background: var(--sme-brand); border-color: var(--sme-brand); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }

/* 目录大纲树 */
.sme-syllabus-list { display: flex; flex-direction: column; gap: 16px; max-width: 850px; margin-top: 28px; }
.sme-topic-block { background: var(--sme-surface); border: 1px solid var(--sme-border); border-radius: 14px; overflow: hidden; }
.sme-topic-head { padding: 18px 24px; font-weight: 700; font-size: 1.05rem; background: #1e293b; color: white; }
.sme-subtopic-row { padding: 16px 24px; border-top: 1px solid var(--sme-border); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: background 0.2s; }
.sme-subtopic-row:hover { background: #243242; }
.subtopic-badge { font-size: 0.8rem; background: rgba(16, 185, 129, 0.12); color: #34d399; padding: 6px 12px; border-radius: 8px; font-weight: 700; }

/* 真题核心渲染引擎面版 */
.sme-practice-box { background: var(--sme-surface); border: 1px solid var(--sme-border); border-radius: 18px; padding: 36px; margin-top: 24px; }
.sme-meta-row { display: flex; justify-content: space-between; margin-bottom: 24px; color: var(--sme-muted); font-weight: 600; font-size: 0.9rem; }
.badge-medium { color: #f59e0b; background: rgba(245, 158, 11, 0.1); padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 800; }
.question-text { font-size: 1.2rem; line-height: 1.6; margin-bottom: 28px; font-weight: 500; color: var(--sme-text); }

.sme-mcq-stack { display: flex; flex-direction: column; gap: 14px; }
.sme-option-item { background: var(--sme-card); border: 2px solid var(--sme-border); color: white; width: 100%; text-align: left; padding: 18px 24px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 16px; transition: all 0.15s; }
.sme-option-item:hover { border-color: #4b5563; background: #232d3d; }
.sme-opt-dot { width: 28px; height: 28px; border-radius: 50%; background: #0b0f19; border: 1px solid var(--sme-border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }

.sme-option-item.correct { border-color: #10b981; background: rgba(16, 185, 129, 0.08); }
.sme-option-item.correct .sme-opt-dot { background: #10b981; border-color: #10b981; color: white; }
.sme-option-item.wrong { border-color: #ef4444; background: rgba(239, 68, 68, 0.08); }

.breadcrumb { font-size: 0.85rem; color: var(--sme-muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.breadcrumb span { cursor: pointer; } .breadcrumb span:hover { color: white; }
.breadcrumb .active { color: var(--sme-brand); font-weight: 600; cursor: default; }
.separator { font-size: 0.7rem; color: #4b5563; }

.practice-controls { display: flex; justify-content: space-between; margin-top: 28px; }
.btn-sme-primary { background: #10b981; color: white; border: none; padding: 14px 28px; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-sme-ghost { background: #1f2937; border: 1px solid var(--sme-border); color: white; padding: 14px 28px; border-radius: 12px; font-weight: 700; cursor: pointer; }

.toast { position: fixed; bottom: 32px; right: 32px; background: #1f2937; border-left: 4px solid #10b981; padding: 16px 24px; border-radius: 10px; color: white; font-weight: 600; opacity: 0; transform: translateY(40px); transition: all 0.25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
/* 新增学科卡片的顶部色块及图标背景色 */
.color-chemistry { background: #10b981; } /* 翠绿色 */
.color-business { background: #a855f7; }  /* 梦幻紫 */

.icon-green { color: #10b981; }
.icon-purple { color: #a855f7; }

/* ==========================================================================
   全局搜索栏 (Global Search)
   ========================================================================== */
.search-container {
  position: relative;
  margin-bottom: 20px;
  padding: 0 4px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: #1e293b;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 8px 12px;
  gap: 8px;
  transition: border-color 0.2s;
}

.search-input-wrapper:focus-within {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.search-icon {
  color: #6b7280;
  font-size: 1rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #f9fafb;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  min-width: 0;
}

.search-input::placeholder {
  color: #6b7280;
  font-weight: 400;
}

.search-kbd {
  font-size: 0.65rem;
  color: #6b7280;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-weight: 700;
  flex-shrink: 0;
}

/* === Search Results Dropdown === */
.search-results-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 12px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.search-results-dropdown.active {
  display: block;
}

.search-results-dropdown::-webkit-scrollbar {
  width: 4px;
}

.search-results-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 4px;
}

.search-results-header {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  font-weight: 700;
  padding: 10px 14px 6px;
  border-bottom: 1px solid #1f2937;
}

.search-empty {
  padding: 24px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.82rem;
}

.search-empty strong {
  color: #e5e7eb;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.search-result-left {
  flex-shrink: 0;
  padding-top: 2px;
}

.search-subj-icon {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(31, 41, 55, 0.6);
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-term {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  line-height: 1.3;
}

.search-result-def {
  font-size: 0.72rem;
  color: #9ca3af;
  line-height: 1.4;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-path {
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.search-path-badge {
  font-weight: 700;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 0.6rem;
  text-transform: uppercase;
}

.search-result-arrow {
  flex-shrink: 0;
  color: #4b5563;
  font-size: 0.85rem;
  padding-top: 4px;
  transition: color 0.15s;
}

.search-result-item:hover .search-result-arrow {
  color: #10b981;
}
