/* ==========================================================================
   effects.css — lớp hiệu ứng mới đè lên theme Flatsome
   Nạp trong app/home/layout-top.php
   ========================================================================== */
:root {
  --fx-primary: #0a8f5b;
  --fx-primary-2: #13b5a6;
  --fx-ease: cubic-bezier(.22, .9, .3, 1);
  --fx-dur: .8s;
}

/* Hiệu ứng trượt ngang / vòng sóng không được làm trang rộng hơn màn hình.
   Dùng clip (không phải hidden) để header sticky vẫn hoạt động. */
html, body { overflow-x: clip; }

/* ---------- Loader ---------- */
#fx-loader {
  position: fixed; inset: 0; z-index: 99999;
  display: grid; place-items: center;
  background: #fff;
  transition: opacity .5s ease, visibility .5s ease;
}
#fx-loader.is-done { opacity: 0; visibility: hidden; }
.fx-drop {
  width: 46px; height: 46px; border-radius: 0 50% 50% 50%;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--fx-primary-2), var(--fx-primary));
  animation: fx-drop 1.1s var(--fx-ease) infinite;
}
@keyframes fx-drop {
  0%, 100% { transform: rotate(45deg) scale(.85); opacity: .7; }
  50%      { transform: rotate(45deg) scale(1.05); opacity: 1; }
}

/* ---------- Thanh tiến trình cuộn ---------- */
#fx-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--fx-primary), var(--fx-primary-2));
  z-index: 100000; pointer-events: none;
}

/* ---------- Header kính mờ khi cuộn ---------- */
.header-wrapper.stuck, #header.fx-scrolled .header-wrapper {
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .08) !important;
}
.header-main { transition: height .35s var(--fx-ease), background-color .35s; }
#header.fx-scrolled .header-main { background-color: rgba(255, 255, 255, .88) !important; }
/* Gạch chân menu: dùng gạch có sẵn của theme (nav-line-bottom), không thêm gạch riêng */

/* ---------- Scroll reveal ---------- */
.fx-reveal {
  opacity: 0;
  transition: opacity var(--fx-dur) var(--fx-ease), transform var(--fx-dur) var(--fx-ease), filter var(--fx-dur) var(--fx-ease);
  transition-delay: var(--fx-delay, 0s);
  will-change: opacity, transform;
}
.fx-up    { transform: translateY(40px); }
.fx-left  { transform: translateX(-50px); }
.fx-right { transform: translateX(50px); }
.fx-zoom  { transform: scale(.9); filter: blur(4px); }
.fx-flip  { transform: perspective(800px) rotateX(18deg) translateY(30px); transform-origin: 50% 100%; }
.fx-reveal.is-in { opacity: 1; transform: none; filter: none; }

/* Tiêu đề section: gạch chân chạy ra */
.section-title-main { position: relative; display: inline-block; }
.section-title .section-title-main::after {
  content: ""; display: block; height: 3px; margin: 8px auto 0; width: 0;
  background: linear-gradient(90deg, var(--fx-primary), var(--fx-primary-2));
  transition: width 1s var(--fx-ease) .2s;
}
.section-title.is-in .section-title-main::after { width: 60%; }

/* ---------- Card / box hover ---------- */
.box.has-hover, .portfolio-box, .icon-box {
  transition: transform .45s var(--fx-ease), box-shadow .45s var(--fx-ease);
  border-radius: 10px; overflow: hidden;
}
.box.has-hover:hover, .portfolio-box:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px rgba(10, 143, 91, .18);
}
.box-image, .banner-bg { overflow: hidden; }
.box-image img, .portfolio-box img {
  transition: transform 1s var(--fx-ease), filter .6s;
}
.box.has-hover:hover .box-image img,
.portfolio-box:hover img { transform: scale(1.08) rotate(.5deg); filter: saturate(1.15); }
/* lớp phủ ánh sáng quét qua ảnh */
.box-image { position: relative; }
.box-image::after {
  content: ""; position: absolute; top: 0; left: -75%; width: 50%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg); pointer-events: none;
}
.box.has-hover:hover .box-image::after { animation: fx-shine .9s ease; }

