/* =======================================================
// === STYLES.CSS PHIÊN BẢN CUỐI CÙNG, ĐÃ SỬA LỖI HIỂN THỊ ===
// ======================================================= */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --light: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 12px;
  }
  
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  
  body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
  }
  
  .container {
    display: flex;
    max-width: 1400px;
    margin: 20px auto;
    gap: 20px;
    padding: 0 20px;
    transition: all 0.3s ease;
  }
  
  /* ===== TOP BAR ===== */
  .top-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky; top: 0; z-index: 100;
  }
  .top-bar a { color: var(--primary); text-decoration: none; margin-right: 20px; font-weight: 600; transition: color 0.3s ease; }
  .top-bar a:hover { color: var(--primary-dark); }
  
  
  /* ===== SIDEBAR ===== */
  .sidebar {
    width: 320px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    height: fit-content;
    position: sticky; top: 100px;
    transition: all 0.3s ease;
  }
  .sidebar h3 { color: var(--primary); margin-bottom: 20px; font-size: 18px; }
  
  .category-group { margin-bottom: 16px; }
  .category-header { padding: 12px 16px; background: var(--light); border-radius: 8px; cursor: pointer; font-weight: 600; border: 2px solid transparent; transition: all 0.3s ease; }
  .category-header:hover { background: var(--primary); color: white; }
  .links-container { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; background: #f9fafb; border-radius: 0 0 8px 8px; }
  .category-group.open .links-container { max-height: 500px; padding: 8px 0; }
  .quiz-link { display: block; padding: 10px 20px; color: var(--text-secondary); text-decoration: none; border-left: 3px solid transparent; transition: all 0.3s ease; }
  .quiz-link:hover { background: rgba(59, 130, 246, 0.1); color: var(--primary); border-left-color: var(--primary); }
  .quiz-link.active { background: rgba(59, 130, 246, 0.15); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
  
  #sidebar-open-btn { position: absolute; top: 16px; left: 16px; z-index: 10; background: var(--primary); color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: all 0.3s ease; }
  #sidebar-open-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
  
  
  /* ===== MAIN CONTENT ===== */
  .main-content { flex: 1; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .quiz-header { padding: 32px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; text-align: center; position: relative; }
  .quiz-title { font-size: 28px; margin-bottom: 8px; font-weight: 700; }
  .quiz-subtitle { font-size: 16px; opacity: 0.9; }
  .quiz-content { padding: 32px; max-height: 70vh; overflow-y: auto; }
  .quiz-content::-webkit-scrollbar { width: 8px; }
  .quiz-content::-webkit-scrollbar-track { background: var(--light); border-radius: 4px; }
  .quiz-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
  .quiz-content::-webkit-scrollbar-thumb:hover { background: var(--secondary); }
  
  
  /* ===== VIEW MODE & NAVIGATION ===== */
  .view-mode-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 16px; background: var(--light); border-radius: var(--radius); border: 1px solid var(--border); }
  .view-mode-label { font-weight: 600; color: var(--text-secondary); }
  .view-mode-text { font-weight: 600; color: var(--primary-dark); min-width: 70px; }
  .view-mode-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
  .view-mode-switch input { opacity: 0; width: 0; height: 0; }
  .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 28px; }
  .slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
  input:checked + .slider { background-color: var(--primary); }
  input:checked + .slider:before { transform: translateX(22px); }
  
  .navigation-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; margin-top: 24px; padding: 16px; background: var(--light); border-radius: var(--radius); border: 1px solid var(--border); }
  .nav-button { padding: 10px 20px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; transition: all 0.3s ease; background: var(--primary); color: white; }
  .nav-button:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-2px); }
  .nav-button:disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; }
  .progress-container { text-align: center; }
  .progress-text { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
  .progress-bar-background { width: 100%; height: 8px; background-color: var(--border); border-radius: 4px; overflow: hidden; }
  .progress-bar-foreground { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.4s ease; }
  
  
  /* ===== QUESTION CARD ===== */
  .question-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); position: relative; transition: all 0.3s ease; }
  .question-card:hover { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); transform: translateY(-2px); }
  .question-number { position: absolute; top: -12px; left: 24px; background: var(--primary); color: white; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
  .question-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; padding-top: 8px; }
  .question-description { margin-bottom: 20px; line-height: 1.7; color: var(--text-secondary); }
  .question-description img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); margin: 12px 0; }
  .question-score { margin-top: 16px; padding: 12px 16px; background: var(--light); border-radius: 8px; font-weight: 600; text-align: center; border: 1px solid var(--border); }
  
  /* Choices */
  .choices { margin-top: 20px; }
  .choice-option { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; cursor: pointer; transition: all 0.3s ease; }
  .choice-option:hover { border-color: var(--primary); background: rgba(59, 130, 246, 0.05); }
  .choice-option input[type="radio"], .choice-option input[type="checkbox"] { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); }
  .choice-text { flex: 1; line-height: 1.6; }
  
  /* Eval Question */
  .eval-question { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
  .eval-question-text { margin-bottom: 12px; line-height: 1.6; }
  .eval-buttons { display: flex; gap: 12px; }
  .eval-button { flex: 1; padding: 10px 16px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; text-align: center; font-weight: 600; transition: all 0.3s ease; }
  .eval-button input { display: none; }
  .eval-button.true-btn:hover { border-color: var(--success); background: rgba(16, 185, 129, 0.1); color: var(--success); }
  .eval-button.false-btn:hover { border-color: var(--danger); background: rgba(239, 68, 68, 0.1); color: var(--danger); }
  .eval-button.selected.true-btn { background: var(--success); border-color: var(--success); color: white; }
  .eval-button.selected.false-btn { background: var(--danger); border-color: var(--danger); color: white; }
  
  /* Fill Input */
  .fill-input { width: 100%; padding: 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 16px; transition: all 0.3s ease; }
  .fill-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
  
  
  /* ===== QUIZ CONTROLS (FOOTER) ===== */
  .quiz-controls { padding: 24px 32px; background: var(--light); border-top: 1px solid var(--border); display: flex; justify-content: center; align-items: center; gap: 20px; }
  .grade-button { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; border: none; padding: 16px 32px; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.3s ease; box-shadow: var(--shadow); }
  .grade-button:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(59, 130, 246, 0.3); }
  .score-display { padding: 16px 24px; background: var(--success); color: white; border-radius: 12px; font-size: 16px; font-weight: 700; box-shadow: var(--shadow); animation: pulse 2s infinite; }
  @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
  
  
  /* =======================================================
  // === ANSWER DISPLAY STYLES (PHIÊN BẢN SỬA LỖI) ===
  // ======================================================= */
  
  /* --- Nền cho card câu hỏi chung --- */
  .question-card.correct {
    border-left: 6px solid var(--success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.question-card.wrong {
    border-left: 6px solid var(--danger);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- Hiển thị cho câu MCQ và Multi --- */
.choice-option.user-wrong-choice {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--danger) !important;
    font-weight: bold;
}
.choice-option.actual-correct-choice {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: var(--success) !important;
    font-weight: bold;
}
  
  /* --- Hiển thị cho câu Eval (Cải tiến lớn) --- */
  .eval-button {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
.eval-button.selected.true-btn {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
}
.eval-button.selected.false-btn {
    background: linear-gradient(135deg, var(--danger) 0%, #f87171 100%);
}

/* --- Hiển thị cho câu Fill (Cải tiến lớn) --- */
.fill-input:focus {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}
.fill-input.fill-input-correct {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.1) 100%);
}
.fill-input.fill-input-wrong {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.1) 100%);
}
  .eval-button.actual-correct-choice {
      border: 2px solid var(--success) !important;
      background: rgba(16, 185, 129, 0.1) !important;
      color: var(--success) !important;
  }
  .eval-button.actual-correct-choice::before {
      content: '✓'; font-weight: bold; margin-right: 6px;
  }
  .eval-button.user-wrong-choice {
      border: 2px solid var(--danger) !important;
      background: rgba(239, 68, 68, 0.1) !important;
      color: var(--danger) !important;
      text-decoration: line-through;
  }
  .eval-button.user-wrong-choice::before {
      content: '✗'; font-weight: bold; margin-right: 6px;
  }
  
  /* --- Hiển thị cho câu Fill (Cải tiến lớn) --- */
  .fill-input.fill-input-correct {
    border-color: var(--success) !important;
    background-color: rgba(16, 185, 129, 0.05) !important;
    color: var(--success);
  }
  .fill-input.fill-input-wrong {
    border-color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
    color: var(--danger);
  }
  .correct-answer-text {
      margin-top: 12px; padding: 12px 16px;
      background-color: rgba(16, 185, 129, 0.1);
      border: 1px solid var(--success);
      border-radius: 8px; color: var(--success);
      font-size: 15px; font-weight: 500;
  }
  
  /* --- Vô hiệu hóa hiệu ứng sau khi chấm điểm --- */
  .question-card input[disabled] { cursor: not-allowed; }
  .question-card label, .question-card .choice-option:hover { cursor: default; transform: none; box-shadow: none; }
  .eval-button:hover { transform: none; }
  
  
  /* ===== UTILITIES & STATES ===== */
  .empty-state, .loading-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
  .loading-state { color: var(--primary); }
  .fade-in { animation: fadeIn 0.6s ease-out forwards; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
  
  
  /* ===== RESPONSIVE DESIGN ===== */
  @media (max-width: 1024px) {
    .container { flex-direction: column; padding: 0 16px; }
    .sidebar { width: 100%; position: relative; top: 0; margin-bottom: 20px; }
    .quiz-content { max-height: none; }
  }
  @media (max-width: 768px) {
    .container { margin: 10px auto; padding: 0 12px; }
    .quiz-content, .quiz-header, .question-card { padding: 16px; }
    .quiz-title { font-size: 22px; }
    .eval-buttons, .navigation-controls { flex-direction: column; gap: 12px; }
    .nav-button { width: 100%; }
  }
