/* ============================================================
   DROPDOWN MENUS & ENHANCED HEADER
   ============================================================ */

/* --- Dropdown container --- */
.has-dropdown {
    position: relative;
}

.has-dropdown > a {
    display: flex;
    align-items: center;
    gap: 6px;
}

.has-dropdown > a .chevron-down {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.has-dropdown:hover > a .chevron-down,
.has-dropdown.is-dropdown-open > a .chevron-down {
    transform: rotate(180deg);
}

.has-dropdown:hover > a,
.has-dropdown.is-dropdown-open > a {
    color: var(--accent-color);
}

/* --- Dropdown panel --- */
.dropdown-panel {
    position: absolute;
    top: calc(100% + 16px);
    left: 50%;
    z-index: 200;
    min-width: 272px;
    padding: 7px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(17, 24, 39, 0.06);
    box-shadow: 0 12px 40px -8px rgba(17, 24, 39, 0.16), 0 4px 12px -4px rgba(17, 24, 39, 0.08);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-panel::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    height: 16px;
}

.has-dropdown:hover > .dropdown-panel,
.has-dropdown.is-dropdown-open > .dropdown-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0) scale(1);
}

/* --- Dropdown items --- */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.dropdown-item:hover {
    color: var(--primary-color);
    background-color: #f2f7f4;
}

.dropdown-item-icon {
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px #e2e8f0;
    color: #475569;
    font-size: 18px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease, color 0.2s ease, box-shadow 0.25s ease;
}

.dropdown-item-icon.icon-emerald {
    background: #ecfdf5;
    box-shadow: inset 0 0 0 1px #a7f3d0;
    color: #059669;
}

.dropdown-item-icon.icon-blue {
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px #bfdbfe;
    color: #2563eb;
}

.dropdown-item-icon.icon-indigo {
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px #c7d2fe;
    color: #4f46e5;
}

.dropdown-item-icon.icon-teal {
    background: #f0fdfa;
    box-shadow: inset 0 0 0 1px #99f6e4;
    color: #0d9488;
}

.dropdown-item-icon.icon-amber {
    background: #fffbeb;
    box-shadow: inset 0 0 0 1px #fde68a;
    color: #d97706;
}

.dropdown-item-icon.icon-rose {
    background: #fff1f2;
    box-shadow: inset 0 0 0 1px #fecdd3;
    color: #e11d48;
}

.dropdown-item-icon.icon-purple {
    background: #f5f3ff;
    box-shadow: inset 0 0 0 1px #ddd6fe;
    color: #8b5cf6;
}

.dropdown-item-icon.icon-slate {
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px #cbd5e1;
    color: #475569;
}

.dropdown-item:hover {
    color: #0f172a;
    background-color: #f1f5f9;
}

.dropdown-item:hover .dropdown-item-icon {
    transform: scale(1.05);
}

.dropdown-item:hover .dropdown-item-icon.icon-emerald {
    background: #d1fae5;
    box-shadow: inset 0 0 0 1.5px #10b981;
}

.dropdown-item:hover .dropdown-item-icon.icon-blue {
    background: #dbeafe;
    box-shadow: inset 0 0 0 1.5px #3b82f6;
}

.dropdown-item:hover .dropdown-item-icon.icon-indigo {
    background: #e0e7ff;
    box-shadow: inset 0 0 0 1.5px #6366f1;
}

.dropdown-item:hover .dropdown-item-icon.icon-teal {
    background: #ccfbf1;
    box-shadow: inset 0 0 0 1.5px #14b8a6;
}

.dropdown-item:hover .dropdown-item-icon.icon-amber {
    background: #fef3c7;
    box-shadow: inset 0 0 0 1.5px #f59e0b;
}

.dropdown-item:hover .dropdown-item-icon.icon-rose {
    background: #ffe4e6;
    box-shadow: inset 0 0 0 1.5px #f43f5e;
}

.dropdown-item:hover .dropdown-item-icon.icon-purple {
    background: #ede9fe;
    box-shadow: inset 0 0 0 1.5px #a855f7;
}

.dropdown-item:hover .dropdown-item-icon.icon-slate {
    background: #e2e8f0;
    box-shadow: inset 0 0 0 1.5px #64748b;
}

.dropdown-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-item-text strong {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
}

.dropdown-item-text small {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.3;
}

