/*
Theme Name: Mantep News
Theme URI: https://wpthemes.mantep.my.id/mantepnews/
Author: Mantep Web Develop
Author URI: https://mantep.my.id
Description: News Media Portal (Primary Identity Version)
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mantep
*/

/* =========================================
   0. GAP REMOVER (MOBILE FIX) - PENTING!
   ========================================= */

/* 1. Reset Dasar */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 2. TEKNIK COLLAPSE WHITESPACE (Solusi Space Kosong Mobile) */
/* Mematikan tinggi baris pada Body agar spasi/enter dari PHP tidak dianggap konten */
body {
    line-height: 0; 
}

/* Kembalikan tinggi baris normal pada elemen-elemen layout utama */
.site-header, 
.site-footer, 
.container, 
.offcanvas, 
.floating-ad-wrapper,
.fixed-bottom-ad-wrapper,
p, h1, h2, h3, h4, h5, h6, ul, li, a, span, div {
    line-height: 1.5; /* Standar keterbacaan */
}

/* 3. Pastikan elemen sticky anchor benar-benar hilang */
#sticky-anchor {
    display: block;
    height: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0;
    line-height: 0;
}

/* 4. Reset Margin HTML khusus Mobile (jika bukan Admin) */
@media (max-width: 600px) {
    html { margin-top: 0 !important; }
}


/* =========================================
   1. GLOBAL & ATOMIC COLOR MAPPING
   ========================================= */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color) !important;
    color: var(--text-color) !important;
}

/* --- PRIMARY COLOR (Dominant Identity) --- */
.btn-primary, 
.bg-primary, 
.text-primary,
.page-numbers.current,
.pagination .page-numbers:hover,
.bg-identity,
.site-footer { 
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important; 
    transition: background-color 0.3s ease;
}

/* Elemen Text berwarna Primary */
.text-danger, a:hover, .current-menu-item > a { 
    color: var(--primary-color) !important; 
}
.bg-danger { background-color: var(--primary-color) !important; }
.border-danger { border-color: var(--primary-color) !important; }

/* --- SECONDARY COLOR (Background Content) --- */

.dropdown-menu,
.navbar-nav-swipe li a {
    background-color: var(--secondary-color) !important;
    color: var(--text-color) !important;
}

/* --- ACCENT COLOR (Dark Elements) --- */
.ticker-wrap, 
.bg-dark,
.ticker-container-integrated .bg-dark {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
}

/* --- LINE COLOR (Borders) --- */
.border, .border-top, .border-bottom, .border-end, .border-start, hr {
    border-color: var(--line-color) !important;
}

/* --- TEXT & LINK --- */
h1, h2, h3, h4, h5, h6, .text-dark, .article-content {
    color: var(--text-color) !important;
}
.text-muted {
    color: var(--text-color) !important; opacity: 0.7;
}
a {
    text-decoration: none; color: var(--link-color); transition: color 0.3s ease;
}

/* --- CONTAINER FIXES --- */
@media (min-width: 1200px) {
    .container, .container-lg, .container-md, .container-xl { max-width: 900px !important; }
}
img { max-width: 100%; height: auto; }
.custom-logo { max-height: 77px; width: auto; }


/* =========================================
   2. STICKY HEADER SETUP (JS FORCED)
   ========================================= */

/* Default Header State */
.site-header {
    width: 100%;
    z-index: 1020;
    position: relative; 
    margin-top: 0 !important; /* Paksa nempel atas */
    background-color: var(--secondary-color);
    transition: none; 
}

/* Class .is-fixed ditambahkan oleh JS saat scroll */
.site-header.is-fixed {
    position: fixed !important; /* Paksa Fixed */
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: slideDownHeader 0.3s ease forwards;
}

