/* css/style.css - Custom styles for taplai.com */

/* ===== Myriad Pro Font ===== */
@font-face {
  font-family: 'MYRIADPRO-REGULAR';
  src: url('../font/MYRIADPRO-REGULAR.woff2') format('woff2'),
       url('../font/MYRIADPRO-REGULAR.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'MYRIADPRO-REGULAR';
  src: url('../font/MYRIADPRO-BOLD.woff2') format('woff2'),
       url('../font/MYRIADPRO-BOLD.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'MYRIADPRO-REGULAR';
  src: url('../font/MYRIADPRO-ITALIC.woff2') format('woff2'),
       url('../font/MYRIADPRO-ITALIC.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: optional;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: 'MYRIADPRO-REGULAR', 'Inter', sans-serif;
  margin: 0;
  padding: 0;
}

/* ===== Container ===== */
.container {
  max-width: 1240px;
}

/* ===== Fade-up animation (global) — chỉ dùng transform/opacity, không phá layout ===== */
.fade-up {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  will-change: opacity, transform;
}
.fade-up.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ===== Khóa ảnh nền section — không bị nhảy khi nội dung bên trong thay đổi ===== */
section .absolute.inset-0 > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* Quan trọng: ảnh không gây reflow ảnh hưởng tới layout cha */
  pointer-events: none;
  user-select: none;
  backface-visibility: hidden;
  transform: translateZ(0); /* ép GPU render => mượt khi scroll */
}

/* Section cha chứa ảnh nền: giữ position relative và cố định transform layer */
section.relative.overflow-hidden {
  transform: translateZ(0);
  will-change: transform;
}

/* Ép container chính có layout ổn định — chống giật khi FAQ mở/đóng */
#faq,
#vi-sao-chon,
#hero,
#bai-viet,
#thi-ly-thuyet {
  /* Bảo đảm section có transform riêng, không ảnh hưởng section khác */
  position: relative;
  z-index: 1;
}

/* ===== Header scroll effect ===== */
#site-header.scrolled {
  background: rgba(0, 31, 78, 0.97) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

/* ===== Mobile menu ===== */
#mobile-menu.mobile-menu-open {
  max-height: 500px !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Hamburger active state */
#hamburger span {
  transition: all 0.3s ease;
  transform-origin: center;
}
#hamburger span.active:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
#hamburger span.active:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
#hamburger span.active:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* ===== Hero form ===== */
#hero-register-form input:focus,
#hero-register-form select:focus {
  box-shadow: 0 0 0 3px rgba(0, 91, 234, 0.15);
  border-color: #005BEA;
}

/* ===== Hero background image: căn giữa-trên trên desktop, căn giữa trên mobile ===== */
.hero-bg-img {
  object-position: center 35%;
  transform: translateZ(0); /* GPU layer — không scale khi scroll */
}
@media (max-width: 1023px) {
  .hero-bg-img {
    object-position: center center;
  }
}

#hero-register-form button[type="submit"] {
  position: relative;
  overflow: hidden;
}
#hero-register-form button[type="submit"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
#hero-register-form button[type="submit"]:hover::after {
  transform: translateX(100%);
}

.hero-form-message {
  transition: all 0.3s ease;
}

/* ===== FAQ Accordion ===== */
.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

/* Loại bỏ reflow khi mở/đóng faq-item: giữ max-height để không gây giật ảnh nền */
.faq-item {
  transition: box-shadow 0.25s ease;
}

