/* ==========================================================================
   LAYOUT — header, hero, sticky CTA bar, popup, floating contact, footer
   ========================================================================== */

/* ---------- Header cố định ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 900;
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-logo img { height: 42px; width: auto; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink-2);
  border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.site-nav a:hover { color: var(--red); background: var(--red-soft); }
.site-nav .nav-divider { width: 1px; height: 26px; background: var(--line); }

.header-cta { padding: 11px 22px; font-size: 14px; }
/* Vùng chạm tối thiểu 44x44 theo chuẩn iOS/Android */
.nav-toggle {
  display: none;
  font-size: 26px;
  color: var(--red);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1080px) {
  .site-nav { display: none; }
  .nav-toggle { display: inline-flex; }
  /* Menu mobile xổ xuống dưới header */
  .site-nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: var(--header-h); left: 0; right: 0;
    background: #fff;
    padding: 10px;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .site-nav.is-open a { text-align: left; padding: 12px 14px; }
  .site-nav .nav-divider { display: none; }
  .header-cta { display: none; }
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  margin-top: var(--header-h);
  padding-block: 60px 72px;
  /* Nửa trái là MÀU PHẲNG #BE1E2D nguyên bản — đây là vùng mắt đọc ra màu thương hiệu.
     Chỉ nửa phải mới chuyển mờ dần để lộ ảnh lớp học, tạo chiều sâu. */
  background-color: var(--red);
  background-image:
    linear-gradient(100deg,
      var(--red) 0%,
      var(--red) 46%,
      rgba(190, 30, 45, .88) 68%,
      rgba(35, 31, 32, .80) 100%),
    url('../img/class-1.jpg');
  background-size: auto, cover;
  background-position: center, center right;
  background-repeat: no-repeat;
  color: #fff;
  overflow: hidden;
}
/* Dải 3 màu cờ Đức — đặt ở đáy header (nền trắng) chứ không phải đỉnh hero.
   Trên nền hero đỏ thì đoạn đỏ của dải trùng màu nền, nhìn như bị thủng một khúc. */
.site-header::after {
  content: '';
  position: absolute;
  inset: auto 0 -5px 0;
  height: 5px;
  background: linear-gradient(90deg, #231f20 0 33.3%, #be1e2d 33.3% 66.6%, #ffda00 66.6% 100%);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 48px;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .3);
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero h1 { color: #fff; text-shadow: 0 2px 16px rgba(0, 0, 0, .3); }
.hero h1 .hl { color: var(--gold); }
.hero-sub {
  font-size: clamp(16px, 1.6vw, 19px);
  color: rgba(255, 255, 255, .92);
  max-width: 600px;
  margin-bottom: 26px;
}

/* 4 điểm nhanh dưới sub-headline */
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; padding: 0; list-style: none; }
.hero-facts li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hero-note { font-size: 13.5px; color: rgba(255, 255, 255, .78); margin: 16px 0 0; }

/* ---------- Khối countdown + đếm suất (cột phải hero) ---------- */
.offer-box {
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: var(--shadow-lg);
  border-top: 6px solid var(--gold);
  text-align: center;
}
.offer-box h3 { font-size: 20px; color: var(--red); margin-bottom: 4px; }
.offer-box .offer-price {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 18px;
}
.offer-box .offer-price s { opacity: .75; }
.offer-box .offer-price b { color: var(--red); font-size: 20px; }

.offer-deadline {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.countdown-unit {
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 10px 4px;
}
.countdown-unit b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown-unit span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }

/* Thanh tiến trình số suất còn lại */
.slots { margin-bottom: 18px; text-align: left; }
.slots-label { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-bottom: 7px; }
.slots-label i { font-style: normal; color: var(--red); }
.slots-track { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.slots-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); border-radius: 999px; }

.offer-gifts { list-style: none; padding: 0; margin: 18px 0 0; text-align: left; font-size: 14px; }
.offer-gifts li { display: flex; gap: 9px; padding: 5px 0; border-top: 1px dashed var(--line); }
.offer-gifts li:first-child { border-top: 0; }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding-block: 42px 54px; }
}