@keyframes slideDownHeader {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* FIX KHUSUS ADMIN BAR WORDPRESS */

/* 1. Tampilan Desktop (> 600px) */
/* Admin Bar Fixed, jadi Header harus mengalah turun 32px */
body.admin-bar .site-header.is-fixed {
    top: 32px;
    position: fixed !important;
}

/* 2. Tampilan Mobile (< 600px) */
/* Admin Bar di HP biasanya ikut scroll (hilang), jadi Header harus nempel di paling atas (0px) */
@media (max-width: 600px) {
    body.admin-bar .site-header.is-fixed {
        top: 0px; /* Ubah ke 0 agar tidak ada celah kosong */
        position: fixed !important;
    }
}


/* =========================================
   3. COMPONENTS (MENU, TICKER, OFFCANVAS)
   ========================================= */

/* Menu Swipe */
.navbar-nav-swipe { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 5px; gap: 8px; }
.navbar-nav-swipe::-webkit-scrollbar { display: none; }
.navbar-nav-swipe li a { display: inline-block; padding: 6px 16px; border: 1px solid var(--line-color); border-radius: 50px; font-size: 13px; font-weight: 600; white-space: nowrap; text-transform: uppercase; }

/* Ticker */
.ticker-wrap { font-size: 14px; }
.ticker-content { display: inline-block; white-space: nowrap; padding-left: 100%; animation: ticker-scroll 30s linear infinite; }
.ticker-content:hover { animation-play-state: paused; }
@keyframes ticker-scroll { 0% { transform: translate3d(0, 0, 0); } 100% { transform: translate3d(-100%, 0, 0); } }

/* Dark Mode Toggle */
#darkModeToggle { border: 1px solid var(--line-color); background: transparent; color: var(--text-color); }

/* Offcanvas */
.offcanvas-header { border-bottom: 1px solid var(--line-color); }
.mobile-grid-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mobile-grid-menu li a { width: 100%; display: flex; align-items: center; justify-content: center; padding: 10px; min-height: 45px; background-color: var(--background-color) !important; border: 1px solid var(--line-color); border-radius: 6px; color: var(--text-color); font-size: 13px; font-weight: 600; text-align: center; }

/* Mobile Side Menu (Grid 2 Kolom) */
.mobile-vertical-menu { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; list-style: none; }
.mobile-vertical-menu li { margin: 0 !important; border: none !important; }
.mobile-vertical-menu li a { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 5px; background-color: var(--background-color) !important; border: 1px solid var(--line-color); border-radius: 4px; font-size: 12px; font-weight: 600; min-height: 42px; line-height: 1.2; width: 100%; color: var(--text-color); }
.mobile-vertical-menu li a:hover { border-color: var(--primary-color); color: var(--primary-color) !important; background-color: #fff !important; }


/* =========================================
   4. CONTENT & FOOTER
   ========================================= */

.slider-caption { background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 100%); z-index: 2; padding: 20px; }
.slider-caption h3 a { color: #fff !important; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }

/* News List */
.news-list .card { background-color: transparent !important; box-shadow: none !important; border: none !important; border-bottom: 1px solid var(--line-color) !important; border-radius: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }
.news-list .news-item:last-child { border-bottom: none !important; }
.news-thumb-scale { transition: transform 0.4s ease; }
.news-item:hover .news-thumb-scale { transform: scale(1.1); }
.news-title a { font-size: 18px; line-height: 1.4; font-weight: 700; color: var(--text-color); }
#news-loadmore-btn { border: 2px solid var(--primary-color); color: var(--primary-color); background: transparent; transition: 0.3s; }
#news-loadmore-btn:hover { background: var(--primary-color); color: #fff; }
.article-content { font-size: 1.1rem; line-height: 1.8; }
.article-content blockquote { border-left: 4px solid var(--primary-color); padding-left: 1rem; font-style: italic; color: var(--text-muted); }

/* Share Icons */
.share-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff !important; transition: 0.3s; }
.share-icon:hover { transform: translateY(-3px); }
.btn-wa { background: #25D366; } .btn-fb { background: #1877F2; } .btn-x { background: #000; } .btn-tele { background: #0088cc; } .btn-copy { background: #666; }


/* =========================================
   5. FOOTER & MEGA MENU
   ========================================= */

.site-footer {
    padding: 40px 0 20px;
    --link-color: rgba(255, 255, 255, 0.8) !important;
    --text-color: rgba(255, 255, 255, 0.9) !important;
    --line-color: rgba(255, 255, 255, 0.2) !important;
}
.site-footer .btn-primary, .site-footer .badge.bg-danger { background-color: #ffffff !important; color: var(--primary-color) !important; border-color: #ffffff !important; }

/* Footer Network List (4 Cols) */
.footer-network-list { column-count: 4; column-gap: 20px; }
.footer-network-list li { page-break-inside: avoid; break-inside: avoid; margin-bottom: 6px; }
.footer-network-list li a { color: rgba(255,255,255,0.8); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 4px; }
@media (max-width: 1200px) { .footer-network-list { column-count: 3; } }
@media (max-width: 768px) { .footer-network-list { column-count: 2; } }

/* Footer Horizontal (Center) */
.footer-horizontal-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 20px; }
.footer-horizontal-menu li a { color: rgba(255,255,255,0.7); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-horizontal-menu li a:hover { color: #fff; text-decoration: underline; }
.footer-horizontal-menu li:not(:last-child)::after { content: "|"; color: rgba(255,255,255,0.2); margin-left: 20px; pointer-events: none; }
@media (max-width: 576px) { .footer-horizontal-menu li:not(:last-child)::after { display: none; } }
.footer-logo { filter: brightness(0) invert(1); max-height: 50px; }


/* =========================================
   6. DARK MODE
   ========================================= */

body.dark-mode .bg-identity,
body.dark-mode .site-footer { background-color: #1a1a1a !important; border-color: #333 !important; color: #e0e0e0 !important; }
body.dark-mode .bg-identity a, body.dark-mode .site-footer a { color: #e0e0e0 !important; }
body.dark-mode .bg-identity .current-menu-item a { background-color: #333 !important; color: var(--text-color) !important; }
body.dark-mode .bg-white, body.dark-mode .bg-light { background-color: var(--secondary-color) !important; color: var(--text-color) !important; }
body.dark-mode .border, body.dark-mode .border-top, body.dark-mode .border-bottom { border-color: var(--line-color) !important; }
body.dark-mode .form-control { background-color: var(--background-color); border-color: var(--line-color); color: var(--text-color); }
body.dark-mode .btn-close { filter: invert(1); }
body.dark-mode .site-header .custom-logo, body.dark-mode .offcanvas-logo img { filter: brightness(0) invert(1) !important; -webkit-filter: brightness(0) invert(1) !important; transition: filter 0.3s ease; }
body.dark-mode .text-danger, a:hover, .current-menu-item > a { 
    color: var(--text-color) !important; 
}
body.dark-mode .card{
    background-color: var(--background-color);
}
body.dark-mode .wpp-c-badge{
    background-color: var(--background-color);
}

/* Paksa background offcanvas mengikuti variabel tema */
.offcanvas, .offcanvas-header, .offcanvas-body {
    background-color: var(--background-color) !important;
    color: var(--text-color) !important;
}

/* Ubah warna tombol close (X) menjadi putih saat dark mode */
body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Pastikan border terlihat halus di dark mode */
body.dark-mode .offcanvas .border-bottom {
    border-color: var(--line-color) !important;
}

/* Pastikan judul menu (h6) berwarna terang di dark mode */
body.dark-mode .offcanvas h6.text-muted {
    color: var(--text-color) !important;
    opacity: 0.6;
}

/* =========================================
   7. ADS
   ========================================= */
.floating-ad-wrapper { position: fixed; top: 0px; width: 160px; z-index: 9999; }
.floating-left { left: 10px; } .floating-right { right: 10px; }
@media (max-width: 1200px) { .floating-ad-wrapper { display: none !important; } }
.close-ad-btn { position: absolute; top: 5px; right: 0; background: #333; color: #fff; border: none; font-size: 10px; padding: 2px 6px; }
.fixed-bottom-ad-wrapper { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--secondary-color); border-top: 1px solid var(--line-color); z-index: 9999; padding: 5px 0; display: flex; justify-content: center; }
.close-ad-btn-footer { position: absolute; right: 10px; top: -30px; background: var(--primary-color); color: #fff; border: none; padding: 4px 10px; font-size: 12px; border-radius: 4px 4px 0 0; cursor: pointer; }