.dropdown-divider {
    height: 1px;
    margin: 6px 10px;
    background: rgba(17, 24, 39, 0.07);
}

/* --- Wide dropdown (mega-menu style) --- */
.dropdown-panel.dropdown-wide {
    min-width: 500px;
    padding: 7px;
}

.dropdown-wide-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.dropdown-wide-col {
    padding: 4px;
}

.dropdown-wide-col + .dropdown-wide-col {
    border-left: 1px solid rgba(17, 24, 39, 0.07);
    padding-left: 12px;
}

.dropdown-col-title {
    padding: 4px 12px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* --- Submenu (nested) --- */
.has-submenu {
    position: relative;
}

.has-submenu > .submenu-panel {
    position: absolute;
    top: -7px;
    left: calc(100% + 4px);
    z-index: 201;
    min-width: 224px;
    padding: 7px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(17, 24, 39, 0.06);
    box-shadow: 0 12px 40px -8px rgba(17, 24, 39, 0.16), 0 4px 12px -4px rgba(17, 24, 39, 0.08);
    opacity: 0;
    pointer-events: none;
    transform: translateX(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.has-submenu:hover > .submenu-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.dropdown-item.has-submenu > .submenu-arrow {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.dropdown-item.has-submenu:hover > .submenu-arrow {
    transform: translateX(3px);
    color: var(--primary-color);
}

/* --- Header scroll effect (glassmorphism + shrink) --- */
.header.is-scrolled {
    min-height: 66px;
    padding-top: 8px;
    padding-bottom: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    border-bottom-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.header.is-scrolled .logo img {
    width: 44px;
    height: 44px;
}

/* --- nav-login enhanced --- */
.nav-login {
    padding: 8px 18px !important;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    gap: 7px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
    box-shadow: 0 4px 14px rgba(25, 108, 70, 0.25);
}

.nav-login:hover,
.nav-login:focus-visible {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color)) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 108, 70, 0.35);
}



/* ============================================================
   SCROLL ANIMATIONS (Intersection Observer driven)
   ============================================================ */

.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.7s ease, transform 0.7s ease;
    will-change: opacity, transform;
}

/* fade-in-up */
.animate-on-scroll.fade-in-up {
    transform: translateY(40px);
}

.animate-on-scroll.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* fade-in-left */
.animate-on-scroll.fade-in-left {
    transform: translateX(-40px);
}

.animate-on-scroll.fade-in-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* fade-in-right */
.animate-on-scroll.fade-in-right {
    transform: translateX(40px);
}

.animate-on-scroll.fade-in-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* zoom-in */
.animate-on-scroll.zoom-in {
    transform: scale(0.9);
}

.animate-on-scroll.zoom-in.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* stagger children */
.stagger-children .animate-on-scroll:nth-child(1) { transition-delay: 0.05s; }
.stagger-children .animate-on-scroll:nth-child(2) { transition-delay: 0.12s; }
.stagger-children .animate-on-scroll:nth-child(3) { transition-delay: 0.19s; }
.stagger-children .animate-on-scroll:nth-child(4) { transition-delay: 0.26s; }
.stagger-children .animate-on-scroll:nth-child(5) { transition-delay: 0.33s; }
.stagger-children .animate-on-scroll:nth-child(6) { transition-delay: 0.40s; }
.stagger-children .animate-on-scroll:nth-child(7) { transition-delay: 0.47s; }
.stagger-children .animate-on-scroll:nth-child(8) { transition-delay: 0.54s; }
.stagger-children .animate-on-scroll:nth-child(9) { transition-delay: 0.61s; }
.stagger-children .animate-on-scroll:nth-child(10) { transition-delay: 0.68s; }
.stagger-children .animate-on-scroll:nth-child(11) { transition-delay: 0.75s; }
.stagger-children .animate-on-scroll:nth-child(12) { transition-delay: 0.82s; }


/* ============================================================
   MICRO-INTERACTIONS (Hover enhancements)
   ============================================================ */

/* Cards lift */
.stat-card,
.berita-card,
.galeri-card,
.lembaga-item,
.partner-card,
.aparatur-card,
.pill {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.stat-card:hover,
.berita-card.large:hover,
.galeri-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.10);
}

.lembaga-item:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(25, 108, 70, 0.12);
}

