/* =====================================================================
   UX EFFECTS - komponen bersama (kartu berita, tooltip, toast)
   Dimuat global dari layout. Variabel mengikuti section "terbaru" di beranda.
   ===================================================================== */
:root {
  --ux-navy: #1e3c72;
  --ux-navy-2: #2a5298;
  --ux-accent: #f26b38;
  --ux-gold: #b8862b;
  --ux-ink: #12203a;
  --ux-muted: #64748b;
  --ux-line: #e6eaf0;
  --ux-shadow-sm: 0 4px 14px rgba(15, 36, 68, .05);
  --ux-shadow-lg: 0 18px 38px rgba(15, 36, 68, .13);
}

/* ---------- Section Berita Terbaru (beranda) ---------- */
.jdih-latest.berita-terbaru {
  background:
    radial-gradient(820px 340px at 96% 0%, rgba(242, 107, 56, .07), transparent 60%),
    radial-gradient(700px 320px at 0% 100%, rgba(30, 60, 114, .06), transparent 60%),
    #ffffff;
}

/* ---------- Kartu berita (vertikal, dengan thumbnail) ---------- */
.nws-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ux-line);
  border-radius: 18px;
  box-shadow: var(--ux-shadow-sm);
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.nws-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 4;
  height: 4px;
  background: linear-gradient(90deg, var(--ux-navy), var(--ux-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s ease;
}
.nws-card:hover, .nws-card:focus-within {
  transform: translateY(-6px);
  border-color: rgba(30, 60, 114, .18);
  box-shadow: var(--ux-shadow-lg);
}
.nws-card:hover::before, .nws-card:focus-within::before { transform: scaleX(1); }

.nws-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
}

.nws-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #eaf0fa, #f6efe4);
}
/* placeholder: tampil bila berita tanpa gambar atau gambar gagal dimuat */
.nws-card__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nws-card__ph img { width: 44px; height: auto; opacity: .35; }
.nws-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}
.nws-card:hover .nws-card__img { transform: scale(1.07); }

.nws-card__date {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 6px 10px 7px;
  line-height: 1.1;
  color: var(--ux-navy);
  text-align: center;
  background: rgba(255, 255, 255, .95);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(15, 36, 68, .18);
  transition: background .25s ease, color .25s ease;
}
.nws-card__date b { font-size: 1.15rem; font-weight: 800; }
.nws-card__date span {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nws-card:hover .nws-card__date { background: var(--ux-navy); color: #fff; }

.nws-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px 22px 18px;
}
.nws-card__title {
  position: relative;
  margin: 0 0 10px;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ux-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nws-card__title a { color: inherit; text-decoration: none; transition: color .2s ease; }
.nws-card:hover .nws-card__title a { color: var(--ux-navy); }
.nws-card__excerpt {
  position: relative;
  margin: 0 0 16px;
  font-size: .86rem;
  line-height: 1.65;
  color: var(--ux-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nws-card__foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed var(--ux-line);
  font-size: .8rem;
}
.nws-card__views {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ux-muted);
  font-variant-numeric: tabular-nums;
}
.nws-card__views i { font-size: .74rem; }
.nws-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--ux-navy);
  opacity: .6;
  transition: opacity .25s ease, gap .25s ease, color .25s ease;
}
.nws-card:hover .nws-card__cta { opacity: 1; gap: 10px; color: var(--ux-accent); }

