<style>

/* =========================================================
   TEMA UTAMA (DARK CHARCOAL & ELEGAN)
   ========================================================= */

:root {
    --bg-main: #0b0f19;        /* Latar Belakang Utama */
    --card-bg: #1e293b;        /* Kartu Abu-Abu Tua */
    --card-border: #334155;    /* Border Garis Halus */
    --text-title: #f8fafc;      /* Putih Elegan */
    --text-body: #94a3b8;      /* Abu-Abu Terang */
    --accent-blue: #3b82f6;    /* Aksen Biru */
    --accent-purple: #6366f1;  
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.25);
}


/* =========================================================
   BACKGROUND WEBSITE
   ========================================================= */

body {
    background: var(--bg-main) !important;
    color: var(--text-body);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}


/* =========================================================
   JUDUL SECTION
   ========================================================= */

.page-title {
    color: var(--text-title) !important;
    font-weight: 700 !important;
    font-size: 1.15rem;
    margin-bottom: 0;
    position: relative;
}

.page-title:after {
    content: "";
    display: block;
    width: 100px;
    height: 3px;
    background: var(--accent-gradient);
    margin-top: 6px;
    border-radius: 4px;
}

.page-title i {
    color: var(--accent-blue) !important;
}


/* =========================================================
   KARTU CONTENT (KONTEN UTAMA)
   ========================================================= */

.col-lg-8 .card {
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: var(--shadow-soft) !important;
    transition: all 0.2s ease;
}

.col-lg-8 .card:hover {
    border-color: #475569 !important;
}


/* =========================================================
   JARAK ANTAR KOTAK (RAPAT)
   ========================================================= */

.col-lg-8 > .card {
    margin-bottom: 12px !important;
}

.col-lg-8 .row > [class*="col-"] {
    margin-bottom: 12px !important;
}

.col-lg-8 .mt-5 {
    margin-top: 24px !important;
}


/* =========================================================
   GAMBAR ARTIKEL
   ========================================================= */

.card-img-left {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 200px;
    display: block;
    border-top-left-radius: 9px;
    border-bottom-left-radius: 9px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

@media (max-width: 767px) {
    .card-img-left {
        border-top-left-radius: 9px;
        border-top-right-radius: 9px;
        border-bottom-left-radius: 0;
        height: 180px;
    }
}


/* =========================================================
   JUDUL ARTIKEL & DESKRIPSI
   ========================================================= */

.col-lg-8 .card-title,
.col-lg-8 .card-title a {
    color: var(--text-title) !important;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none !important;
    line-height: 1.4;
}

.col-lg-8 .card-title a:hover {
    color: var(--accent-blue) !important;
}

.col-lg-8 .card-body .small,
.col-lg-8 small {
    color: #818cf8 !important;
    font-size: 0.8rem;
}

.col-lg-8 .card-text {
    color: #cbd5e1 !important;
    line-height: 1.5;
    font-size: 0.875rem;
    margin-bottom: 8px;
}


/* =========================================================
   BUTTON / TOMBOL KONTEN UTAMA
   ========================================================= */

.col-lg-8 .btn {
    background: var(--accent-gradient) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 6px 14px !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
}

.col-lg-8 .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}


/* =========================================================
   FOOTER FOTO & VIDEO
   ========================================================= */

.col-lg-8 .card-footer {
    background: rgba(15, 23, 42, 0.3) !important;
    border-top: 1px solid var(--card-border) !important;
}

.col-lg-8 .embed-responsive {
    overflow: hidden;
    border-radius: 10px !important;
    border: 1px solid var(--card-border);
}


/* =========================================================
   GARIS FOOTER HALAMAN
   ========================================================= */

footer .page-title,
footer .footer-widget-title,
footer h4,
footer h5 {
    position: relative !important;
    display: block !important;
    padding-bottom: 12px !important;
    margin-bottom: 25px !important;
    border-bottom: 2px solid #fbbc05 !important;
    color: #ffffff !important;
    font-weight: bold !important;
}

footer .page-title:after,
footer .footer-widget-title:after,
footer h4:after,
footer h5:after {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    bottom: -2px !important;
    width: 80px !important;
    height: 4px !important;
    background: #0f6fc7 !important;
    border-radius: 2px !important;
    z-index: 10 !important;
    padding: 0 !important;
    margin: 0 !important;
}

footer .primary-footer p,
footer .primary-footer .address-info,
footer .primary-footer div[class*="content"] {
    margin-top: 15px !important;
}

footer .tag-content-block,
footer .tagcloud,
footer .tag {
    margin-top: 15px !important;
    clear: both !important;
}

footer .social-icons,
footer .follow-us-icons,
footer .social-icon-wrapper {
    margin-top: 18px !important;
    clear: both !important;
}


/* =========================================================
   DESAIN MODERN SIDEBAR (FORCE OVERRIDE - MELENGKUNG & HOVER NYALA)
   ========================================================= */