/* Khóa mọi phần tử FAQ có backdrop-filter để không repaint liên tục */
.faq-item,
.faq-icon,
#faq-pager .faq-pager-page,
#faq-pager .faq-pager-btn {
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ===== FAQ Highlighted Item (yellow) ===== */
.faq-item-hot {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.faq-item-hot[open] {
  box-shadow: 0 8px 28px -6px rgba(245, 158, 11, 0.3);
}

/* Giữ chiều cao tối thiểu cho mỗi faq-item khi đóng để không gây giật */
details.faq-item > summary {
  min-height: 64px;
}

/* Icon xoay: dùng CSS riêng để control rotation, GPU-accelerated */
.faq-svg {
  transition: transform 0.3s ease;
  transform: translateZ(0) rotate(0deg);
}
details[open] .faq-svg {
  transform: translateZ(0) rotate(180deg);
}
details.faq-item[open] .faq-icon svg {
  transform: translateZ(0) rotate(180deg);
}

/* ===== FAQ Pagination ===== */
.faq-pager-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: #fff;
  border: 1px solid #DCE7F4;
  color: #001F4E;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.75rem;
  transition: all 0.25s ease;
  cursor: pointer;
}
.faq-pager-btn:hover:not(:disabled) {
  background: #F0F6FF;
  border-color: #BCD3F4;
  transform: translateY(-1px);
}
.faq-pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.faq-pager-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  background: #fff;
  border: 1px solid #DCE7F4;
  color: #001F4E;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 0.65rem;
  transition: all 0.25s ease;
  cursor: pointer;
}
.faq-pager-page:hover {
  background: #F0F6FF;
  border-color: #BCD3F4;
}
.faq-pager-page.is-active {
  background: #005BEA;
  border-color: #005BEA;
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(0, 91, 234, 0.55);
}

/* ===== Buttons ===== */
.btn-brand {
  display: inline-block;
  background-color: #FFD43B;
  color: #001F4E;
  padding: 0.75rem 2rem;
  border-radius: 0.75rem;
  font-weight: 700;
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn-brand:hover {
  background-color: #FFC928;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 212, 59, 0.4);
}

.btn-primary {
  display: inline-block;
  background-color: #005BEA;
  color: #fff;
  padding: 0.75rem 2rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background-color: #004FCF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 91, 234, 0.4);
}

.btn-donate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(244, 63, 94, 0.4);
  transition: all 0.25s ease;
}
.btn-donate:hover {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -5px rgba(244, 63, 94, 0.55);
}
.btn-donate i {
  font-size: 1.5rem;
  animation: heartbeat 1.5s infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.85; }
}

/* ===== Vô hiệu hóa hiệu ứng group-hover scale gây giật bố cục =====
   Khi user lướt chuột qua card, hover scale làm ảnh nền section cha bị reflow.
   Tailwind utility "group-hover:scale-X" sinh ra selector .group:hover .group-hover\:scale-X { transform: ... }
   Ta override bằng !important để hover không còn scale ngoài. */