/* ---------- Nút ---------- */
.button, button[type=submit], input[type=submit] {
  position: relative; overflow: hidden;
  transition: transform .25s var(--fx-ease), box-shadow .25s var(--fx-ease) !important;
}
.button:hover, input[type=submit]:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .15); }
.button::before {
  content: ""; position: absolute; top: 0; left: -75%; width: 50%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-20deg);
}
.button:hover::before { animation: fx-shine .8s ease; }
@keyframes fx-shine { to { left: 125%; } }
.fx-ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255, 255, 255, .55); pointer-events: none;
  animation: fx-ripple .6s linear;
}
@keyframes fx-ripple { to { transform: scale(4); opacity: 0; } }

/* ---------- Slider: Ken Burns ---------- */
.slider .banner-bg img, .slider .banner-bg .bg { transform: scale(1); transition: transform 7s linear; }
.slider .is-selected .banner-bg img, .slider .is-selected .banner-bg .bg { transform: scale(1.12); }
.slider .is-selected .text-box-content { animation: fx-slide-text .9s var(--fx-ease) both .2s; }
@keyframes fx-slide-text { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* ---------- Số đếm ---------- */
.count-exp strong { background: linear-gradient(90deg, var(--fx-primary), var(--fx-primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Nút gọi / Zalo nổi: vòng sóng ---------- */
.cta-phone, .cta-zalo { position: relative; }
.cta-phone::before, .cta-zalo::before, .cta-phone::after, .cta-zalo::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0; pointer-events: none;
  animation: fx-wave 2s ease-out infinite;
}
.cta-zalo { color: #0068ff; } .cta-phone { color: #e53935; }
.cta-phone::after, .cta-zalo::after { animation-delay: 1s; }
@keyframes fx-wave { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }
.cta-phone .fa { animation: fx-shake 1.6s ease-in-out infinite; display: inline-block; }
/* Mobile: theme biến 2 nút thành thanh ngang dưới đáy -> vòng sóng bị kéo thành elip, tắt đi */
@media (max-width: 849px) {
  .cta-phone::before, .cta-zalo::before, .cta-phone::after, .cta-zalo::after { display: none; }
}
@keyframes fx-shake { 0%, 50%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-15deg); } 20%, 40% { transform: rotate(15deg); } }

/* ---------- Nút lên đầu trang (thay nút cũ của theme) ---------- */
.back-to-top, #top-link1, .cta-backtotop { display: none !important; }
#fx-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 9990;
  width: 50px; height: 50px; border: 0; border-radius: 50%; padding: 0;
  background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); cursor: pointer;
  opacity: 0; transform: translateY(20px) scale(.8); pointer-events: none;
  transition: opacity .35s, transform .35s var(--fx-ease);
}
#fx-top.is-show { opacity: 1; transform: none; pointer-events: auto; }
#fx-top svg { position: absolute; inset: 0; transform: rotate(-90deg); }
#fx-top circle { fill: none; stroke-width: 3; }
#fx-top .bg { stroke: #e6f4ee; }
#fx-top .fg { stroke: var(--fx-primary); stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
#fx-top span { position: relative; font-size: 20px; color: var(--fx-primary); line-height: 50px; }
#fx-top:hover { transform: translateY(-4px); }

/* ---------- Form liên hệ PHP ---------- */
.php-form-msg { margin-top: 10px; padding: 10px 14px; border-radius: 6px; font-size: 14px; }
.php-form-msg.ok  { background: #e7f7ef; color: #0a6b45; }
.php-form-msg.err { background: #fdecec; color: #a12020; }
.php-field-err { border-color: #d33 !important; }

/* ---------- Trang 404 / tìm kiếm ---------- */
.php-404, .php-search { padding: 70px 15px; min-height: 50vh; }
.php-404 { text-align: center; }
.php-404-code { font-size: 120px; font-weight: 800; line-height: 1;
  background: linear-gradient(90deg, var(--fx-primary), var(--fx-primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.php-search-list li { margin: 8px 0; }

/* ---------- Người dùng chọn giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx-reveal { opacity: 1 !important; transform: none !important; filter: none !important; }
  #fx-loader { display: none; }
}
