/* Custom CSS Variables */
:root {
    --primary-green: #164831;
    --light-green: #56b157;
    --mid-green: #5f8e5f;
    --white: #FFFFFF;
    --light-cream: #e3e1cf;
    --accent-gold: #edcd6c;
    --dark-green: #164831;
    --text-dark: #2D3748;

    /* Alias untuk kompatibilitas */
    --primary-blue: #164831;
    --light-blue: #56b157;
    --light-gray: #e3e1cf;
    --dark-blue: #164831;

    /* Override Bootstrap Variables */
    --bs-primary: #164831;
    --bs-primary-rgb: 22, 72, 49;
    --bs-warning: #edcd6c;
    --bs-warning-rgb: 237, 205, 108;
}

/* Global Reset & Typography */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--white);
    color: var(--text-dark);
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Global Button & Link Overrides */
.btn-primary {
    background-color: var(--primary-green) !important;
    border-color: var(--primary-green) !important;
    color: var(--white) !important;
}

.btn-primary:hover, 
.btn-primary:focus, 
.btn-primary:active, 
.btn-primary:active:focus {
    background-color: var(--mid-green) !important;
    border-color: var(--mid-green) !important;
    color: var(--white) !important;
    box-shadow: 0 0 0 0.25rem rgba(22, 72, 49, 0.25) !important;
}

.btn-outline-primary {
    color: var(--primary-green) !important;
    border-color: var(--primary-green) !important;
}

.btn-outline-primary:hover, 
.btn-outline-primary:focus, 
.btn-outline-primary:active, 
.btn-outline-primary:active:focus {
    background-color: var(--primary-green) !important;
    border-color: var(--primary-green) !important;
    color: var(--white) !important;
    box-shadow: 0 0 0 0.25rem rgba(22, 72, 49, 0.25) !important;
}

a {
    color: var(--primary-green);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--mid-green);
}

.bg-dark-blue {
    background-color: var(--dark-blue) !important;
}

.bg-light-gray {
    background-color: var(--light-gray) !important;
}

.bg-blue-light {
    background-color: rgba(22, 72, 49, 0.1) !important;
}

.bg-warning-light {
    background-color: rgba(237, 205, 108, 0.15) !important;
}

.bg-success-light {
    background-color: rgba(86, 177, 87, 0.1) !important;
}

.bg-danger-light {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.section-padding {
    padding-top: 5rem !important;
    padding-bottom: 5rem !important;
}

.max-w-xl {
    max-width: 600px;
}

.max-w-sm {
    max-width: 320px;
}

/* Utilities Setup */
.title-divider {
    width: 60px;
    height: 4px;
    border-radius: 2px;
}

.space-y-2>*+* {
    margin-top: 0.5rem;
}

.space-y-3>*+* {
    margin-top: 0.75rem;
}

.space-y-4>*+* {
    margin-top: 1rem;
}

/* 1. Navbar Sticky Styling */
.dynamic-navbar {
    background-color: var(--primary-blue);
    padding: 1rem 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.dynamic-navbar.scrolled {
    background-color: #0d2c1e;
    padding: 0.7rem 0;
}

.logo-placeholder {
    width: 38px;
    height: 38px;
    background-color: var(--white);
    border-radius: 8px;
}

.civ-subtitle {
    font-size: 1rem;
    letter-spacing: 0.5px;
    display: block;
    margin-top: -4px;
    line-height: 2;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--accent-gold) !important;
}

/* 2. Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-green) 0%, #0d2c1e 100%);
    min-height: 80vh;
    padding: 6rem 0;
}

.hero-img {
    border: 6px solid rgba(255, 255, 255, 0.1);
    max-height: 400px;
    object-fit: cover;
    width: 100%;
}

.hero-circle-bg {
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(86, 177, 87, 0.2) 0%, transparent 70%);
    z-index: 0;
}

/* 3. Statistik Section (Floating Layer) */
.mt-minus-card {
    margin-top: -6rem;
}

.card-stat {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08) !important;
}

.icon-stat {
    width: 60px;
    height: 60px;
}

/* 4. Menu Layanan Utama */
.icon-box-service {
    width: 55px;
    height: 55px;
}

.card-service {
    cursor: pointer;
    border-bottom: 3px solid transparent !important;
}

.card-service:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.06) !important;
    border-bottom: 3px solid var(--light-blue) !important;
}

/* 5. Alur Pembayaran Timeline */
.timeline-container {
    position: relative;
}

.timeline-item {
    position: relative;
}

.timeline-icon {
    width: 50px;
    height: 50px;
    border: 4px solid var(--white);
    position: relative;
    z-index: 2;
}


