/* ===== BACKGROUND ===== */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #ec4899;
  --bg-gradient: linear-gradient(135deg, #f0f4f8, #d9e2ec);
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #102a43;
  --text-muted: #627d98;
  --border-color: #bcccdc;
}

html, body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ===== GLOBAL TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  text-wrap: balance;
  word-break: normal;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(26px, 5vw, 40px);
  line-height: 1.2;
}

h2 {
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1.3;
}

.page-title,
.article-title {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  line-height: 1.2;
  text-wrap: balance;
}

/* ===== CARD ===== */
#loginBox{
background:#ffffff;
padding:40px 35px;
width:100%;
max-width:420px;
border-radius:20px;
box-shadow:0 20px 40px rgba(0,0,0,0.2);
text-align:center;
animation:fadeIn 0.5s ease;
}

/* ===== TITLE ===== */
#loginBox h2{
margin-bottom:25px;
font-size:26px;
font-weight:600;
color:#222;
}

/* ===== INPUT ===== */
#passwordInput{
width:100%;
padding:15px;
border-radius:14px;
border:1px solid #ddd;
font-size:16px;
outline:none;
transition:0.3s;
box-sizing:border-box;
}

#passwordInput:focus{
border-color:#4e73df;
box-shadow:0 0 0 3px rgba(78,115,223,0.15);
}

/* ===== BUTTON ===== */
.primary-btn{
margin-top:25px;
width:100%;
padding:15px;
border:none;
border-radius:14px;
font-size:16px;
font-weight:600;
cursor:pointer;
background:linear-gradient(135deg,#4e73df,#224abe);
color:white;
transition:0.3s;
}

.primary-btn:hover{
transform:translateY(-2px);
box-shadow:0 8px 20px rgba(34,74,190,0.3);
}


/* ===== ERROR ===== */
#errorText{
margin-top:15px;
font-size:14px;
color:#e74a3b;
display:none;
}

/* ===== ANIMATION ===== */
@keyframes fadeIn{
from{opacity:0;transform:translateY(15px);}
to{opacity:1;transform:translateY(0);}
}

/* ===== BUTTON CHUNG ===== */
button {
  padding: 12px 24px;
  margin: 6px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.3px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  touch-action: manipulation;
}

/* Hover nổi */
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Khi bấm */
button:active {
  transform: scale(0.97);
}

/* ===== NÚT CHÍNH (Trang chủ) ===== */
.primary-btn {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
  width: 100%;
  margin: 8px 0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

.primary-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.35);
}

/* ===== NÚT PHỤ ===== */
.secondary-btn {
  background: #f1f5f9;
  color: #334155;
}

.secondary-btn:hover {
  background: #e2e8f0;
}

/* ===== NÚT THOÁT ===== */
.danger-btn {
  background: #ef4444;
  color: white;
}

.danger-btn:hover {
  background: #dc2626;
}

.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.exam-container-wrapper {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

/* ===== NEW PAGE LAYOUT CLASSES ===== */
.page-section {
  padding: 20px 0;
}

.content-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* ===== HERO HEADER ===== */
.hero-header {
  text-align: center;
  margin-bottom: 50px;
}
.hero-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.hero-header p {
  color: var(--text-muted);
  font-size: 18px;
  margin: 0 auto;
  max-width: 600px;
  line-height: 1.6;
}

/* ===== EXAM HERO SECTION ===== */
.exam-hero {
    background: linear-gradient(135deg, #0f172a, #1e3a8a, #0ea5e9);
    border-radius: 20px;
    padding: 40px 32px;
    color: white;
    margin: 20px auto 40px;
    max-width: 1000px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    text-align: center;
}

.exam-hero h1 {
    color: white !important;
    font-size: clamp(24px, 4vw, 32px) !important;
    font-weight: 700;
    margin-bottom: 16px;
    border: none !important;
    letter-spacing: -0.5px;
}

.exam-hero p {
    color: rgba(255, 255, 255, 0.85) !important;
    line-height: 1.7;
    margin: 0 auto 32px;
    max-width: 750px;
    font-size: 16px;
}

.exam-hero-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.exam-hero-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px 15px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.exam-hero-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.exam-hero-card i {
    font-size: 24px;
    margin-bottom: 12px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.exam-hero-card .label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
    font-weight: 500;
}

.exam-hero-card .value {
    font-weight: 700;
    font-size: 17px;
    color: white;
}

@media (max-width: 768px) {
    .exam-hero-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .exam-hero {
        padding: 20px 15px;
        margin: 10px;
        border-radius: 12px;
    }
    .exam-hero h1 {
        font-size: 22px !important;
    }
}

/* ===== CATEGORY CARDS ===== */
.category-wrapper {
  margin-bottom: 40px;
}
.category-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.cat-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.cat-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.cat-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 15px;
  background: rgba(79, 70, 229, 0.1);
  width: 90px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: 0.3s;
}

.cat-card:hover .cat-icon {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.cat-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}
.cat-desc {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
  flex-grow: 1;
}

/* Đảm bảo khung thi quiz vẫn hoạt động */
.card {
  background: var(--card-bg);
  width: 100%;
  margin: 20px auto;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.5);
  box-sizing: border-box;
}

