/*
Theme Name: WidiBlog Elegant Premium Ultra-Responsive V5
Theme URI: https://example.com/widiblog-elegant
Author: Gemini & Widi
Author URI: https://example.com
Description: Tema WordPress premium bergaya majalah modern. VERSI 5: Dilengkapi Sistem Auto-Grab Gambar di dalam postingan, 100% anti-kosong dan selalu rata tengah di HP.
Version: 1.5.0
License: GNU General Public License v2 or later
Text Domain: widiblog-elegant
*/

/* VARIABLE WARNA - ELEGANT PREMIUM PALETTE */
:root {
    --bg-body: #f4f5f6;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-ads: #ffffff;
    --text-main: #111111;
    --text-sub: #666666;
    --text-link: #0052cc;
    --accent-color: #ff4757;
    --border-color: #eef0f2;
    --badge-bg: #f0f4f8;
    --badge-text: #0052cc;
    --toggle-bg: #f4f5f6;
    --toggle-color: #111111;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    --radius-main: 16px;
}

[data-theme="dark"] {
    --bg-body: #0b0f19;
    --bg-header: #111827;
    --bg-card: #1f2937;
    --bg-ads: #ffffff;
    --text-main: #f3f4f6;
    --text-sub: #9ca3af;
    --text-link: #6366f1;
    --accent-color: #ff6b81;
    --border-color: #374151;
    --badge-bg: #1e1b4b;
    --badge-text: #818cf8;
    --toggle-bg: #374151;
    --toggle-color: #f3f4f6;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* RESET & BASE STYLE */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.625;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}
a {
    text-decoration: none;
    color: var(--text-link);
}

/* CONTAINER UTAMA */
.wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
    display: block;
}

/* HEADER & PREMIUM NAVIGATION */
header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}
.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
}
.logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.logo a {
    color: var(--text-main);
}
.logo-dot {
    width: 5px;
    height: 5px;
    background-color: var(--accent-color);
    border-radius: 50%;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle-btn {
    background-color: var(--toggle-bg);
    color: var(--toggle-color);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.menu-desktop {
    display: none;
}

.menu-toggle-btn-mobile {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1010;
}
.menu-toggle-btn-mobile span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-main);
    margin: 5px 0;
    transition: 0.3s ease;
}
#menu-checkbox {
    display: none;
}
.menu-mobile {
    position: fixed;
    top: 0;
    right: -100%;
    width: 260px;
    height: 100vh;
    background-color: var(--bg-header);
    padding: 80px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1005;
    border-left: 1px solid var(--border-color);
    list-style: none;
    box-shadow: -10px 0 30px rgba(0,0,0,0.05);
}
.menu-mobile li a {
    color: var(--text-main);
    font-size: 16px;
    font-weight: 600;
    padding: 8px 0;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

#menu-checkbox:checked ~ .menu-mobile { right: 0; }
#menu-checkbox:checked ~ .header-right .menu-toggle-btn-mobile span:nth-child(1) { transform: rotate(-45deg) translate(-5px, 5px); }
#menu-checkbox:checked ~ .header-right .menu-toggle-btn-mobile span:nth-child(2) { opacity: 0; }
#menu-checkbox:checked ~ .header-right .menu-toggle-btn-mobile span:nth-child(3) { transform: rotate(45deg) translate(-5px, -4px); }

/* ARTICLE CONTENT AREA & CARDS */
.content-area {
    width: 100%;
}
.article-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-main);
    margin: 0 auto 20px auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    text-align: center;
    width: 100%;
    max-width: 100%;
}

/* THUMBNAIL WRAPPER */
.post-thumbnail-wrapper {
    width: 100%;
    margin: 0 auto 16px auto;
    overflow: hidden;
    border-radius: calc(var(--radius-main) - 6px);
}
.featured-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.article-card:hover .featured-image {
    transform: scale(1.03);
}