/* 7. Berita & Pengumuman */
.news-img {
    height: 200px;
    object-fit: cover;
}

.card-news {
    transition: transform 0.3s ease;
}

.card-news:hover {
    transform: translateY(-5px);
}

.dynamic-title-color:hover {
    color: var(--light-blue) !important;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 8. Galeri */
.gallery-item {
    height: 240px;
    cursor: pointer;
}

.gallery-overlay {
    background: linear-gradient(to top, rgba(22, 72, 49, 0.95) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* 11. Footer */
.logo-placeholder-footer {
    width: 35px;
    height: 35px;
}

.footer-links li a transition-all,
.hover-link-white {
    transition: color 0.2s ease;
}

.hover-link-white:hover {
    color: var(--white) !important;
}

.bg-blur {
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

/* 9. Detail Berita */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content a {
    color: var(--light-blue);
    text-decoration: underline;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-news-item {
    transition: background-color 0.2s ease;
}

.sidebar-news-item:hover {
    background-color: var(--light-gray);
}

.breadcrumb {
    margin-bottom: 0;
}

/* Responsive Breakpoints & Overrides */
@media (max-width: 991.98px) {
    .mt-minus-card {
        margin-top: 2rem;
    }

    .btn-nav-group {
        flex-direction: column;
        margin-top: 1rem;
    }
}

/* ── lg (≥992px): 5 item 1 baris, garis HORIZONTAL ── */
@media (min-width: 992px) {
    .timeline-row {
        position: relative;
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .timeline-item {
        flex: 1;
        text-align: center;
    }

    /* Garis horizontal tepat di tengah semua icon (25px = 50px/2) */
    .timeline-row::before {
        content: '';
        position: absolute;
        top: 25px;
        left: 10%;
        right: 10%;
        height: 3px;
        background-color: var(--light-gray);
        z-index: 1;
    }
}

/* ── <992px: paksa 1-kolom, garis VERTIKAL per icon ── */
@media (max-width: 991.98px) {
    /* Override col-md-6 → full width untuk semua item timeline */
    .timeline-item {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        display: flex !important;
        align-items: flex-start;
        text-align: left !important;
        gap: 1.5rem;
    }

    .timeline-icon {
        flex-shrink: 0;
        margin: 0 !important;
    }

    /*
     * Garis vertikal muncul di sebelah kiri menghubungkan icon.
     * Menggunakan ::after pada timeline-item dengan bottom negatif agar menjangkau
     * item berikutnya tanpa melewati batas bawah item terakhir.
     */
    .timeline-item:not(:last-child)::after {
        content: '';
        position: absolute;
        top: 50px;
        left: calc(var(--bs-gutter-x, 1.5rem) * 0.5 + 25px);
        transform: translateX(-50%);
        width: 3px;
        bottom: -2rem;
        background-color: var(--light-gray);
        z-index: 1;
    }
}

/* 10. Lightbox Gallery */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.show {
    opacity: 1;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-overlay.show .lightbox-img {
    transform: scale(1);
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10010;
}

.lightbox-btn:hover {
    background: #164831; /* fallback if var not resolved, or primary color */
    background: var(--primary-green, #164831);
    border-color: var(--primary-green, #164831);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 15px rgba(22, 72, 49, 0.5);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

.lightbox-close {
    position: absolute;
    top: -60px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: scale(1.1);
}

.lightbox-caption-container {
    margin-top: 20px;
    text-align: center;
    max-width: 600px;
    color: #fff;
}

.lightbox-caption {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
    font-size: 0.85rem;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

/* Lightbox thumbnails */
.lightbox-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
    max-width: 90vw;
    overflow-x: auto;
    padding-bottom: 5px;
}

.lightbox-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.lightbox-thumb:hover, .lightbox-thumb.active {
    opacity: 1;
    border-color: var(--primary-green, #164831);
    transform: translateY(-2px);
}

@media (max-width: 991.98px) {
    .lightbox-prev {
        left: 10px;
        top: auto;
        bottom: -75px;
        transform: none;
    }

    .lightbox-next {
        right: 10px;
        top: auto;
        bottom: -75px;
        transform: none;
    }

    .lightbox-prev:hover {
        transform: scale(1.1);
    }

    .lightbox-next:hover {
        transform: scale(1.1);
    }

    .lightbox-close {
        top: 20px;
        right: 20px;
        position: fixed;
    }

    .lightbox-container {
        max-height: 60vh;
    }

    .lightbox-img {
        max-height: 60vh;
    }

    .lightbox-caption-container {
        margin-top: 90px;
    }
}