/* ===== TÙY CHỌN TRẢ LỜI ĐẸP & MƯỢT ===== */
.option {
  margin: 12px 0;
  padding: 16px 20px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 500;
  background: white;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, color 0.3s ease;
  touch-action: manipulation;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hover */
@media (hover:hover){
  .option:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
    background: #e2e8f0;
  }
}

/* Khi click */
.option:active {
  transform: scale(0.98);
}

/* Đáp án đã chọn (30 câu) */
.selected {
  background: var(--primary) !important;
  color: white !important;
  border-color: #4338ca !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}

.selected::before {
  content: "✓";
  margin-right: 4px;
  font-weight: 700;
}

/* Đúng (500 câu) */
.correct {
  background: #f0fdf4;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  color: #166534;
}

/* Sai (500 câu) */
.wrong {
  background: #fef2f2;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
  color: #991b1b;
}

img {
  max-width: 100%;
  margin: 10px 0;
  border-radius: 12px;
}



/* ===== HEADER 500 CÂU ĐẸP ===== */

.header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255,255,255,0.8);
}

/* RIGHT STATUS */

.right-status {
  text-align: right;
  min-width: 200px;
}

.question-text{
font-size:18px;
font-weight:700;
color:#1a237e;
margin-bottom:8px;
}

/* ===== PROFESSIONAL SEARCH BAR ===== */

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* INPUT WRAP */

.search-input-wrap {
  position: relative;
}

/* ICON */

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #94a3b8;
  pointer-events: none;
}

/* INPUT */

.search-input-wrap input {
  width: 140px;
  height: 44px;
  padding: 0 16px 0 42px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  transition: all 0.3s ease;
  font-family: inherit;
}

/* FOCUS EFFECT */

.search-input-wrap input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* BUTTON */

.goto-btn {
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

/* HOVER */

.goto-btn:hover {
  transform: translateY(-2px);
  background: var(--primary-hover);
  box-shadow: 0 6px 12px -2px rgba(79, 70, 229, 0.3);
}

/* CLICK ZOOM */

.goto-btn:active {
  transform: scale(0.96);
}

/* ===== PROGRESS BAR CLEAN STYLE ===== */

.mini-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 50px;
  overflow: hidden;
  margin-top: 5px;
}

.mini-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 50px;
  transition: width 0.4s ease;
}

/* TEXT */

.question-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 5px;
}

.question-left h3 {
  font-size: 20px;
  line-height: 1.6;
  margin: 0 0 16px 0;
  padding: 0;
  color: var(--text-main);
  font-weight: 600;
  text-wrap: wrap;
}

/* ===== LAYOUT CÂU HỎI ===== */

.question-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-top: 25px;
  animation: fadeIn 0.4s ease forwards;
}

.question-left {
  width: 100%;
  background: white;
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
  border: 1px solid #f1f5f9;
}

/* ===== ĐÁP ÁN HIỂN THỊ 2 CỘT ===== */

.question-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Responsive */
@media(max-width:900px) {
  .question-layout {
    flex-direction: column;
  }
}

/* ===== ẢNH CÂU HỎI TO HƠN ===== */

