/* ==========================================================================
   COMPONENTS.CSS - Shared Buttons, Cards, Widgets, and Lightbox Dialogs
   ========================================================================== */

/* 1. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  /* Hanya transisi property visual, BUKAN layout/size property */
  /* Mencegah button 'memanjang' saat compositing layer header di-recreate */
  transition:
    background-color var(--transition-fast),
    background    var(--transition-fast),
    color         var(--transition-fast),
    transform     var(--transition-fast),
    box-shadow    var(--transition-fast),
    border-color  var(--transition-fast);
}

.btn-primary {
  background-color: var(--green);
  color: var(--white);
  border: 1px solid transparent;
}

.btn-primary:hover {
  background-color: var(--green-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Gold CTA — tombol donasi utama */
.btn-lime {
  background: linear-gradient(135deg, #D4A03A, #C8973E);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  font-weight: 800;
  white-space: nowrap; /* Teks tidak boleh wrap */
}

/* Kunci posisi tombol Donasi di navbar — tidak boleh resize saat page transition */
#nav-donasi-btn {
  white-space: nowrap;
  flex-shrink: 0;
  /* Kunci lebar ke ukuran konten — mencegah melar saat layout recalculation */
  width: max-content;
}

.btn-lime:hover {
  background: linear-gradient(135deg, #C8973E, #B07E2A);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200, 151, 62, 0.4);
}

.btn-outline {
  border: 2px solid var(--green);
  color: var(--green);
  background-color: transparent;
  font-weight: 700;
}

.btn-outline:hover {
  background-color: var(--green);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Ukuran tombol besar */
.btn-lg {
  min-height: 54px;
  padding: 0.95rem 1.75rem;
  font-size: 1rem;
}

/* Tombol outline transparan untuk hero section */
.btn-hero-secondary {
  color: #fff;
  border: 1px solid rgba(255,255,255,0.38);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
  font-weight: 700;
}
.btn-hero-secondary:hover {
  background: #fff;
  color: var(--green-dark);
  border-color: #fff;
}

/* 2. STATISTIC COUNTER CARDS */
.stat-card {
  background-color: var(--white);
  padding: 2.25rem 1.5rem;
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-300);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--lime));
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 3.25rem;
  height: 3.25rem;
  background: var(--lime-light);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
}

.stat-number-wrapper {
  font-size: 2.5rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

/* 3. PROGRAM SERVICE CARDS */
.program-card {
  background-color: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-300);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.program-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.program-image {
  height: 13rem;
  overflow: hidden;
  position: relative;
}

.program-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.program-card:hover .program-image img {
  transform: scale(1.08);
}

.program-icon-badge {
  position: absolute;
  bottom: -1.5rem;
  right: 1.5rem;
  width: 3.25rem;
  height: 3.25rem;
  background-color: var(--lime);
  color: var(--green-dark);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  font-size: 1.25rem;
  z-index: 2;
  border: 3px solid var(--white);
}

.program-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.program-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.program-desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

/* 4. NEWS SUMMARY CARDS */
.news-card {
  background-color: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-300);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Seluruh kartu adalah <a> — netralkan style default link */
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.news-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.news-img-wrapper {
  height: 12.5rem;
  overflow: hidden;
  position: relative;
}

.news-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.news-card:hover .news-img-wrapper img {
  transform: scale(1.08);
}

.news-category-tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background-color: var(--green);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.news-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.news-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.news-meta svg,
.news-meta i {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--green);
  flex-shrink: 0;
}

.news-card-title,
.news-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 3.0rem;
  transition: color 0.15s ease;
}

.news-card:hover .news-card-title,
.news-card:hover .news-title {
  color: var(--green);
}

.news-card-excerpt {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.news-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--green);
  font-size: 0.9rem;
}

.news-read-more i {
  transition: var(--transition-fast);
}

.news-card:hover .news-read-more {
  color: var(--lime-hover);
}

.news-card:hover .news-read-more i {
  transform: translateX(4px);
}

/* 5. LIGHTBOX MODAL DIALOG */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  background-color: rgba(31, 36, 33, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

.lightbox-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  max-width: 90%;
  max-height: 80%;
  position: relative;
  transform: scale(0.9);
  transition: var(--transition-normal);
}