/* ---------- Tooltip tipis generik: <el data-ux-tip="teks"> ---------- */
[data-ux-tip] { position: relative; }
[data-ux-tip]::after {
  content: attr(data-ux-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 50;
  width: max-content;
  max-width: 220px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  color: #fff;
  background: rgba(20, 32, 58, .94);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 36, 68, .22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 5px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
[data-ux-tip]:hover::after, [data-ux-tip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- Toast tipis ---------- */
.ux-toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.ux-toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 420px);
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(20, 32, 58, .95);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(15, 36, 68, .3);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
}
.ux-toast.is-in { opacity: 1; transform: none; }
.ux-toast i { color: #4ade80; }
.ux-toast--warn i { color: #fbbf24; }

@media (hover: none) {
  [data-ux-tip]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nws-card, .nws-card::before, .nws-card__img, .nws-card__cta,
  [data-ux-tip]::after, .ux-toast { transition: none; }
  .nws-card:hover, .nws-card:focus-within { transform: none; }
  .nws-card:hover .nws-card__img { transform: none; }
}

/* ---------- Kotak statistik pengunjung (beranda) ---------- */
.visitor-stats .stat-box {
    transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, border-color .25s ease;
}
.visitor-stats .stat-box:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, .18) !important;
    border-color: rgba(255, 255, 255, .45) !important;
    box-shadow: 0 14px 30px rgba(8, 20, 48, .3);
}
.visitor-stats .stat-box i { transition: transform .25s ease; }
.visitor-stats .stat-box:hover i { transform: scale(1.15); }

/* ---------- Halaman detail berita ---------- */
.berita-article { transition: box-shadow .3s ease; }
.berita-article:hover { box-shadow: 0 14px 34px rgba(15, 36, 68, .08); }
.brt-share {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: .84rem;
    font-weight: 700;
    color: #1e3c72;
    background: #eef3fb;
    border: 1px solid #d5e0f2;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.brt-share:hover { color: #fff; background: #1e3c72; box-shadow: 0 8px 18px rgba(30, 60, 114, .25); transform: translateY(-2px); }
.berita-article__footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

@media (prefers-reduced-motion: reduce), (hover: none) {
    .visitor-stats .stat-box:hover, .brt-share:hover { transform: none; }
}

/* =====================================================================
   TOP BAR GLOBAL (halaman dalam) — dasar tata letak, selaras beranda
   ===================================================================== */
.top-info-bar { position: relative; z-index: 1001; color: #fff; }
.top-info-content { display: flex; justify-content: space-between; align-items: center; }
.top-info-left { display: flex; align-items: center; }
.top-info-logo { width: 155px; height: 85px; margin-right: 10px; border-radius: 50%; object-fit: contain; }
.top-info-text { font-size: 13px; }
.top-info-text .text-warning { color: #ffc107 !important; font-weight: 600; }
.top-info-contact { display: flex; align-items: center; font-size: 13px; }
.top-info-contact i { margin-right: 5px; }
.top-info-contact span { margin-right: 15px; }
.btn-login {
    display: inline-flex; align-items: center; padding: 4px 12px; font-size: 12px;
    color: #fff; text-decoration: none; border-radius: 20px;
    background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .3);
    transition: all .3s ease;
}
.btn-login:hover { color: #fff; transform: translateY(-2px); }

/* =====================================================================
   PENANDA HALAMAN AKTIF — navigasi desktop (warna aktif: biru)
   ===================================================================== */
@media (min-width: 992px) {
    #header .navbar-menu-desktop > ul > li > a { position: relative; }
    #header .navbar-menu-desktop > ul > li > a::after {
        content: ""; position: absolute; left: 30px; right: 0; bottom: 2px; height: 3px;
        border-radius: 3px; background: linear-gradient(90deg, #2563eb, #60a5fa);
        transform: scaleX(0); transform-origin: left center; opacity: .55;
        transition: transform .3s ease, opacity .3s ease;
    }
    #header .navbar-menu-desktop > ul > li:hover > a::after { transform: scaleX(1); }
    #header .navbar-menu-desktop > ul > li.current > a { color: #2563eb; font-weight: 700; }
    #header .navbar-menu-desktop > ul > li.current > a::after { transform: scaleX(1); opacity: 1; }

    #header .navbar .dropdown ul li { position: relative; }
    #header .navbar .dropdown ul li.current > a {
        color: #2563eb; font-weight: 700; background: #eff6ff;
        box-shadow: inset 3px 0 0 #2563eb;
    }
}
@keyframes navAktifMasuk { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (min-width: 992px) and (prefers-reduced-motion: no-preference) {
    #header .navbar-menu-desktop > ul > li.current > a::after { animation: navAktifMasuk .45s ease both; }
}
@media (prefers-reduced-motion: reduce) {
    #header .navbar-menu-desktop > ul > li > a::after { transition: none; }
}

@media (max-width: 767.98px) {
    .top-info-bar { padding: 5px 0; }
    .top-info-content { flex-direction: column; gap: 8px; }
    .top-info-left { width: 100%; justify-content: center; text-align: left; }
    .top-info-logo { width: auto; max-width: 110px; height: 44px !important; margin-right: 8px; }
    .top-info-contact { flex-wrap: wrap; justify-content: center; font-size: 11px; row-gap: 4px; }
    .top-info-contact span { margin-right: 10px; }
}
