/* ==========================================================================
   Base Styles & Variables
   ========================================================================== */
:root {
    /* Tema Kemenag (Ikhlas Beramal) */
    --primary-color: #004d26; /* Hijau Kemenag */
    --secondary-color: #F5A623; /* Kuning Emas */
    --light-bg: #F5F7FA;
    --dark-text: #2d3436;
    --light-text: #636e72;
    --white: #FFFFFF;
    --border-color: rgba(0, 0, 0, 0.05);

    /* Override Bootstrap Variables */
    --bs-primary: #004d26;
    --bs-primary-rgb: 0, 118, 60;
    --bs-secondary: #F5A623;
    --bs-secondary-rgb: 245, 166, 35;
}

/* Force Bootstrap Overrides for Non-SASS build */
.bg-primary { background-color: var(--primary-color) !important; }
.text-primary { color: var(--primary-color) !important; }
.btn-primary { 
    background-color: var(--primary-color) !important; 
    border-color: var(--primary-color) !important; 
    color: var(--white) !important;
}
.btn-primary:hover { 
    background-color: #005a2e !important; 
    border-color: #005a2e !important; 
}
.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    color: var(--white) !important;
}
.bg-secondary { background-color: var(--secondary-color) !important; }
.text-secondary-color { color: var(--secondary-color) !important; }

body {
    font-family: 'Inter', sans-serif;
    color: var(--light-text);
    background-color: var(--light-bg);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
    font-family: 'Poppins', sans-serif;
    color: var(--dark-text);
    font-weight: 600;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.bg-primary-custom { background-color: var(--primary-color) !important; }
.text-primary-custom { color: var(--primary-color) !important; }
.bg-light-custom { background-color: var(--light-bg) !important; }

.glassmorphism {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.shadow-soft {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
}

.rounded-custom {
    border-radius: 12px !important;
}

.section-padding {
    padding: 50px 0;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
    border-radius: 2px;
}

.section-title.text-start::after {
    left: 0;
    transform: none;
}

/* ==========================================================================
   1. Top Bar
   ========================================================================== */
.top-bar {
    background-color: var(--primary-color);
    color: var(--white);
    font-size: 0.85rem;
    padding: 8px 0;
}
.top-bar a {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.3s;
}
.top-bar a:hover {
    opacity: 0.8;
}

/* ==========================================================================
   2. Header & Navbar
   ========================================================================== */
.navbar {
    padding: 15px 0;
    transition: all 0.3s ease;
}
.navbar.sticky-top {
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--dark-text) !important;
    padding: 10px 15px !important;
    transition: color 0.3s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
}
.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}
.navbar-nav .nav-link:hover::after, .navbar-nav .nav-link.active::after {
    width: 60%;
}
.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
}
.btn-login {
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
    border-radius: 8px;
    padding: 8px 26px;
    min-width: 125px;
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s;
}
.btn-login:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.dropdown-menu {
    min-width: 150px;
    padding: 5px 0;
}

/* Dropdown item beautiful hover */
.dropdown-item {
    transition: all 0.3s ease;
    padding: 5px 12px;
    border-radius: 4px;
    margin: 2px 6px;
    width: auto;
    font-size: 0.85rem;
}
.dropdown-item:hover, .dropdown-item:focus {
    background-color: rgba(0, 77, 38, 0.08); /* light primary green */
    color: var(--primary-color) !important;
    transform: translateX(3px);
}

.btn-dashboard {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 500;
    border-radius: 8px;
    padding: 8px 20px;
    transition: all 0.3s;
    border: 1.5px solid var(--primary-color);
}
.btn-dashboard:hover {
    background-color: var(--dark-text);
    border-color: var(--dark-text);
    color: var(--white);
}

/* ==========================================================================
   3. Hero Section
   ========================================================================== */