/* PLACEHOLDER JIKA SAMA SEKALI TIDAK ADA GAMBAR */
.featured-image-placeholder {
    width: 100%;
    height: 180px;
    background-color: var(--border-color);
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.meta-info {
    font-size: 12px;
    color: var(--text-sub);
    margin: 0 auto 12px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    flex-wrap: wrap;
    width: 100%;
}
.category-badge a {
    background-color: var(--badge-bg);
    color: var(--badge-text);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 11px;
}
.article-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 auto 12px auto;
    color: var(--text-main);
    line-height: 1.35;
    letter-spacing: -0.3px;
    width: 100%;
}
.article-card h2 a {
    color: var(--text-main);
}
.article-card p {
    color: var(--text-sub);
    margin: 0 auto 18px auto;
    font-size: 14px;
    line-height: 1.55;
    width: 100%;
}
.read-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-link);
    margin: 0 auto;
}

/* RESPONSIVE IMAGES IN CONTENT */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: calc(var(--radius-main) - 6px);
    margin: 16px auto;
}

/* ADSENSE PLACEHOLDERS */
.ads-space {
    background-color: var(--bg-ads);
    color: #5f6368 !important;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px dashed #ccd1d9;
    border-radius: var(--radius-main);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
    padding: 10px;
    width: 100%;
    max-width: 100%;
}
.ads-top { height: 80px; }
.ads-middle { height: 250px; }
.ads-sidebar { height: 250px; }

/* SIDEBAR & PREMIUM WIDGETS */
sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}
.widget {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    text-align: center;
    width: 100%;
    max-width: 100%;
}
.widget h3, .widget .widgettitle {
    font-size: 14px;
    font-weight: 700;
    margin: 0 auto 16px auto;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    position: relative;
    padding-bottom: 8px;
}
.widget h3::after, .widget .widgettitle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 2px;
}
.widget ul {
    list-style: none;
    width: 100%;
}
.widget ul li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.widget ul li:last-child {
    border: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* PREMIUM FOOTER DESIGN */
footer {
    background: var(--bg-header);
    color: var(--text-sub);
    border-top: 1px solid var(--border-color);
    padding: 32px 16px;
    margin-top: 40px;
    width: 100%;
}
.footer-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}
.footer-links ul {
    list-style: none;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.footer-links ul li a {
    color: var(--text-sub);
    font-weight: 500;
    font-size: 13px;
}
.copyright {
    font-size: 12px;
    color: var(--text-sub);
    text-align: center;
    line-height: 1.5;
}

#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--text-main);
    color: var(--bg-header);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}
#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   BREAKPOINTS UNTUK LAYAR BESAR (DESKTOP & LAPTOP)
   ========================================================================== */
@media (min-width: 768px) {
    .wrapper { 
        display: grid;
        grid-template-columns: 1fr;
        padding: 0 24px; 
        margin: 40px auto; 
    }
    .nav-container { padding: 18px 24px; }
    .logo { font-size: 24px; }
    .menu-toggle-btn-mobile { display: none; }
    .menu-desktop { display: block; }
    
    .article-card { text-align: left; padding: 36px; margin: 0 0 32px 0; }
    .post-thumbnail-wrapper { margin: 0 0 20px 0; }
    .featured-image { margin: 0; }
    .featured-image-placeholder { height: 300px; }
    
     Tarik meta ke kiri kembali di desktop
    .meta-info { justify-content: flex-start; margin: 0 0 16px 0; }
    .article-card h2 { font-size: 26px; margin: 0 0 14px 0; }
    .article-card p { margin: 0 0 24px 0; }
    .read-more { margin: 0; }
    
    .widget { text-align: left; }
    .widget h3 { margin: 0 0 20px 0; }
    .widget h3::after, .widget .widgettitle::after { left: 0; transform: none; }
    sidebar { margin-top: 0; }
    
    .ads-top { height: 100px; margin: 0 0 24px 0; }
    .ads-middle { height: 280px; margin: 24px 0; }
    .ads-sidebar { height: 600px; margin: 24px 0; }
}

@media (min-width: 992px) {
    .wrapper {
        grid-template-columns: 2.2fr 1fr;
        gap: 40px;
    }
}
