/* 
 * Detik Theme CSS Reset dan Layout Fix
 * Untuk mengatasi masalah tampilan
 */

/* Ensure proper box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Reset body dan html */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

/* Container fix */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* Main content fix */
.main-content {
    background: #f8f9fa !important;
    width: 100%;
}

/* Featured section fix */
.featured-articles-section {
    width: 100%;
    background: white;
    padding: 20px;
    margin-bottom: 20px;
}

.featured-articles-section .container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Featured grid - pastikan 5 kolom */
.featured-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 2px;
    height: 400px;
    width: 100%;
    background: #e5e7eb;
}

/* Homepage featured (featured-container): image should fill card, overlay sits on image */
.featured-container .featured-main img,
.featured-container .featured-small img,
.featured-container .featured-large img {
    height: 100% !important;
}

.featured-container .featured-content {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: linear-gradient(transparent, rgba(0,0,0,0.8)) !important;
    height: auto !important;
    display: block !important;
    padding: 15px !important;
    padding-bottom: 16px !important;
    color: #fff !important;
}

.featured-container .featured-main .featured-content {
    padding: 20px !important;
    padding-bottom: 22px !important;
}

.featured-container .featured-small .featured-content {
    padding: 10px !important;
    padding-bottom: 14px !important;
}

/* Content sidebar wrapper fix */
.content-sidebar-wrapper {
    display: grid;
    grid-template-columns: 2fr 300px;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    width: 100%;
}

/* Featured artikel utama */
.featured-main {
    grid-row: 1 / -1;
    background: white;
    overflow: hidden;
    position: relative;
}

/* Featured artikel kecil */
.featured-item {
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

/* Gambar featured */
.featured-image {
    height: 70%;
    overflow: hidden;
}

.featured-image img,
.featured-image-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.featured-image-small {
    height: 120px;
    overflow: hidden;
}

/* Content featured */
.featured-content {
    padding: 15px;
    padding-bottom: 28px;
    height: 30%;
    display: flex;
    flex-direction: column;
}

.featured-main .featured-content {
    padding: 20px;
    padding-bottom: 34px;
}

.featured-small .featured-content {
    padding: 10px;
    padding-bottom: 20px;
}

.featured-content-small {
    padding: 12px;
    flex: 1;
}

/* Sidebar fix */
.main-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Footer Layout Fix */
.main-footer {
    clear: both;
    width: 100%;
    background: #1a1a1a !important;
    color: #ffffff !important;
    margin-top: 40px;
    padding: 40px 0 20px;
    position: relative;
    z-index: 10;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .featured-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .featured-main {
        grid-row: auto;
        height: 300px;
    }
    
    .featured-item {
        height: 200px;
        margin-bottom: 10px;
    }
    
    .content-sidebar-wrapper {
        padding: 10px;
    }
    
    .main-footer {
        margin-top: 20px;
        padding: 20px 0 10px;
    }
}

/* Fix overflow elements at bottom */
body {
    overflow-x: hidden;
}

.main-content {
    clear: both;
    position: relative;
    z-index: 1;
}

/* Ensure all floating elements are cleared before footer */
.main-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Content wrapper without sidebar */
.content-sidebar-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Force footer to stay at bottom and clear everything */
.main-footer {
    clear: both !important;
    float: none !important;
    position: relative !important;
    z-index: 99 !important;
}