.question-left img {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
  margin: 20px auto 0;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  background: white;
  padding: 8px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* Hover nhẹ cho đẹp */
.question-left img:hover {
  transform: scale(1.03);
}


.shake{
animation:shake 0.4s;
}

@keyframes shake{
0%{transform:translateX(0)}
25%{transform:translateX(-5px)}
50%{transform:translateX(5px)}
75%{transform:translateX(-5px)}
100%{transform:translateX(0)}
}

/* ===== NAV BUTTONS CENTER ===== */

.nav-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}


/* ===== HEADER MENU ===== */

header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 15px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.3);
}

.nav-container {
  width: 92%;
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

nav.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

/* Dropdown styling */
nav.main-nav .dropdown {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

nav.main-nav .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: white;
  min-width: 200px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
}

nav.main-nav .dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

nav.main-nav .dropdown-menu a {
  padding: 12px 20px;
  color: var(--text-main);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
  display: block;
}

nav.main-nav .dropdown-menu a:hover {
  background: #f8fafc;
  color: var(--primary);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-main);
  cursor: pointer;
  padding: 5px;
  margin: 0;
  box-shadow: none;
  position: relative;
  z-index: 101;
  pointer-events: auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}
.menu-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
  box-shadow: none;
  transform: none;
  border-radius: 8px;
}

/* ===== MOBILE BREAKPOINTS ===== */
/* Mobile drawer & overlay styles are in css/nav-popup.css */
@media (max-width: 800px) {
  nav.main-nav {
    display: none !important;
  }
  .menu-toggle {
    display: flex !important;
  }
}
@media (min-width: 801px) {
  .mobile-menu {
    display: none !important;
  }
}

