/* ═══════════════════════════════════════════════════════
   Thư viện Sơn Nhai — Global Animations & Scroll Effects
   ═══════════════════════════════════════════════════════ */

/* ── Scroll Progress Bar ── */
#snhai-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, #00D4D4, #00FFFF, #00D4D4);
  z-index: 9999;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(0,212,212,0.8);
}

/* ── Back to Top Button ── */
#snhai-top {
  position: fixed;
  bottom: 32px; right: 28px;
  width: 42px; height: 42px;
  background: rgba(0,212,212,0.12);
  border: 1px solid rgba(0,212,212,0.35);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .3s, transform .3s, background .2s, box-shadow .2s;
  z-index: 998;
  backdrop-filter: blur(10px);
}
#snhai-top.visible {
  opacity: 1;
  transform: translateY(0);
}
#snhai-top:hover {
  background: rgba(0,212,212,0.22);
  box-shadow: 0 0 16px rgba(0,212,212,0.3);
}
#snhai-top svg { width: 18px; height: 18px; fill: none; stroke: #00D4D4; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Page Fade-In ── */
body.snhai-loading { opacity: 0; }
body.snhai-ready {
  opacity: 1;
  transition: opacity 0.45s ease;
}

/* ── Scroll Reveal Base ── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Slide from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }

/* Slide from right */
.reveal-right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

/* Scale up */
.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* Stagger delays */
.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.24s; }
.reveal-d4 { transition-delay: 0.32s; }
.reveal-d5 { transition-delay: 0.40s; }
.reveal-d6 { transition-delay: 0.48s; }

/* ── Navbar Scroll Effect ── */
.nav.nav-scrolled {
  background: rgba(8,9,14,0.96) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  border-bottom-color: rgba(0,212,212,0.15) !important;
}
.nav.nav-hidden {
  transform: translateY(-100%);
}
.nav {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease,
              box-shadow 0.3s ease,
              border-color 0.3s ease;
}

/* ── Button Ripple ── */
.ripple-container { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  transform: scale(0);
  animation: rippleAnim 0.55s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Glow Pulse on Cards ── */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(0,212,212,0); }
  50%       { box-shadow: 0 0 22px rgba(0,212,212,0.18); }
}
.glow-pulse { animation: glowPulse 3s ease-in-out infinite; }

/* ── Counter Number Tick ── */
.counter-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ── Floating/Bobbing Animation ── */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.float-anim { animation: floatY 4s ease-in-out infinite; }

/* ── Teal Shimmer (for hero badges, banners) ── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.shimmer-text {
  background: linear-gradient(90deg, #00D4D4 0%, #00FFFF 40%, #00D4D4 60%, #00AEAE 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* ── Typing Cursor Blink ── */
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
.typed-cursor {
  display: inline-block;
  width: 2px; height: 1.1em;
  background: #00D4D4;
  vertical-align: middle;
  margin-left: 3px;
  animation: cursorBlink 1s step-end infinite;
}

/* ── Horizontal Scroll Drag Hint ── */
.drag-hint {
  position: absolute;
  bottom: 8px; right: 12px;
  font-size: 11px; color: rgba(139,147,168,0.6);
  pointer-events: none;
  animation: fadeInOut 2.5s ease-in-out 1.5s forwards;
  opacity: 0;
}
@keyframes fadeInOut {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── About.html Legacy .fade-up Support ── */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Smooth Skeleton Loading ── */
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.7; }
}
.skeleton {
  background: #1C2232;
  border-radius: 6px;
  animation: skeletonPulse 1.4s ease-in-out infinite;
}

/* ── Scroll-linked Parallax Host ── */
.parallax-host { overflow: hidden; }

/* ── Nav Transition Enhancement ── */
.nav {
  will-change: transform, background-color;
}

/* ── Card Tilt Smooth Reset (only cards where we apply tilt) ── */
.product-card, .combo-card, .blog-card, .feat-card, .mvv-card {
  will-change: transform;
}

/* ── Hero Children Ready State ── */
.hero-eyebrow, .hero-h1, .hero-sub, .hero-cta,
.hero-stats, .hero-scroll, .hero-title, .hero-desc {
  will-change: opacity, transform;
}

/* ── Button Transition Enhancement ── */
.btn-add-cart, .btn-buy-now, .btn-teal, .btn, .cta-btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.btn-add-cart:hover, .btn-teal:hover, .cta-btn:hover {
  transform: translateY(-2px);
}
.btn-add-cart:active, .btn-teal:active {
  transform: translateY(0) scale(0.97);
}

/* ── Input Focus Glow ── */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(0, 212, 212, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(0, 212, 212, 0.08) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ── Smooth Link Underline ── */
a {
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ── Smooth Image Scale on Hover ── */
.product-card img, .p-card img, .blog-card img, .featured-card img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.product-card:hover img, .p-card:hover img,
.blog-card:hover img, .featured-card:hover img {
  transform: scale(1.05);
}

/* ── Stagger for Grid Children via CSS ── */
.bs-grid .bs-item:nth-child(1) { transition-delay: 0s; }
.bs-grid .bs-item:nth-child(2) { transition-delay: 0.06s; }
.bs-grid .bs-item:nth-child(3) { transition-delay: 0.12s; }
.bs-grid .bs-item:nth-child(4) { transition-delay: 0.18s; }
.bs-grid .bs-item:nth-child(5) { transition-delay: 0.24s; }
.bs-grid .bs-item:nth-child(6) { transition-delay: 0.30s; }

/* ── Success Check Animation (thank-you) ── */
@keyframes checkDraw {
  from { stroke-dashoffset: 60; }
  to   { stroke-dashoffset: 0; }
}
.success-check path, .success-check polyline {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
}
.success-check.animated path,
.success-check.animated polyline {
  animation: checkDraw 0.5s ease 0.3s forwards;
}

/* ── Scroll Indicator Bounce ── */
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50%       { transform: translateY(6px); opacity: 0.4; }
}
.hero-scroll, .scroll-indicator {
  animation: scrollBounce 2s ease-in-out infinite;
}

/* ── Section Reveal with Border Glow ── */
.reveal.visible .sec-head,
.reveal.visible .section-title {
  border-left-color: rgba(0, 212, 212, 0.6);
}

/* ── Smooth Link Hover (only where no custom transition) ── */
.nav-links a, .footer-link, .breadcrumb a {
  transition: color 0.2s ease, background 0.2s ease !important;
}

/* ── Toast Notification ── */
#snhai-toast {
  position: fixed;
  bottom: 88px; right: 28px;
  background: #12161F;
  border: 1px solid rgba(0,212,212,0.25);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  color: #DDE1EC;
  max-width: 280px;
  z-index: 997;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .3s, transform .3s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
}
#snhai-toast.show {
  opacity: 1;
  transform: translateY(0);
}
#snhai-toast .toast-icon { font-size: 16px; flex-shrink: 0; }