/* ---------- Thanh CTA cố định dưới cùng ---------- */
.sticky-bar {
  position: fixed;
  inset: auto 0 0 0;
  min-height: var(--stickybar-h);
  background: var(--red);
  color: #fff;
  z-index: 880;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .2);
}
.sticky-bar .container {
  min-height: var(--stickybar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-block: 10px;
  /* Đẩy nội dung lên khỏi vạch home indicator của iPhone */
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.sticky-bar .gift-text { font-size: 15px; font-weight: 700; line-height: 1.4; }
.sticky-bar .gift-text b { color: var(--gold); }
.sticky-bar .btn { padding: 12px 28px; }

/* Bản chữ rút gọn, chỉ dùng cho màn hình hẹp */
.gift-text .gt-short { display: none; }

@media (max-width: 760px) {
  :root { --stickybar-h: 104px; }
  .sticky-bar .container { flex-direction: column; gap: 7px; text-align: center; }
  .sticky-bar .gift-text { font-size: 13.5px; line-height: 1.35; }
  .sticky-bar .btn { padding: 11px 24px; font-size: 15px; }
  /* Câu dài gây xuống 3 dòng trên máy nhỏ — đổi sang câu ngắn */
  .gift-text .gt-long { display: none; }
  .gift-text .gt-short { display: inline; }
}

/* ---------- Nút liên hệ nổi bên phải ---------- */
.floating-contact {
  position: fixed;
  right: 16px;
  bottom: calc(var(--stickybar-h) + 16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 870;
}

/* Trên điện thoại, 3 nút này xếp ngang và nằm đúng chỗ nút CTA vàng của hero,
   che mất chữ. Nên ẩn đi khi còn ở hero, chỉ hiện khi đã cuộn qua.
   Lớp .js-fab chỉ được JS gắn vào — nếu JS lỗi thì nút vẫn hiện bình thường. */
.js-fab .floating-contact {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s;
}
.js-fab .floating-contact.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.floating-contact a {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 24px;
  transition: transform .18s ease;
}
.floating-contact a:hover { transform: scale(1.08); }
.floating-contact .fc-messenger { background: #0084ff; color: #fff; }
.floating-contact .fc-phone { background: #16a34a; color: #fff; }
.floating-contact .fc-zalo { background: #0068ff; color: #fff; font-size: 15px; font-weight: 800; }

@media (max-width: 640px) {
  /* Xếp ngang thay vì dọc: cột dọc cao 160px đè lên nội dung giữa màn hình,
     hàng ngang chỉ chiếm một dải mỏng ngay trên thanh CTA. */
  .floating-contact { flex-direction: row; gap: 10px; left: 16px; justify-content: flex-end; }
  .floating-contact a { width: 46px; height: 46px; font-size: 21px; }
}

/* ---------- Popup đăng ký ---------- */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 31, 32, .72);
  display: none;
  align-items: center;
  justify-content: center;
  /* Chừa vùng an toàn để nút đóng và nút gửi không bị tai thỏ/home indicator che */
  padding:
    calc(20px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.popup-overlay.is-open { display: flex; }
.popup {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 6px solid var(--red);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
  margin: auto;
}
.popup h3 {
  text-align: center;
  color: var(--red);
  font-size: clamp(20px, 3vw, 27px);
  text-transform: uppercase;
  margin-bottom: 6px;
  /* Chừa hai bên để tiêu đề không chui xuống dưới nút đóng khi xuống dòng */
  padding-inline: 30px;
}
.popup .popup-sub { text-align: center; color: var(--muted); font-size: 14.5px; margin-bottom: 20px; }
.popup-close {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
  min-width: 44px;
  min-height: 44px;
}

/* Màn hình hẹp: thu gọn padding để popup vừa khung, chữ không bị tràn */
@media (max-width: 420px) {
  .popup { padding: 30px 20px 22px; border-width: 4px; }
  .popup h3 { font-size: 19px; }
  .popup .popup-sub { font-size: 13.5px; }
}

/* Màn hình THẤP (iPhone SE, máy cũ, hoặc khi bàn phím đẩy khung nhìn lên):
   nén popup để nút gửi nằm trong tầm nhìn, không phải cuộn mới thấy.
   Cỡ chữ ô nhập vẫn giữ 16px — hạ xuống là iPhone tự phóng to trang. */
@media (max-height: 680px) {
  .popup { padding: 22px 18px 16px; }
  .popup h3 { font-size: 17px; margin-bottom: 2px; }
  .popup .popup-sub { font-size: 12.5px; margin-bottom: 12px; }
  .popup .field { margin-bottom: 8px; }
  .popup .field input, .popup .field select { padding: 11px 14px; }
  .popup .btn--lg { padding: 14px 20px; font-size: 16px; }
  .popup-foot { font-size: 11.5px; margin-top: 10px; }
}
.popup-close:hover { color: var(--red); }
.popup-foot { text-align: center; font-size: 13px; color: var(--muted); font-style: italic; margin: 14px 0 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(255, 255, 255, .78); padding-block: 54px 32px; font-size: 14.5px; }
.site-footer h4 { color: #fff; font-size: 16px; text-transform: uppercase; margin-bottom: 14px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 40px; }
.footer-logo { background: #fff; border-radius: 12px; padding: 14px 18px; display: inline-block; margin-bottom: 16px; }
.footer-logo img { height: 46px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 5px 0; display: flex; gap: 9px; }
/* Nới vùng chạm cho link hotline/email trong footer */
.site-footer li a { display: inline-block; padding: 6px 0; }
.site-footer a:hover { color: var(--gold); }
.footer-socials { display: flex; gap: 10px; margin-top: 14px; }
.footer-socials a {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  display: grid; place-items: center;
  font-size: 18px;
}
.footer-socials a:hover { background: var(--red); color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  margin-top: 34px;
  padding-top: 20px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, .55);
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr; gap: 28px; } }