.partner-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Image zoom on hover */
.galeri-card img,
.berita-card img,
.aparatur-card img {
    transition: transform 0.5s ease;
}

.galeri-card:hover img,
.berita-card.large:hover img {
    transform: scale(1.06);
}

/* Banner CTA pulse */
.banner-link {
    position: relative;
    overflow: hidden;
}

.banner-link::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.banner-link:hover::after {
    transform: translateX(100%);
}

/* btn-more shimmer */
.btn-more {
    position: relative;
    overflow: hidden;
}

.btn-more::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.btn-more:hover::before {
    left: 100%;
}

/* Floating counter animation for stat numbers */
@keyframes countPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.stat-card:hover h3 {
    animation: countPulse 0.4s ease;
    color: var(--primary-color);
}

/* Running text / marquee for topbar */
@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* Keep the date fixed and prevent marquee from overlapping */
.topbar .topbar-left {
    flex-shrink: 0;
    margin-right: 28px;
    position: relative;
    z-index: 2;
}

.topbar-center.is-marquee {
    overflow: hidden;
    flex: 1;
    min-width: 0; /* crucial: allows flex child to shrink below content width */
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.topbar-center.is-marquee .marquee-track {
    display: flex;
    width: max-content;
    white-space: nowrap;
    animation: marqueeScroll var(--marquee-duration, 32s) linear infinite;
    will-change: transform;
}

.topbar-center.is-marquee:hover .marquee-track {
    animation-play-state: paused;
}

.topbar-center.is-marquee .marquee-group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.92);
}

.marquee-item strong {
    font-weight: 700;
    color: #fff;
}

/* Diamond divider between announcements — subtle official accent */
.marquee-sep {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin: 0 28px;
    transform: rotate(45deg);
    border-radius: 1px;
    background: var(--gold-color, #f1c40f);
    opacity: 0.85;
}


/* ============================================================
   RESPONSIVE DROPDOWN (mobile)
   ============================================================ */
@media (max-width: 992px) {
    #main-content {
        overflow-x: hidden;
        overflow-x: clip;
    }

    .has-dropdown > a .chevron-down {
        margin-left: auto;
    }

    .dropdown-panel,
    .dropdown-panel.dropdown-wide {
        position: static;
        width: 100%;
        min-width: 0;
        padding: 6px 0 8px;
        border: 0;
        border-top: 1px solid var(--border-color);
        border-radius: 0;
        background: #f9fafb;
        box-shadow: none;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        display: none;
        transition: none;
    }

    .dropdown-panel::before {
        display: none;
    }

    .has-dropdown.is-dropdown-open > .dropdown-panel {
        display: block;
        transform: none;
    }

    .dropdown-wide-inner {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .dropdown-wide-col {
        padding: 4px 8px;
    }

    .dropdown-wide-col + .dropdown-wide-col {
        border-left: none;
        border-top: 1px solid var(--border-color);
        margin-top: 4px;
        padding: 10px 8px 4px;
    }

    .dropdown-col-title {
        padding: 6px 8px 5px;
    }

    .navbar .dropdown-item {
        width: 100%;
        justify-content: flex-start;
        gap: 12px;
        min-height: 52px;
        padding: 8px;
        border-radius: 10px;
        font-size: 13px;
        white-space: normal;
        text-align: left;
    }

    .navbar .dropdown-item:hover,
    .navbar .dropdown-item:active {
        padding: 8px;
        background-color: #f1f5f9;
    }

    .navbar .dropdown-item:focus-visible {
        padding: 8px;
        outline: 2px solid var(--primary-color);
        outline-offset: -2px;
        background-color: #f1f5f9;
    }

    .dropdown-item-icon {
        width: 36px;
        height: 36px;
        border-radius: 11px;
        font-size: 15px;
    }

    .dropdown-item-text {
        min-width: 0;
        flex: 1;
        align-items: flex-start;
        text-align: left;
    }

    .dropdown-item-text strong,
    .dropdown-item-text small {
        width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .dropdown-divider {
        margin: 4px 12px;
    }

    .has-submenu > .submenu-panel {
        position: static;
        min-width: 0;
        padding: 4px 0 4px 44px;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        display: none;
    }

    .has-submenu.is-submenu-open > .submenu-panel {
        display: block;
    }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .topbar-center.is-marquee .marquee-track {
        animation: none;
    }
}