.footer {
  margin-top: 80px;
  padding: 40px 20px;
  text-align: center;
  background: linear-gradient(135deg, #0f2027, #2c5364);
  color: #ddd;
  font-size: 14px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.footer-links a {
  color: #b084ff;
  text-decoration: none;
  font-weight: 500;
  transition: 0.3s;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-divider {
  color: #627d98;
}

.footer p {
  margin-top: 15px;
  line-height: 1.6;
}


/* ===== ARTICLE SECTION (LEARNING SECTION) ===== */
.article-section {
  max-width: 1200px;
  margin: 20px auto 60px;
  padding: 0 20px;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 8px;
}

/* CAROUSEL */
.carousel-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 30px;
  gap: 15px;
}

.carousel-wrapper {
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
  gap: 20px;
  padding: 10px 0;
}

.article-card {
  background: white;
  color: var(--text-main);
  padding: 24px;
  border-radius: 20px;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
  transition: all 0.25s ease;
  display: flex !important;
  flex-direction: column;
  box-sizing: border-box;
  text-align: left;
  height: 100% !important;
  min-height: 350px; /* Forced equal size */
}

.article-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.card-icon {
  font-size: 26px;
  color: var(--primary);
  background: #f5f3ff;
  width: 56px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  margin-bottom: 16px;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.article-card:hover .card-icon {
  background: var(--primary);
  color: white;
}

.article-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 12px 0;
  line-height: 1.4;
  /* Multi-line clamp for titles (2 lines max) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 58px; /* Consistent starting point for description */
}

.article-card p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 20px 0;
  /* Multi-line clamp for description (2 lines max) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1; /* Not needed with margin-top: auto on CTA but kept for safety */
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 700;
  font-size: 17px;
  margin-top: auto; /* Pushes CTA to the very bottom */
  transition: all 0.25s ease;
}

.card-cta i {
  transition: transform 0.25s ease;
}

.article-card:hover .card-cta {
  color: #3b39d1; /* Stronger accent on hover */
}

.article-card:hover .card-cta i {
  transform: translateX(5px);
}

.carousel-btn {
  background: white;
  border: 1px solid #f1f5f9;
  color: var(--text-main);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
  transition: all 0.25s ease;
  font-size: 20px;
}

.carousel-btn:hover {
  background: white;
  color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

@media (max-width: 768px) {
  .article-section {
    margin-top: 10px;
    margin-bottom: 40px;
  }
  .carousel-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
}

/* MEDIA QUERIES FOR MOBILE */
@media (max-width: 768px) {
  .carousel-wrapper {
    overflow: hidden;
    width: 100%;
  }

  .carousel-track {
    display: flex;
    transition: transform 0.4s ease;
    gap: 0;
  }

  .article-card {
    min-width: 100%;
    flex-shrink: 0;
  }

  
  .footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    margin-bottom: 25px;
    text-align: center;
  }
  
  .footer-links a {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    box-sizing: border-box;
  }

  .footer-divider {
    display: none;
  }
  
  /* ===== MOBILE HEADER WRAP FIX ===== */
  .header-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .search-box {
    width: 100%;
    justify-content: space-between;
  }
  
  .search-input-wrap {
    flex-grow: 1;
  }
  
  .search-input-wrap input {
    width: 100%;
    box-sizing: border-box;
  }
  
  .right-status {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: center;
  }
  
  .question-text {
    order: 2;
    margin-top: 8px;
    margin-bottom: 0;
  }
  
  /* Responsive Fixes */
  body {
    font-size: 14px;
  }
  
  .container {
    padding: 0 15px;
    margin: 20px auto;
  }
  
  .hero-header h1 {
    font-size: 26px;
  }
  
  .hero-header p {
    font-size: 15px;
    padding: 0 10px;
  }
  
  button {
    min-height: 48px; /* Touch target size */
  }
  
  .cat-card {
    padding: 20px 15px;
  }
  
  .cat-title {
    font-size: 20px;
  }
  
  .option {
    padding: 14px 15px;
    font-size: 15px;
    min-height: 48px; /* Touch target size */
  }
  
  .mini-progress {
    order: 1;
    width: 100%;
    margin-top: 0;
  }
  
  .card {
    padding: 20px 15px;
    width: 100%;
  }
  
  .container {
    padding: 0 10px;
  }
  
  .question-left {
    padding: 15px;
  }
  .question-layout {
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 18px;
  }
  nav.main-nav a {
    padding: 12px 15px;
  }
}

/* ===== QUESTION NAV BAR ===== */
.q-nav-bar {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 20px;
}
.q-nav-btn {
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  color: #334155;
  transition: 0.2s;
  flex-shrink: 0;
}
.q-nav-btn.answered {
  background: #22c55e;
  color: white;
  border-color: #16a34a;
}
.q-nav-btn.current {
  background: #f59e0b;
  color: white;
  border-color: #d97706;
  transform: scale(1.1);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
/* ===== SEO FOOTER ENHANCEMENTS ===== */
.footer-container { max-width: 1200px; margin: 0 auto; }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px 25px; margin-bottom: 30px; }
.footer-nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; transition: 0.3s; }
.footer-nav a:hover { color: #b084ff; text-decoration: underline; }
.footer-seo-text { max-width: 800px; margin: 0 auto 25px; line-height: 1.8; color: #cbd5e1; font-style: italic; }
.footer-keywords { margin-bottom: 25px; color: #94a3b8; font-size: 13px; border-top: 1px solid rgba(255,255,255,0.1); border-bottom: 1px solid rgba(255,255,255,0.1); padding: 15px 0; }
.footer-keywords span { display: inline-block; margin: 0 5px; }
#visitorStats { margin-bottom: 20px; font-size: 15px; color: #e2e8f0; }
.footer-contact { font-weight: bold; color: #fff; font-size: 16px; margin-bottom: 15px; }
.footer-bottom-links { margin-bottom: 15px; color: #64748b; }
.footer-bottom-links a { color: #94a3b8; text-decoration: none; font-size: 13px; }
.footer-bottom-links a:hover { color: #fff; }
.copyright { margin-top: 10px; color: #475569; font-size: 12px; }

/* ===================================================
   STUDY 600 – ÔN TẬP 600 CÂU
   =================================================== */

/* ---- OVERLAY & MODAL ---- */
.s600-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}
.s600-overlay.s600-active {
  display: flex;
}
.s600-modal {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  width: 100%;
  max-width: 920px;
  margin: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  animation: s600FadeUp 0.35s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes s600FadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.s600-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.s600-modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 4px;
}
.s600-modal-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}
.s600-close-btn {
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: #64748b;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  line-height: 1;
  transition: background 0.2s;
}
.s600-close-btn:hover {
  background: #e2e8f0;
  transform: none;
  box-shadow: none;
}

/* ---- CHAPTERS GRID ---- */
.s600-chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: 1fr; /* Force all cards in a row to have same height */
  gap: 16px;
}

/* ---- CHAPTER CARD ---- */
.s600-chapter-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
  height: 100%;   /* fill grid cell so all cards match height */
  box-sizing: border-box;
}
.s600-chapter-card:hover {
  border-color: var(--ch-color, var(--primary));
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transform: translateY(-3px);
}
.s600-ch-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.s600-ch-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.s600-ch-info { min-width: 0; }
.s600-ch-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.s600-ch-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s600-ch-desc {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.5;
}
.s600-ch-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.s600-ch-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.s600-ch-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.s600-ch-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.s600-stat-done  { color: #16a34a; font-weight: 600; }
.s600-stat-wrong { color: #dc2626; font-weight: 600; }
.s600-stat-pct   { font-weight: 600; margin-left: auto; }
.s600-stat-new   { color: #94a3b8; }
.s600-ch-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin: 0;
  margin-top: auto;   /* always push button to card bottom */
  transition: opacity 0.2s, transform 0.2s;
}
.s600-ch-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: none;
}

/* ---- STUDY PAGE ---- */
.s600-study-wrap {
  min-height: 100vh;
  background: var(--bg-gradient);
}
.s600-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  padding: 12px 24px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.s600-back-btn {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.2s;
}
.s600-back-btn:hover { color: var(--primary-hover); }
.s600-top-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
  flex: 1;
}
.s600-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.s600-chapter-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}
.s600-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* ---- TWO-PANEL LAYOUT ---- */
.s600-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 55px);
}
.s600-left-panel {
  background: rgba(255,255,255,0.9);
  border-right: 1px solid #e2e8f0;
  padding: 20px 14px;
  position: sticky;
  top: 55px;
  max-height: calc(100vh - 55px);
  overflow-y: auto;
}
.s600-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}
.s600-right-panel {
  padding: 40px 60px;
  max-width: none;
  box-sizing: border-box;
}

