:root {
  --primary: #d61f26;
  --primary-dark: #a3141a;
  --accent: #d61f26;
  --zalo: #0068ff;
  --text: #222b3a;
  --text-light: #5c6779;
  --bg-light: #fdf1f1;
  --white: #ffffff;
  --radius: 12px;
}

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

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

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

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 40px;
  position: relative;
}
.section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  margin: 12px auto 0;
  border-radius: 2px;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: none;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(214, 31, 38, 0.35);
}
.btn-zalo {
  background: var(--zalo);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(0, 104, 255, 0.35);
}
.btn-large { font-size: 1.05rem; padding: 16px 32px; margin-top: 20px; }

/* Topbar */
.topbar {
  background: var(--primary);
  color: var(--white);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  letter-spacing: 0.3px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.logo-img { height: 56px; width: auto; }

.nav { display: flex; gap: 26px; flex: 1; justify-content: center; }
.nav a { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.nav a:hover { color: var(--primary); }

.nav-zalo { padding: 10px 20px; font-size: 0.9rem; white-space: nowrap; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}
.menu-toggle span { width: 26px; height: 3px; background: var(--text); border-radius: 2px; }

/* Hero */
.hero {
  background: linear-gradient(180deg, #fde3e4 0%, #fdf1f1 100%);
  color: var(--text);
  padding: 100px 0;
  text-align: center;
}
.hero h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 20px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.15rem; color: var(--text-light); margin-bottom: 36px; }
.hero-buttons { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }

/* About */
.about { padding: 90px 0; background: var(--white); }
.about-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 50px; align-items: center; }
.about-photo img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.about-text p { color: var(--text-light); margin-bottom: 16px; }
.about-list { margin-top: 20px; }
.about-list li { margin-bottom: 10px; font-weight: 600; }

/* Courses */
.courses { padding: 90px 0; background: var(--bg-light); }
.course-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.course-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 22px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  transition: transform 0.2s ease;
}
.course-card:hover { transform: translateY(-6px); }
.course-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.course-card h3 { margin-bottom: 10px; font-size: 1.1rem; }
.course-card p { color: var(--text-light); font-size: 0.92rem; margin-bottom: 16px; }
.course-tag {
  display: inline-block;
  background: rgba(214,31,38,0.1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
}

/* Gallery */
.gallery { padding: 90px 0; background: var(--white); }
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.gallery-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-video { max-width: 640px; margin: 0 auto; }
.gallery-video video {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Tuition */
.tuition { padding: 90px 0; background: var(--primary); }
.tuition .section-title { color: var(--white); }
.tuition .section-title::after { background: var(--white); }
.tuition-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.tuition-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.tuition-card strong { display: block; font-size: 1.6rem; color: var(--primary); margin-bottom: 6px; }
.tuition-card span { color: var(--text-light); font-size: 0.92rem; }
.tuition-note { text-align: center; margin-top: 24px; color: rgba(255,255,255,0.9); font-size: 0.9rem; }

/* Testimonials */
.testimonials { padding: 90px 0; background: var(--white); }
.testimonial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.testimonial-card {
  position: relative;
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 32px 24px 28px;
  padding-top: 44px;
}
.testimonial-card::before {
  counter-increment: reason;
  content: counter(reason);
  position: absolute;
  top: -18px;
  left: 24px;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: var(--white);
  font-weight: 800;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.testimonial-grid { counter-reset: reason; }
.testimonial-card p { color: var(--text); font-weight: 600; }

/* Contact */
.contact { padding: 90px 0; background: var(--bg-light); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: start; }
.contact-info p { color: var(--text-light); margin-bottom: 20px; }
.contact-details li { margin-bottom: 12px; font-weight: 600; }
.contact-address-photo {
  margin-top: 26px;
  max-width: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.contact-address-photo img { width: 100%; display: block; }

.contact-form {
  background: var(--white);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.contact-form h3 { margin-bottom: 6px; }
.contact-form input,
.contact-form select,
.contact-form textarea {
  padding: 13px 16px;
  border: 1px solid #dbe2ee;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.contact-form button { margin-top: 6px; }
.form-success {
  display: none;
  color: #1a8f4c;
  font-weight: 600;
  text-align: center;
}
.form-success.show { display: block; }

/* Footer */
.footer { background: #22090b; color: #e8c9ca; padding: 50px 0 24px; text-align: center; }
.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 14px;
}
.footer-logo-img { height: 44px; width: auto; }
.footer-social { display: flex; justify-content: center; gap: 22px; margin: 18px 0; }
.footer-social a { font-weight: 600; }
.footer-social a:hover { color: var(--white); }
.footer-copy { margin-top: 16px; font-size: 0.85rem; opacity: 0.7; }

/* Floating Zalo button */
.zalo-float {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 58px;
  height: 58px;
  background: var(--zalo);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 6px 20px rgba(0,104,255,0.45);
  z-index: 200;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,104,255,0.5); }
  70% { box-shadow: 0 0 0 14px rgba(0,104,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,104,255,0); }
}

/* Responsive */
@media (max-width: 900px) {
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .course-grid, .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .testimonial-grid, .tuition-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 18px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
    display: none;
  }
  .nav.open { display: flex; }
  .menu-toggle { display: flex; }
  .nav-zalo { display: none; }
  .hero h1 { font-size: 1.9rem; }
  .course-grid, .gallery-grid { grid-template-columns: 1fr; }
}

/* Account box (login/logout in header) */
.account-box { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.account-box span { font-weight: 600; font-size: 0.9rem; color: var(--text-light); }
.xp-badge {
  background: rgba(214,31,38,0.1);
  color: var(--primary) !important;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700 !important;
}

/* Leaderboard */
.leaderboard-me td { background: rgba(214,31,38,0.08); font-weight: 700; color: var(--primary); }

/* Reward redemption */
.xp-earned { text-align: center; font-size: 1.4rem; font-weight: 800; color: var(--primary); margin-bottom: 20px; }
.reward-message { text-align: center; font-weight: 600; margin-bottom: 20px; min-height: 1.2em; }
.reward-message-success { color: #1a8f4c; }
.reward-message-error { color: #c0392b; }

/* Auth pages (login / register) */
.auth-section { padding: 70px 0; background: var(--bg-light); min-height: 60vh; }
.auth-container { display: flex; justify-content: center; }
.auth-form {
  background: var(--white);
  padding: 40px 36px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form h2 { text-align: center; }
.auth-subtitle { text-align: center; color: var(--text-light); font-size: 0.92rem; margin-bottom: 6px; }
.auth-form input {
  padding: 13px 16px;
  border: 1px solid #dbe2ee;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.auth-message { text-align: center; font-weight: 600; font-size: 0.9rem; min-height: 1.2em; }
.auth-message-error { color: #c0392b; }
.auth-message-success { color: #1a8f4c; }
.auth-switch { text-align: center; font-size: 0.9rem; color: var(--text-light); }
.auth-switch a { color: var(--primary); font-weight: 700; }

/* Tests list */
.tests-section { padding: 70px 0; min-height: 60vh; }
.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.test-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.test-card h3 { margin-bottom: 10px; }
.test-card p { color: var(--text-light); font-size: 0.92rem; margin-bottom: 14px; }
.test-card .course-tag { display: inline-block; margin-bottom: 18px; }
.test-card .btn { display: block; }

/* Taking a test */
.question-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.passage-box {
  background: var(--bg-light);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  color: var(--text-light);
  line-height: 1.7;
}
.question-image {
  max-width: 320px;
  margin: 0 auto 16px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.question-text { font-weight: 700; margin-bottom: 12px; white-space: pre-line; }
.option-label {
  display: block;
  padding: 10px 14px;
  border: 1px solid #eaeef5;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.option-label:hover { border-color: var(--primary); }
.option-label input { margin-right: 10px; }
.fill-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dbe2ee;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

/* Result */
.result-box { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.result-box h2 { text-align: center; margin-bottom: 20px; color: var(--primary); }
.result-list { margin-bottom: 24px; }
.result-correct { color: #1a8f4c; font-weight: 600; margin-bottom: 8px; }
.result-wrong { color: #c0392b; font-weight: 600; margin-bottom: 8px; }

/* History table */
.history-table-wrap { overflow-x: auto; }
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.history-table th, .history-table td {
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid #eaeef5;
}
.history-table th { background: var(--primary); color: var(--white); }
.history-table tr:last-child td { border-bottom: none; }

@media (max-width: 900px) {
  .test-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .test-grid { grid-template-columns: 1fr; }
  .account-box { flex-direction: column; gap: 6px; }
}