.group:hover [class*="group-hover\\:scale-"],
.group:hover img[class*="group-hover"] {
  --tw-scale-x: 1 !important;
  --tw-scale-y: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* Pulse/sparkle ổn định */
[class*="animate-"] {
  will-change: transform;
}

/* Riêng hero-bg-img (phía dưới overlay) vẫn giữ transform GPU */
.hero-bg-img {
  transform: translateZ(0) !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ===== Swiper for testimonials ===== */
.swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  background: rgba(0,0,0,0.15);
  opacity: 1;
  transition: all 0.3s ease;
  margin: 0 5px !important;
}
.swiper-pagination-bullet-active {
  width: 28px;
  border-radius: 5px;
  background: #005BEA;
}

/* Disabled state for prev/next buttons */
.testimonial-prev.swiper-button-disabled,
.testimonial-next.swiper-button-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 768px) {
  #site-header .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (max-width: 1023px) {
  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Article content typography (based on old trangchitiet template) ===== */

/* Electric lightning title */
.electric-title {
  position: relative;
  display: block;
  padding: 15px 45px;
  color: #001F4E !important;
  z-index: 0;
}
.electric-title::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -10px; right: -10px;
  background: linear-gradient(135deg, #FFD43B 0%, #FFE066 50%, #FFC928 100%);
  clip-path: polygon(
    0 0, 100% 0,
    100% 12%, calc(100% - 12px) 24%, 100% 36%, calc(100% - 12px) 48%, 100% 60%, calc(100% - 12px) 72%, 100% 84%, calc(100% - 12px) 96%,
    100% 100%,
    0 100%,
    12px 96%, 0 84%, 12px 72%, 0 60%, 12px 48%, 0 36%, 12px 24%, 0 12%
  );
  z-index: -1;
  transform: skewX(-3deg);
  filter: drop-shadow(0 3px 8px rgba(255, 212, 59, 0.5));
}

.article-content {
  font-size: 18px !important;
  font-family: 'MYRIADPRO-REGULAR', sans-serif !important;
  line-height: 1.8;
  color: #374151;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.article-content > *:first-child { margin-top: 0; }
.article-content > *:last-child { margin-bottom: 0; }

/* Headings */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  font-family: 'MYRIADPRO-REGULAR', sans-serif !important;
  font-weight: 700;
  color: #164f88;
  line-height: 1.5;
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  scroll-margin-top: 6rem;
}
.article-content h1,
.article-content h1 span {
  font-size: 25px !important;
}
.article-content h2,
.article-content h2 span {
  font-size: 25px !important;
  position: relative;
  border-bottom: 1px solid #01a7e3;
  text-transform: uppercase;
  padding-top: 20px;
  padding-left: 12px;
  padding-bottom: 10px;
}
.article-content h2:before {
  content: "\f0da";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: -7px;
  top: 14px;
  bottom: 0;
  font-size: 120%;
  margin: auto;
}
.article-content h3,
.article-content h3 span {
  font-size: 20px !important;
  font-weight: 600;
  color: #216cb7fa;
  padding-left: 25px;
  line-height: 1.5;
  position: relative;
  margin: 10px;
  padding-top: 2px;
}
.article-content h3:before {
  content: "\f064";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 0;
  font-size: 105%;
  margin: auto;
}
.article-content h4,
.article-content h4 span {
  font-size: 18px !important;
}
.article-content h5,
.article-content h5 span {
  font-size: 16px !important;
}
.article-content h6,
.article-content h6 span {
  font-size: 15px !important;
  color: #6b7280;
}

/* Paragraphs */
.article-content p,
.article-content p span {
  font-size: 18px !important;
  font-family: 'MYRIADPRO-REGULAR', sans-serif !important;
  line-height: 1.5;
  margin-bottom: 0;
  font-weight: 100;
  padding-bottom: 10px;
}

/* Links */
.article-content a,
.article-content a span {
  font-size: 18px !important;
  font-family: 'MYRIADPRO-REGULAR', sans-serif !important;
  color: #005BEA;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.article-content a:hover {
  color: #145682 !important;
  border-bottom: 1px solid #145682;
}
.article-content .hotline-chitiet a {
  -webkit-text-fill-color: #e35481 !important;
  color: #e35481 !important;
  font-weight: 700;
}
.article-content .hotline-chitiet a:hover {
  color: #c10e0e !important;
  -webkit-text-fill-color: #c10e0e !important;
}

/* Strong / Em */
.article-content strong {
  font-weight: 700;
}
.article-content em {
  font-size: 18px;
  font-style: oblique;
  background-color: #ccc;
  padding-left: 10px;
  padding-right: 10px;
}

/* Lists */
.article-content ul {
  list-style: inherit;
  padding-left: 40px;
}
.article-content ol {
  list-style: decimal;
  padding-left: 20px;
}
.article-content ul li {
  font-size: 18px;
  padding-bottom: 10px;
}
.article-content ol li {
  font-size: 18px;
  padding-bottom: 10px;
}

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow-y: auto;
  border: 2px solid #076db6;
  border-radius: 10px;
  margin: 1.5em 0;
  font-size: 16px;
}
.article-content th,
.article-content td {
  padding: 12px 15px;
  border-bottom: 1px solid #ddd;
  border: 1px solid #00000040 !important;
  padding-right: 4px;
  padding-left: 4px;
  max-height: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-content th {
  background-color: #f4f4f4;
  color: #333;
  font-weight: bold;
}
.article-content tr:hover {
  background-color: #f1f1f1;
}
.article-content thead th:first-child {
  border-top-left-radius: 8px;
}
.article-content thead th:last-child {
  border-top-right-radius: 8px;
}
.article-content tbody tr:last-child td:first-child {
  border-bottom-left-radius: 8px;
}
.article-content tbody tr:last-child td:last-child {
  border-bottom-right-radius: 8px;
}
.article-content tbody tr:last-child td {
  border-bottom: none;
}

/* Images */
.article-content p img {
  height: auto !important;
  max-width: 100%;
  border-radius: 0.5rem;
  margin: 1em auto;
  display: block;
}
.article-content a#link-img {
  text-align: center;
  display: block;
}
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* Image caption (alt text) */
.article-content .img-figure {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1em auto;
}
.article-content .img-figure img {
  display: block;
  margin: 0 !important;
  border-radius: 0.5rem 0.5rem 0 0;
}
.article-content .img-caption {
  display: block;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 15px !important;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
  padding: 8px 14px;
  border-radius: 0 0 0.5rem 0.5rem;
}

