/* Tetapan Font Asas */
body {
  font-family: "Open Sans", sans-serif;
}

/* Tetapan Font Tajuk */
h1,
h2,
h3,
.font-heading {
  font-family: "Montserrat", sans-serif;
}

/* Skrol Licin */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  /* Offset for sticky header */
}

/* Animasi Muncul Naik (Fade In Up) */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

/* --- HERO SLIDER CSS --- */
.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  /* Sembunyikan secara lalai */
  transition: opacity 1.5s ease-in-out;
  transform: scale(1);
}

/* Kelas 'active' menjadikan gambar nampak */
.hero-slide.active {
  opacity: 1;
}

/* --- MODAL (POPUP) CSS --- */
.modal {
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  transform: scale(0.9);
  transition: transform 0.3s ease-in-out;
}

.modal.active .modal-content {
  transform: scale(1);
}

/* Efek Hover Zoom untuk Gambar Berita */
.hover-zoom-img {
  transition: transform 0.5s ease;
}

.hover-zoom-img:hover {
  transform: scale(1.1);
}

/* Timeline Styles for info.html */
.timeline-item {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid #e2e8f0;
  padding-bottom: 2rem;
}

.timeline-item:last-child {
  border-left: 2px solid transparent;
}

.timeline-dot {
  position: absolute;
  left: -9px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid white;
}

/* --- ORGANIZATIONAL CHART CSS --- */
.org-tree ul {
  padding-top: 20px;
  position: relative;
  transition: all 0.5s;
  display: flex;
  justify-content: center;
}

.org-tree li {
  float: left;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 10px 0 10px;
  transition: all 0.5s;
}

/* Connectors */
.org-tree li::before,
.org-tree li::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  border-top: 2px solid #cbd5e1;
  width: 50%;
  height: 20px;
}

.org-tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid #cbd5e1;
}

.org-tree li:only-child::after,
.org-tree li:only-child::before {
  display: none;
}

.org-tree li:only-child {
  padding-top: 0;
}

.org-tree li:first-child::before,
.org-tree li:last-child::after {
  border: 0 none;
}

.org-tree li:last-child::before {
  border-right: 2px solid #cbd5e1;
  border-radius: 0 5px 0 0;
}

.org-tree li:first-child::after {
  border-radius: 5px 0 0 0;
}

.org-tree ul ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid #cbd5e1;
  width: 0;
  height: 20px;
}

/* Card Styles */
.org-card {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 1rem;
  border-radius: 0.75rem;
  display: inline-block;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  z-index: 10;
  min-width: 160px;
  /* Sedikit kecilkan untuk muat */
}

.org-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: #3b82f6;
}

.org-img {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  object-fit: cover;
  margin: 0 auto 0.5rem auto;
  border: 2px solid #f1f5f9;
}

/* Custom Scrollbar for Schedule Box */
.schedule-scroll::-webkit-scrollbar {
  width: 6px;
}

.schedule-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.schedule-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.schedule-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* --- ANIMATION: Floating Elements --- */
@keyframes floatUp {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }
}

@keyframes bounceSlow {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-float-slow {
  animation: floatUp 6s ease-in-out infinite;
}

.animate-bounce-slow {
  animation: bounceSlow 4s ease-in-out infinite;
}

.animate-spin-slow {
  animation: spinSlow 12s linear infinite;
}

/* --- ANIMATION: Scroll Reveal --- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
  will-change: opacity, transform;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Pure Fade Reveal */
.reveal-fade {
  opacity: 0;
  transition: opacity 1.2s ease-out;
  will-change: opacity;
}

.reveal-fade.is-visible {
  opacity: 1;
}

/* Staggered Delays */
.delay-100 {
  transition-delay: 0.1s;
}

.delay-200 {
  transition-delay: 0.2s;
}

.delay-300 {
  transition-delay: 0.3s;
}

.delay-400 {
  transition-delay: 0.4s;
}

/* --- 3D TILT EFFECT --- */
.perspective-1000 {
  perspective: 1000px;
}

.principal-image-container {
  transform-style: preserve-3d;
}

.tilt-element {
  /* Transition handled in inline style via JS for smoothness, 
     but we keep a base transition for return-to-center */
  transition: transform 0.1s ease-out;
}

/* --- SKELETON LOADER & LAZY LOADING --- */
@keyframes skeleton-pulse {
  0% {
    background-color: #f1f5f9;
  }

  50% {
    background-color: #e2e8f0;
  }

  100% {
    background-color: #f1f5f9;
  }
}

.skeleton-loader {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background-color: #f1f5f9;
}

.lazy-img {
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.lazy-img.loaded {
  opacity: 1;
}

/* --- GALLERY HORIZONTAL SLIDER --- */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#imageSlider {
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Lightbox Specifics */
#galleryLightbox {
  transition:
    opacity 0.4s ease-out,
    backdrop-filter 0.4s ease-out;
}

#galleryLightbox.active {
  opacity: 1;
}

#galleryLightbox #lightboxImg {
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#galleryLightbox.active #lightboxImg {
  transform: scale(1);
  opacity: 1;
}

#galleryLightbox #lightboxTitle {
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.5s ease-out 0.2s;
}

#galleryLightbox.active #lightboxTitle {
  transform: translateY(0);
  opacity: 1;
}

/* Fallback untuk line-clamp jika Tailwind plugin tidak diaktifkan */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

/* Pastikan anchor yang menggunakan kelas utility 'block' nampak seperti kad (tiada underline/warna link)
   Ini tidak mengubah susun atur, hanya warisan warna dan dekorasi teks. */
a.block {
  color: inherit;
  text-decoration: none;
}

/* Animasi untuk teks penuh pada kad berita */
.full-text {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.45s ease,
    opacity 0.35s ease;
}

.full-text.expanded {
  max-height: 600px;
  /* cukup besar untuk kandungan biasa */
  opacity: 1;
}

.full-text p {
  margin: 0;
}

/* --- GLOBAL SCROLL TO TOP BUTTON --- */
#scrollToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #ffd700, #ffae00);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  color: #333;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  transform: translateY(20px);
}

#scrollToTop.show {
  opacity: 0.9;
  visibility: visible;
  transform: translateY(0);
}

#scrollToTop:hover {
  opacity: 1;
  background: linear-gradient(135deg, #ffae00, #ffd700);
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Support for Dark Mode */
.dark #scrollToTop {
  background: linear-gradient(135deg, #ffd700, #ffae00);
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