.lightbox-modal.active .lightbox-content {
  transform: scale(1);
}

.lightbox-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  color: var(--white);
  text-align: center;
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.lightbox-close {
  position: absolute;
  top: -3rem;
  right: 0;
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.1);
  transition: var(--transition-fast);
}

.lightbox-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 6. BANKING INFO CARDS (DONATION) */
.bank-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  transition: var(--transition-normal);
}

.bank-card:hover {
  transform: translateX(4px);
  border-color: var(--lime);
  box-shadow: var(--shadow-lg);
}

.bank-info-flex {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.bank-logo {
  height: 2.25rem;
  width: auto;
  object-fit: contain;
}

.bank-details {
  display: flex;
  flex-direction: column;
}

.bank-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bank-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
  margin: 0.1rem 0;
}

.bank-holder {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.btn-copy {
  background-color: var(--cream);
  color: var(--green);
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.82rem;
  border: 1px solid rgba(46, 90, 28, 0.15);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-copy:hover {
  background-color: var(--green);
  color: var(--white);
  border-color: var(--green);
}

.qris-card {
  background-color: var(--cream);
  border-radius: var(--radius-2xl);
  padding: 2.25rem;
  text-align: center;
  border: 1px dashed var(--green);
  box-shadow: var(--shadow-md);
}

.qris-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 0.5rem;
}

.qris-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.qris-image {
  background-color: var(--white);
  padding: 1rem;
  border-radius: var(--radius-xl);
  display: inline-block;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  width: 13rem;
  height: 13rem;
}

.qris-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qris-holder {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

/* 7. FLOATING WHATSAPP WIDGET */
.wa-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  /* Penting: relative untuk posisi ripple */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ring sinyal mengembang keluar */
.wa-ripple {
  position: absolute;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.35);
  animation: waRipple 2s ease-out infinite;
  pointer-events: none;
}

.wa-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  background-color: #25D366;   /* WhatsApp green resmi */
  color: var(--white);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.5);
  transition: var(--transition-normal);
  z-index: 1;
}

.wa-btn:hover {
  transform: scale(1.1);
  background-color: #20BA5A;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

@keyframes waRipple {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Tetap ada keyframe lama untuk kompatibilitas */
@keyframes waPulse {
  0%   { box-shadow: 0 0 0 0   rgba(37, 211, 102, 0.6); }
  70%  { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0   rgba(37, 211, 102, 0); }
}

/* RESPONSIVE SUB-GRID ADAPTERS */
@media (max-width: 768px) {
  .bank-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .btn-copy {
    width: 100%;
    height: auto;
    padding: 0.65rem;
  }
  .wa-widget {
    /* Default: posisi bawah normal */
    bottom: 1.5rem;
    right: 1rem;
  }
  /* Naik hanya kalau ada floating donate bar (beranda) */
  body.has-floating-bar .wa-widget {
    bottom: 4.75rem;
    transition: bottom 0.3s ease;
  }
  .wa-ripple {
    width: 2.75rem;
    height: 2.75rem;
  }
  .wa-btn {
    width: 2.75rem;
    height: 2.75rem;
  }
  .wa-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* ==========================================================================
   SKELETON LOADING - Animasi placeholder saat data dari API sedang dimuat
   Dipakai oleh: berita.js, galeri.js, program.js
   ========================================================================== */

@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-card {
  background: var(--cream);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-img,
.skeleton-line {
  background: linear-gradient(90deg,
    #e2e8e4 25%,
    #f0f4f1 50%,
    #e2e8e4 75%
  );
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-img {
  width: 100%;
  height: 180px;
  border-radius: 0;
}

.skeleton-img.tall {
  height: 220px;
}

.skeleton-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.skeleton-line {
  height: 14px;
  width: 100%;
}

.skeleton-line.short {
  width: 40%;
  height: 12px;
}

.skeleton-line.medium {
  width: 70%;
}

.skeleton-gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* 8. PAGINATION */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3.5rem;
}

.page-num {
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-300);
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: var(--transition-fast);
}

.page-num:hover, .page-num.active {
  background-color: var(--green);
  border-color: var(--green);
  color: var(--white);
}