/* ---- QUESTION GRID ---- */
.s600-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.s600-grid-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  margin: 0;
  padding: 0;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.s600-grid-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f0ff;
  transform: scale(1.1);
  box-shadow: none;
}
.s600-grid-current {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary-hover) !important;
  transform: scale(1.12);
  box-shadow: 0 4px 8px rgba(79,70,229,0.3) !important;
}
.s600-grid-correct {
  background: #dcfce7 !important;
  border-color: #22c55e !important;
  color: #15803d !important;
}
.s600-grid-wrong {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
.s600-grid-critical {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 700 !important;
  border-width: 2px !important;
  position: relative;
}
.s600-grid-critical::after {
  content: '⚠️';
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 8px;
  background: #f59e0b;
  color: white;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid white;
}
.s600-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
}
.s600-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.s600-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.dot-current  { background: var(--primary); }
.dot-correct  { background: #22c55e; }
.dot-wrong    { background: #ef4444; }
.dot-critical { background: #d97706; }

/* ---- QUESTION CONTENT ---- */
.s600-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}
.s600-q-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.s600-q-index {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(79,70,229,0.08);
  padding: 4px 12px;
  border-radius: 20px;
}
.s600-q-id {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}
/* "Câu X:" prefix in question text */
.s600-q-num {
  font-size: 15px;
  font-weight: 700;
  color: #4f46e5;
  margin-right: 4px;
  white-space: nowrap;
}
/* Critical badge — standalone pill */
.s600-critical-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid #f59e0b;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.15);
  white-space: nowrap;
}
.s600-q-text-critical {
  background: #fffbeb !important;
  border-left: 4px solid #f59e0b !important;
}
.s600-q-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.65;
  margin-bottom: 18px;
  background: #fff;
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}
.s600-q-img-wrap {
  margin-bottom: 18px;
  text-align: center;
}
.s600-q-img-wrap img {
  max-width: 100%;
  max-height: 310px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  background: #fff;
  padding: 8px;
}