/* Blockquote */
.article-content blockquote {
  margin: 1.5em 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #005BEA;
  background: #f0f6ff;
  border-radius: 0 0.75rem 0.75rem 0;
  color: #374151;
  font-style: italic;
}
.article-content blockquote p { margin: 0; }

/* HR */
.article-content hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2em 0;
}

/* Code */
.article-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  background: #f3f4f6;
  padding: 0.15em 0.4em;
  border-radius: 0.3rem;
  color: #dc2626;
}
.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.9rem;
  line-height: 1.6;
}
.article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Special boxes from old template */
.article-content .huytran,
.article-content .khungxanh {
  padding-top: 20px;
  background: #37a8ec38;
  border-radius: 5px;
  padding: 2%;
  width: 100% !important;
  margin: 10px auto !important;
  box-shadow: rgba(0,0,0,0.4) 0 0 10px;
}
.article-content .khungxanh > p {
  font-size: 18px;
  line-height: 2;
}
.article-content .khungxanh > p:last-child,
.article-content .huytran > p:last-child {
  margin-bottom: 0;
}
.article-content .khungdo {
  border: 2px dashed #ec3237;
  background: #ec323712;
  border-radius: 5px;
  padding: 2%;
  width: 100% !important;
  margin: 10px auto !important;
}
.article-content .khungdo > p {
  font-size: 16px;
  line-height: 1.5;
}
.article-content .khungdo > p:last-child { margin-bottom: 0; }
.article-content .khungkm {
  background-color: #fef5c4;
  box-shadow: rgba(0,0,0,0.4) 0 0 10px;
  border-radius: 5px;
  padding: 2%;
  margin: 10px auto;
}
.article-content .huyhcuatuibayne {
  text-align: center;
  margin-bottom: 12px;
  text-transform: uppercase;
  background-color: #ffff00a1;
  padding-top: 11px;
  margin-top: 73px;
}
.article-content .khungmau {
  box-shadow: rgba(0,0,0,0.4) 0 0 10px;
  margin-bottom: 10px;
  line-height: 1.6em;
  padding: 15px;
  border-radius: 5px;
}

/* iframe */
.article-content iframe {
  max-width: 100%;
  border-radius: 0.75rem;
  margin: 1.5em 0;
}

/* ===== Nested nav dropdown - show submenu only on direct hover ===== */
.nav-sub > .nav-sub-menu {
  opacity: 0;
  visibility: hidden;
}
.nav-sub:hover > .nav-sub-menu {
  opacity: 1;
  visibility: visible;
}
