/**
 * Daihoi public homepage - custom styles.
 * Enhanced Professional Aesthetics & Micro-interactions.
 */

:root {
  --brand-primary: #1d4ed8;
  --brand-secondary: #0d9488;
  --brand-accent: #f59e0b;
  --brand-navy: #0b1329;
  --surface-ground: #f8fafc;
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background-color: var(--surface-ground);
  color: #0f172a;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  vertical-align: middle;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

header.sticky-top {
  transition:
    padding 0.3s ease,
    box-shadow 0.3s ease,
    background-color 0.3s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background-color: rgba(255, 255, 255, 0.94) !important;
}

header.sticky-top.is-scrolled {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  box-shadow:
    0 10px 25px -5px rgba(15, 23, 42, 0.08),
    0 8px 10px -6px rgba(15, 23, 42, 0.04) !important;
}

/* Dải gradient cầu vồng dưới header với hiệu ứng dịch chuyển */
.rainbow-divider {
  height: 3px;
  background: linear-gradient(
    90deg,
    #9333ea,
    #2563eb,
    #0d9488,
    #f59e0b,
    #ec4899,
    #9333ea
  );
  background-size: 300% 100%;
  animation: rainbowShift 12s linear infinite;
}

@keyframes rainbowShift {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 300% 50%;
  }
}

/* Nav links hover effect */
nav a.nav-link {
  position: relative;
  transition: color 0.25s ease;
}

nav a.nav-link::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #1d4ed8, #0d9488);
  border-radius: 2px;
  transition:
    width 0.3s var(--transition-smooth),
    left 0.3s var(--transition-smooth);
}

nav a.nav-link:hover::after {
  width: calc(100% - 1.5rem);
  left: 0.75rem;
}

/* Thanh nav cuộn ngang trên mobile (ẩn scrollbar) */
.nav-scroller {
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-scroller::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Hero Slider
   ========================================================================== */

.hero-slider-wrap {
  width: 100%;
  height: auto;
  min-height: 0;
  position: relative;
  background-color: transparent;
}

/* Lưới xếp chồng các slide cùng chiếm 1 ô để tự co giãn theo chiều cao ảnh */
.hero-slider-track {
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: auto;
  width: 100%;
  position: relative;
}

/* Slide item */
.hero-slide {
  grid-area: 1 / 1 / 2 / 2;
  width: 100%;
  height: auto;
  position: relative;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.75s ease-in-out,
    visibility 0.75s ease-in-out;
  pointer-events: none;
  z-index: 1;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

/* Slide không có ảnh: giữ độ cao tối thiểu để không bị xẹp */
.hero-slide.has-no-image {
  min-height: clamp(260px, 35vw, 480px);
}

/* Link/picture wrapper co giãn tự nhiên theo ảnh */
.hero-slide .slide-link,
.hero-slide .slide-picture {
  display: block;
  width: 100%;
  height: auto;
}

.hero-slide a.slide-link {
  cursor: pointer;
  text-decoration: none;
}

/* Ảnh banner hiển thị trọn vẹn 100% kích thước tự nhiên, không crop */
.hero-slide .slide-bg-img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain;
  object-position: center;
  transform: none;
}

@media (max-width: 575.98px) {
  .slider-control-btn {
    width: 32px !important;
    height: 32px !important;
  }
}

/* Animated decorative background grid (chỉ thấy khi slide không có ảnh) */
.hero-slide-grid-pattern {
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.12) 1px,
    transparent 1px
  );
  background-size: 24px 24px;
}

@keyframes slideInUp {
  0% {
    opacity: 0;
    transform: translateY(28px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Slider Controls & Glass */
.slider-control-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transition: all 0.25s ease;
  cursor: pointer;
}

.slider-control-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.slider-indicators-pill {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.slider-dot {
  cursor: pointer;
  transition:
    width 0.35s var(--transition-smooth),
    background-color 0.35s ease,
    transform 0.2s ease;
}

.slider-dot:hover {
  transform: scaleY(1.3);
}

/* Slider Top/Bottom Progress Bar */
.slider-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  z-index: 5;
  overflow: hidden;
}

.slider-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2dd4bf, #38bdf8);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.7);
  transition: width 0.1s linear;
}

/* ==========================================================================
   Card & Section Micro-interactions
   ========================================================================== */

/* Hiệu ứng hover card cao cấp */
.card-hover {
  transition:
    transform 0.32s var(--transition-smooth),
    box-shadow 0.32s var(--transition-smooth),
    border-color 0.3s ease;
  will-change: transform, box-shadow;
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow:
    0 20px 35px -10px rgba(15, 23, 42, 0.12),
    0 10px 15px -8px rgba(15, 23, 42, 0.06) !important;
}

/* Hover icon zoom & subtle rotate */
.card-hover:hover .icon-bounce {
  transform: scale(1.15) rotate(5deg);
}

.icon-bounce {
  transition: transform 0.35s var(--transition-smooth);
}

/* Hover link arrow slide */
.card-hover:hover .arrow-slide {
  transform: translateX(6px);
}

.arrow-slide {
  display: inline-flex;
  transition: transform 0.3s var(--transition-smooth);
}

/* Image Zoom on hover inside cards */
.img-zoom-wrap {
  overflow: hidden;
}

.img-zoom-wrap img {
  transition: transform 0.7s var(--transition-smooth);
}

.card-hover:hover .img-zoom-wrap img,
.img-zoom-wrap:hover img {
  transform: scale(1.1);
}

/* Giới hạn số dòng cho tiêu đề/mô tả */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Button Sheen & Glow Effects
   ========================================================================== */

.btn-shimmer {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.65s ease;
}

.btn-shimmer:hover::after {
  left: 140%;
}

/* Pulse live dot animation */
.pulse-live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
}