/* ---- ANSWERS ---- */
.s600-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.s600-ans-btn {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  margin: 0;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
  line-height: 1.5;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.s600-ans-num {
  font-size: 14px;
  font-weight: 800;
  color: #4f46e5;
  min-width: 22px;
  flex-shrink: 0;
  padding-top: 1px;
}
.s600-ans-text {
  flex: 1;
  text-align: left;
}
@media (hover: hover) {
  .s600-ans-btn:not(.s600-ans-correct):not(.s600-ans-wrong):hover {
    border-color: var(--primary);
    background: #f5f3ff;
    transform: translateX(4px);
  }
  .s600-ans-btn:not(.s600-ans-correct):not(.s600-ans-wrong):hover .s600-ans-num {
    color: var(--primary);
  }
}
.s600-ans-btn:not(.s600-ans-correct):not(.s600-ans-wrong):active {
  transform: scale(0.98);
}
.s600-ans-correct {
  border-color: #22c55e !important;
  background: #f0fdf4 !important;
  color: #166534 !important;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.12) !important;
}
.s600-ans-correct .s600-ans-num { color: #16a34a !important; }
.s600-ans-correct::after { content: ' ✓'; font-weight: 800; margin-left: auto; color: #16a34a; }
.s600-ans-wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important;
}
.s600-ans-wrong .s600-ans-num { color: #dc2626 !important; }
.s600-ans-wrong::after { content: ' ✗'; font-weight: 800; margin-left: auto; color: #dc2626; }

/* ---- EXPLANATION ---- */
.s600-explanation {
  padding: 18px 20px;
  border-radius: 14px;
  margin-bottom: 20px;
  animation: s600FadeUp 0.3s ease forwards;
}
.s600-expl-correct {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1.5px solid #86efac;
}
.s600-expl-wrong {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1.5px solid #fcd34d;
}
.s600-expl-header {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}
.s600-expl-body {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
}
.s600-expl-critical-wrong {
  background: linear-gradient(135deg, #fff1f2, #fffbeb);
  border: 2px solid #f43f5e;
}
.s600-expl-critical-wrong .s600-expl-header {
  color: #e11d48;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.s600-expl-critical-correct {
  background: linear-gradient(135deg, #f0fdf4, #fffbeb);
  border: 2px solid #22c55e;
}
.s600-expl-critical-correct .s600-expl-header {
  color: #15803d;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- NAV BUTTONS ---- */
.s600-nav-btns {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  margin-bottom: 120px; /* Increased to avoid overlap with floating feedback widget */
  border-top: 1px solid #e2e8f0;
}
.s600-nav-btn {
  padding: 13px 32px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  margin: 0;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}
.s600-nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: #f5f3ff;
}
.s600-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.s600-nav-next {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.s600-nav-next:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .s600-layout { grid-template-columns: 1fr; }
  .s600-left-panel {
    position: static;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 14px;
    margin-bottom: 10px;
  }
  .s600-right-panel { padding: 12px 14px; max-width: 100%; }
  .s600-q-text { font-size: 15px; padding: 12px 14px; margin-bottom: 12px; }
  .s600-q-num { font-size: 14px; }
  .s600-chapter-name { max-width: 180px; }
  .s600-chapters-grid { grid-template-columns: 1fr; }
  .s600-modal { padding: 20px; border-radius: 16px; }
  .s600-nav-btns {
    flex-direction: row;
    gap: 10px;
    margin-bottom: 80px;
    padding-top: 15px;
  }
  .s600-ans-btn { padding: 10px 12px; font-size: 14px; gap: 8px; }
}
@media (max-width: 480px) {
  .s600-grid-btn { width: 30px; height: 30px; font-size: 9px; }
  .s600-top-bar { padding: 10px 12px; }
  .s600-nav-btn { padding: 12px 10px; font-size: 13px; }
  .s600-q-text { font-size: 15px; padding: 12px 14px; }
  .s600-ans-btn { padding: 11px 12px; font-size: 14px; gap: 10px; }
  .s600-right-panel { padding: 14px 12px; }
  .s600-nav-btns { margin-bottom: 150px; }
}
/* ===== FOOTER STICKY LAYOUT (FLEXBOX) ===== */
.exam-page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.exam-page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  .s600-nav-btns { margin-bottom: 30px !important; }
}