.hero-section {
    position: relative;
    background: linear-gradient(rgba(0, 118, 60, 0.65), rgba(0, 77, 39, 0.55)), url('../image/kegiatan (3).jpeg') 80% center/cover no-repeat;
    padding: 40px 0 140px 0; /* Padding atas dikurangi lagi menjadi 40px */
    color: var(--white);
    min-height: 65vh; 
    display: flex;
    align-items: flex-start;
}
.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.hero-desc {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}
.btn-hero {
    padding: 12px 30px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s;
}
.btn-hero-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: 2px solid var(--primary-color);
}
.btn-hero-primary:hover {
    background-color: #003d1e;
    color: var(--white);
    transform: translateY(-3px);
}
.btn-hero-outline {
    border: 2px solid var(--white);
    color: var(--white);
}
.btn-hero-outline:hover {
    background-color: var(--white);
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* ==========================================================================
   4. Statistik
   ========================================================================== */
.stat-card {
    background: var(--white);
    padding: 5px 2px;
    border-radius: 6px;
    text-align: center;
    transition: transform 0.3s;
}
.stat-card:hover {
    transform: translateY(-2px);
}
.stat-icon {
    font-size: 1rem;
    color: var(--secondary-color);
    margin-bottom: 2px;
}
.stat-number {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: var(--primary-color);
    margin-bottom: 0;
    line-height: 1;
}
.stat-card .small {
    font-size: 0.6rem;
    letter-spacing: 0;
}

/* ==========================================================================
   5. Sambutan Ketua
   ========================================================================== */
.ketua-img-wrapper {
    position: relative;
    display: inline-block;
}
.ketua-img-wrapper::before {
    content: '';
    position: absolute;
    top: 15px;
    left: -15px;
    right: 15px;
    bottom: -15px;
    background-color: var(--secondary-color);
    border-radius: 12px;
    z-index: -1;
}
.ketua-img {
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.quote-box {
    border-left: 4px solid var(--secondary-color);
    padding-left: 20px;
    font-style: italic;
    background: var(--white);
    padding: 20px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 20px;
}

/* ==========================================================================
   Cards General
   ========================================================================== */
.custom-card {
    background: var(--white);
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
}
.custom-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
    transform: translateY(-5px);
}

/* ==========================================================================
   7. Program Kerja (Timeline)
   ========================================================================== */
.timeline {
    position: relative;
    padding-left: 30px;
    margin: 0;
    list-style: none;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 7px;
    width: 2px;
    background-color: var(--secondary-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 30px;
}
.timeline-icon {
    position: absolute;
    left: -30px;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.2);
}

/* ==========================================================================
   8. Berita Terbaru
   ========================================================================== */
.news-img {
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.custom-card:hover .news-img {
    transform: scale(1.05);
}
.news-date {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* ==========================================================================
   10. Galeri
   ========================================================================== */
.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}
.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(21, 101, 192, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.gallery-overlay i {
    color: var(--white);
    font-size: 2rem;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.gallery-item:hover .gallery-img {
    transform: scale(1.1);
}
.gallery-item:hover .gallery-overlay {
    opacity: 1;
}
.gallery-item:hover .gallery-overlay i {
    transform: translateY(0);
}

/* ==========================================================================
   11. Download Populer
   ========================================================================== */
.download-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.bg-icon-pdf { background-color: rgba(220, 53, 69, 0.1); color: #dc3545; }
.bg-icon-word { background-color: rgba(13, 110, 253, 0.1); color: #0d6efd; }
.bg-icon-excel { background-color: rgba(25, 135, 84, 0.1); color: #198754; }

/* ==========================================================================
   16. Footer
   ========================================================================== */
.footer {
    background-color: #004d27; /* Dark Green Kemenag */
    color: #d1e7dd;
    padding-top: 80px;
}
.footer h5 {
    color: var(--white);
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 600;
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-links li {
    margin-bottom: 10px;
}
.footer-links a {
    color: #d1e7dd;
    text-decoration: none;
    transition: color 0.3s;
    display: inline-block;
}
.footer-links a:hover {
    color: var(--secondary-color);
    transform: translateX(5px);
}
.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.1);
    color: var(--white);
    margin-right: 10px;
    transition: all 0.3s;
}
.footer-social a:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
}
.footer-bottom {
    background-color: #00331a; /* Even Darker Green */
    padding: 20px 0;
    margin-top: 50px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Scroll To Top
   ========================================================================== */
#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}
#scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}
#scroll-to-top:hover {
    background-color: var(--dark-text);
    transform: translateY(-3px);
}

/* ==========================================================================
   Animations
   ========================================================================== */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--white);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(21, 101, 192, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hover effect for navbar dropdowns on desktop */
@media (min-width: 992px) {
    .navbar .dropdown:hover .dropdown-menu {
        display: block;
        margin-top: 0;
        animation: fadeUp 0.3s ease forwards;
    }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer Alignment Rules */
.footer-container {
    display: flex;
    align-items: flex-start;
}

.footer-column {
    margin-top: 0 !important;
    padding-top: 0 !important;
    align-self: flex-start;
}

/* Footer Ticker */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 1.5rem;
}
.ticker-text {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 45s linear infinite;
}
.ticker-text:hover {
    animation-play-state: paused;
}
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* Blue Kemenag Navbar Theme */
.bg-hijau-kemenag {
    background-color: rgba(0, 77, 38, 0.9) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}
.bg-hijau-kemenag .nav-link {
    color: #ffffff !important;
}
.bg-hijau-kemenag .nav-link:hover, .bg-hijau-kemenag .nav-link.active {
    color: var(--secondary-color) !important;
}
.bg-hijau-kemenag .navbar-brand h1 {
    color: #ffffff !important;
}
.bg-hijau-kemenag .navbar-brand span {
    color: #ffffff !important;
}
.bg-hijau-kemenag .navbar-toggler i {
    color: #ffffff !important;
}
.bg-hijau-kemenag .btn-login {
    border-color: rgba(255,255,255,0.6);
    color: #ffffff !important;
}
.bg-hijau-kemenag .btn-login:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #000 !important;
}
/* Ensure offcanvas keeps white background on mobile so links remain readable */
@media (max-width: 991px) {
    .offcanvas-body {
        background-color: #ffffff;
    }
    .offcanvas-body .nav-link {
        color: var(--dark-text) !important;
    }
    .offcanvas-body .nav-link:hover, .offcanvas-body .nav-link.active {
        color: var(--primary-color) !important;
    }
    .offcanvas-body .btn-login {
        border-color: var(--primary-color);
        color: var(--primary-color) !important;
    }
}

/* Transparent Submenu on Desktop */
@media (min-width: 992px) {
    .bg-hijau-kemenag .dropdown-menu {
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding-top: 10px;
    }
    .bg-hijau-kemenag .dropdown-item {
        color: #ffffff !important;
        font-weight: 500;
        text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    }
    .bg-hijau-kemenag .dropdown-item:hover, .bg-hijau-kemenag .dropdown-item:focus {
        background-color: transparent !important;
        color: var(--secondary-color) !important;
    }
}

/* Center footer on mobile */
@media (max-width: 767.98px) {
    .footer-column {
        text-align: center;
        align-items: center !important;
    }
    .footer-column .d-flex {
        justify-content: center !important;
        align-items: center !important;
    }
    .footer-social {
        justify-content: center !important;
        display: flex;
        gap: 10px;
    }
}