/* Reset Container Sidebar */
.sidebar,
.sidebar .widget,
.sidebar .card,
.sidebar .list-group,
.sidebar ul {
    border: none !important;
    background: transparent !important;
    padding-left: 0 !important;
    list-style: none !important;
}

/* Force Melengkung pada Seluruh Item Menu Sidebar */
.sidebar .list-group-item,
.sidebar .widget-content li,
.sidebar .widget ul li,
.sidebar .widget ul li a,
.sidebar a.list-group-item,
.sidebar .card-body a {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;         /* SUDUT FIX MELENGKUNG 12PX */
    margin-bottom: 10px !important;
    padding: 12px 18px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-decoration: none !important;
    overflow: hidden !important;
}

/* EFEK HOVER DIPERKUAT (Terangkat, Glow Menyala & Bergeser) */
.sidebar .list-group-item:hover,
.sidebar .widget-content li:hover,
.sidebar .widget ul li:hover,
.sidebar .widget ul li a:hover,
.sidebar a.list-group-item:hover,
.sidebar .card-body a:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%) !important; /* Gradasi Biru Terang */
    border-color: #60a5fa !important;
    color: #ffffff !important;
    transform: translateY(-3px) translateX(6px) !important;                    /* Efek Bergeser Naik & Kanan */
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45) !important;                  /* Glow Biru Menyala */
}

/* Indikator Panah di Kanan Menu saat Hover */
.sidebar .list-group-item:hover::after,
.sidebar .widget ul li a:hover::after {
    content: "→";
    font-size: 1.1rem;
    color: #ffffff;
    margin-left: 8px;
}

/* Input Form & Dropdown pada Sidebar */
.sidebar select,
.sidebar .form-control,
.sidebar input[type="text"],
.sidebar input[type="email"] {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;         /* MELENGKUNG */
    padding: 10px 14px !important;
    height: auto !important;
}

/* Tombol Input/Pencarian Sidebar */
.sidebar .btn,
.sidebar .input-group-append .btn,
.sidebar button[type="submit"] {
    border-radius: 12px !important;         /* MELENGKUNG */
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%) !important;
    border: none !important;
    color: #ffffff !important;
    padding: 8px 16px !important;
}

/* Efek kotak saat menu navigasi disorot */
.nav-menu-hovered {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8) !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
    transform: translateY(-2px);
    <script>
    document.addEventListener("DOMContentLoaded", function() {
        // Mencari semua link menu di bagian navigasi atas
        const menuLinks = document.querySelectorAll('header a, nav a, .navbar a');
        
        menuLinks.forEach(link => {
            // Pastikan hanya menu navigasi utama yang diberi efek kotak melengkung
            if(link.parentElement.tagName === 'LI' || link.classList.contains('nav-link')) {
                link.style.borderRadius = "8px";
                link.style.padding = "8px 14px";
                link.style.transition = "all 0.3s ease";
                
                // Efek saat kursor menyorot (hover)
                link.addEventListener("mouseenter", function() {
                    this.style.background = "linear-gradient(135deg, #2563eb 0%, #1d4ed8)";
                    this.style.color = "#ffffff";
                    this.style.boxShadow = "0 4px 12px rgba(37, 99, 235, 0.4)";
                });
                
                // Efek saat kursor menjauh
                link.addEventListener("mouseleave", function() {
                    this.style.background = "transparent";
                    this.style.boxShadow = "none";
                });
            }
        });
    });
</script>
}
</style>


<!-- ===================================================== -->
<!-- KONTEN UTAMA (KIRI / COL-LG-8) -->
<!-- ===================================================== -->