.pulse-live-dot::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background-color: inherit;
  opacity: 0.7;
  animation: pulsePing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes pulsePing {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  75%,
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Ambient glow orbs */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orbDrift 14s ease-in-out infinite alternate;
}

@keyframes orbDrift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(25px, -20px) scale(1.1);
  }

  100% {
    transform: translate(-20px, 15px) scale(0.95);
  }
}

/* ==========================================================================
   Scroll Reveal Animations
   ========================================================================== */

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.75s var(--transition-smooth),
    transform 0.75s var(--transition-smooth);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-fade-left {
  opacity: 0;
  transform: translateX(-35px);
  transition:
    opacity 0.75s var(--transition-smooth),
    transform 0.75s var(--transition-smooth);
  will-change: opacity, transform;
}

.reveal-fade-left.is-revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-fade-right {
  opacity: 0;
  transform: translateX(35px);
  transition:
    opacity 0.75s var(--transition-smooth),
    transform 0.75s var(--transition-smooth);
  will-change: opacity, transform;
}

.reveal-fade-right.is-revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity 0.75s var(--transition-smooth),
    transform 0.75s var(--transition-smooth);
  will-change: opacity, transform;
}

.reveal-scale.is-revealed {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delay helpers */
.delay-100 {
  transition-delay: 0.1s !important;
}

.delay-150 {
  transition-delay: 0.15s !important;
}

.delay-200 {
  transition-delay: 0.2s !important;
}

.delay-250 {
  transition-delay: 0.25s !important;
}

.delay-300 {
  transition-delay: 0.3s !important;
}

.delay-350 {
  transition-delay: 0.35s !important;
}

.delay-400 {
  transition-delay: 0.4s !important;
}

.delay-500 {
  transition-delay: 0.5s !important;
}

/* ==========================================================================
   Floating Back To Top & Actions
   ========================================================================== */

#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #0d9488);
  color: #ffffff;
  border: none;
  box-shadow: 0 10px 25px rgba(29, 78, 216, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: all 0.3s var(--transition-smooth);
  z-index: 1040;
  cursor: pointer;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 15px 30px rgba(29, 78, 216, 0.55);
}

/* ==========================================================================
   Glassmorphism Helpers
   ========================================================================== */

.glass-badge {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-card-dark {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Sổ tay Đại hội (/so-tay-dai-hoi)
   ========================================================================== */

/* Nền hoa văn mờ cho hero sổ tay */
.handbook-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.14) 0, transparent 42%),
    radial-gradient(circle at 88% 85%, rgba(13, 148, 136, 0.35) 0, transparent 45%);
  pointer-events: none;
}

/* Thẻ nội dung: viền trên theo gradient thương hiệu khi hover */
.handbook-section {
  border-top: 3px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.handbook-section:hover {
  border-top-color: var(--brand-primary);
  box-shadow: 0 14px 34px rgba(29, 78, 216, 0.1);
  transform: translateY(-2px);
}

/* Chip icon tiêu đề từng mục */
.handbook-ico {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  box-shadow: 0 6px 14px rgba(29, 78, 216, 0.28);
}

.handbook-ico .material-symbols-outlined {
  font-size: 22px;
}

/* Liên kết dạng thẻ */
.handbook-link {
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.handbook-link:hover {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.12);
  transform: translateY(-2px);
}

/* Mục lục bên trái */
#handbookToc .nav-link {
  border-left: 3px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

#handbookToc .nav-link:hover {
  background-color: #eff6ff;
  color: #1d4ed8;
}

#handbookToc .nav-link.active {
  background-color: #eff6ff !important;
  color: #1d4ed8 !important;
  border-left-color: var(--brand-primary);
}

/* ============================================================
   Menu desktop trang con Đại hội (_subheader):
   1 hàng ngang, link kiểu gạch chân khi hover/active (bỏ pill)
   ============================================================ */
/* Nút menu (hamburger) trên mobile */
.dh-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .1s ease;
}
.dh-menu-toggle .material-symbols-outlined {
  font-size: 24px;
  line-height: 1;
}
.dh-menu-toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .12);
}
.dh-menu-toggle:active { transform: scale(.94); }
.dh-menu-toggle:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}
/* Khi offcanvas đang mở, nút chuyển trạng thái nổi bật */
.dh-menu-toggle[aria-expanded="true"] {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.dh-subnav { flex-wrap: nowrap; column-gap: 2px; }
.dh-subnav-link {
  position: relative;
  padding: 6px 9px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: #64748b;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s ease;
}
.dh-subnav-link::after {
  content: "";
  position: absolute;
  left: 9px; right: 9px; bottom: 1px;
  height: 2px;
  background: #2563eb;
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .2s ease;
}
.dh-subnav-link:hover { color: #1e293b; }
.dh-subnav-link:hover::after,
.dh-subnav-link.active::after { transform: scaleX(1); }
.dh-subnav-link.active { color: #2563eb; }
.dh-subnav-more::after { left: 9px; right: 24px; }
.dh-subnav .dropdown-item.active,
.dh-subnav .dropdown-item:active {
  background-color: #eff6ff;
  color: #1d4ed8;
}
.dh-subnav-sep {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  margin: 0 6px;
}
.dh-subnav-admin {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8 0%, #312e81 100%);
  transition: filter .15s ease;
}
.dh-subnav-admin:hover { color: #fff; filter: brightness(1.08); }
/* Thu gọn thêm khi màn hình desktop nhỏ để giữ 1 hàng */
@media (min-width: 992px) and (max-width: 1399px) {
  .dh-subnav-link { padding: 6px 6px; font-size: 12.5px; }
  .dh-subnav-link::after { left: 6px; right: 6px; }
  .dh-subnav-more::after { right: 20px; }
}