<div class="col-lg-8 col-md-8 col-sm-12">

    <!-- TULISAN TERBARU -->
    <?php $query = get_latest_posts(5); if ($query->num_rows() > 0) { ?>

        <div class="d-flex justify-content-between align-items-center mb-3">
            <h5 class="page-title mb-0">
                <i class="fa fa-newspaper-o mr-2"></i>
                Tulisan Terbaru
            </h5>
        </div>

        <?php foreach($query->result() as $row) { ?>

            <div class="card overflow-hidden">
                <div class="row no-gutters">

                    <div class="col-md-5">
                        <a href="<?=site_url('read/'.$row->id.'/'.$row->post_slug)?>">
                            <img
                                src="<?=base_url('media_library/posts/medium/'.$row->post_image)?>"
                                class="card-img-left"
                                alt="<?=$row->post_title?>"
                            >
                        </a>
                    </div>

                    <div class="col-md-7">
                        <div class="card-body p-3 d-flex flex-column justify-content-between h-100">

                            <div>
                                <h5 class="card-title mb-2">
                                    <a href="<?=site_url('read/'.$row->id.'/'.$row->post_slug)?>">
                                        <?=$row->post_title?>
                                    </a>
                                </h5>

                                <div class="small mb-2">
                                    <i class="fa fa-calendar mr-1"></i>
                                    <?=date('d/m/Y H:i', strtotime($row->created_at))?>
                                    &nbsp;&bull;&nbsp;
                                    <i class="fa fa-user mr-1"></i>
                                    <?=$row->post_author?>
                                </div>

                                <p class="card-text">
                                    <?=substr(strip_tags($row->post_content), 0, 140)?>...
                                </p>
                            </div>

                            <div class="d-flex justify-content-between align-items-center mt-2 pt-2 border-top border-secondary">
                                <small>
                                    <i class="fa fa-eye mr-1"></i>
                                    <?=$row->post_counter?> views
                                </small>

                                <a href="<?=site_url('read/'.$row->id.'/'.$row->post_slug)?>" class="btn btn-sm">
                                    Baca Selengkapnya
                                    <i class="fa fa-arrow-right ml-1"></i>
                                </a>
                            </div>

                        </div>
                    </div>

                </div>
            </div>

        <?php } ?>

    <?php } ?>


    <!-- FOTO TERBARU -->
    <?php $query = get_albums(4); if ($query->num_rows() > 0) { ?>

        <div class="d-flex justify-content-between align-items-center mt-4 mb-3">
            <h5 class="page-title mb-0">
                <i class="fa fa-camera mr-2"></i>
                Foto Terbaru
            </h5>
        </div>

        <div class="row">

            <?php foreach($query->result() as $row) { ?>

                <div class="col-lg-6 col-md-6 col-sm-12">

                    <div class="card h-100 overflow-hidden">

                        <div class="position-relative overflow-hidden">
                            <img
                                src="<?=base_url('media_library/albums/'.$row->album_cover)?>"
                                class="card-img img-fluid"
                                style="height:180px; object-fit:cover;"
                                alt="<?=$row->album_title?>"
                            >
                        </div>

                        <div class="card-body p-3">
                            <h5 class="card-title mb-1">
                                <?=$row->album_title?>
                            </h5>
                            <p class="card-text small mb-0">
                                <?=$row->album_description?>
                            </p>
                        </div>

                        <div class="card-footer p-2 px-3">
                            <button
                                type="button"
                                onclick="photo_preview(<?=$row->id?>)"
                                class="btn btn-sm float-right"
                            >
                                <i class="fa fa-search mr-1"></i>
                                Lihat Foto
                            </button>
                            <div class="clearfix"></div>
                        </div>

                    </div>

                </div>

            <?php } ?>

        </div>

    <?php } ?>


    <!-- VIDEO TERBARU -->
    <?php $query = get_videos(4); if ($query->num_rows() > 0) { ?>

        <div class="d-flex justify-content-between align-items-center mt-4 mb-3">
            <h5 class="page-title mb-0">
                <i class="fa fa-youtube-play mr-2"></i>
                Video Terbaru
            </h5>
        </div>

        <div class="row">

            <?php foreach($query->result() as $row) { ?>

                <div class="col-md-6 col-sm-12">
                    <div class="card overflow-hidden">
                        <div class="embed-responsive embed-responsive-16by9">
                            <iframe
                                class="embed-responsive-item"
                                src="https://www.youtube.com/embed/<?=$row->post_content?>"
                                allowfullscreen>
                            </iframe>
                        </div>
                    </div>
                </div>

            <?php } ?>

        </div>

    <?php } ?>

</div>


<!-- ===================================================== -->
<!-- SIDEBAR KANAN (TERHUBUNG OTOMATIS) -->
<!-- ===================================================== -->

<?php $this->load->view('themes/blue_sky/sidebar')?>

/* =========================================================
   PERBAIKAN TAMPILAN HEADER BRANDING (MIN 1 BLITAR)
   ========================================================= */

/* Latar Belakang Area Header */
.top-bar, 
.header, 
.header-area, 
div[class*="header"], 
div[class*="top"] {
    background: linear-gradient(135deg, #0b1727 0%, #0f172a 100%) !important;
    border-bottom: 1px solid #1e293b !important;
}

/* Judul & Teks Header */
.site-title, .site-title a, h1, h2 {
    color: #facc15 !important; /* Warna Kuning Cerah */
    font-weight: bold !important;
}

/* Kontak, Email, RSS, dan Pencarian Berbentuk Kapsul Modern */
a[href*="mailto:"], 
a[href*="tel:"], 
a[href*="rss"], 
.top-right-content a, 
div[class*="header"] a {
    color: #e2e8f0 !important;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 0.82rem !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

/* Efek Disorot (Hover) Kapsul Kontak */
a[href*="mailto:"]:hover, 
a[href*="tel:"]:hover, 
.top-right-content a:hover, 
div[class*="header"] a:hover {
    background: #2563eb !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
}