/**
 * MediaPress V2: Fullscreen Story Style with Expandable Info
 * Update: Full width, Dynamic Title Clamp, & Optimized Overlay
 */

/* 1. Reset Global */
html, 
body.v2-body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background-color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 2. Container Utama Scroll Snap */
.v2-story-fullscreen {
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.v2-story-fullscreen::-webkit-scrollbar {
    display: none;
}

/* 3. Slide Berita */
.story-slide {
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
}

/* 4. Gambar Background */
.story-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.story-bg img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* 5. UI Overlay (Gradasi & Konten) */
.story-ui-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    /* Gradasi lebih halus agar teks putih kontras */
    background: linear-gradient(to top, 
        rgba(0,0,0,1) 0%, 
        rgba(0,0,0,0.8) 30%, 
        rgba(0,0,0,0.3) 60%, 
        transparent 100%);
    padding: 60px 20px 20px; /* Padding samping rata kiri kanan sesuai instruksi */
    z-index: 10;
    box-sizing: border-box;
}

.story-info-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #fff;
    position: relative;
}

.story-meta-info {
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
}

/* Kategori Berita */
.story-cat-label a {
    color: deepskyblue;
    font-size: small;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.story-date-time {
    font-size: x-small;
    padding-left: 10px;
    border-left: 1px solid;
}

/* Judul - Dengan Logika Buka Tutup Natural */
.story-main-title {
    font-size: x-large;
    line-height: 1.3;
}

.story-main-title a {
    color: #fff;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Saat Terbuka: Judul Muncul Full */
.story-info-container.is-open .story-main-title a {
    -webkit-line-clamp: unset; 
    display: block;
    overflow: visible;
}

/* Konten Expandable (Ringkasan/Expert) */
.story-expandable-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

/* Saat Terbuka: Tampilkan Ringkasan */
.story-info-container.is-open .story-expandable-content {
    max-height: 500px; /* Cukup untuk judul full + excerpt */
    opacity: 1;
}

.story-excerpt {
    font-size: small;
    line-height: 1.5;
    color: #ccc;
    margin-bottom: 15px;
}

.story-main-title, 
.story-expandable-content {
    padding-right: 50px;
}

.btn-read-more {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.6);
    color: #fff;
    text-decoration: none;
    font-size: x-small;
    border-radius: 25px;
    margin-bottom: 10px;
    line-height: 1;
}

/* Tombol Toggle Panah */
.story-toggle-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    outline: none;
}

.icon-arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
    transform: rotate(-135deg); /* Panah Atas */
    transition: transform 0.4s ease;
}

/* Putar Panah saat Terbuka */
.story-info-container.is-open .icon-arrow {
    transform: rotate(45deg); /* Panah Bawah */
}

/* 6. Responsif & Fixes */
@media (max-width: 768px) {
    .v2-story-fullscreen, .story-slide {
        height: 100dvh; 
    }
    .story-main-title {
        font-size: initial;
    }
}

.no-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #222 0%, #000 100%);
}

/* =========================================
   1. SIDEBAR ACTIONS (RIGHT SIDE)
   ========================================= */
.story-actions-sidebar {
    position: absolute;
    right: 10px;
    bottom: 120px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 999;
    pointer-events: auto;
}

/* Base Style untuk Semua Item (Like, Chat, Save, Share) */
.action-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s ease, color 0.3s ease;
    width: 50px; /* Lebar area klik yang konsisten */
}

/* Link di dalam Action Item (Khusus Komentar) */
.action-item a, 
.action-item.btn-comment {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: inherit !important;
    text-decoration: none !important;
    width: 100%;
}

/* --- LOGIKA WARNA ACTIVE --- */

/* 1. WARNA LIKE (Merah saat Active) */
.action-item[data-type="like"].active {
    color: #fff !important;
}
.action-item[data-type="like"].active .action-icon {
    color: #fff !important;
}

/* 2. WARNA SAVE (Kuning/Gold saat Active) */
.action-item[data-type="save"].active {
    color: #fff !important;
}
.action-item[data-type="save"].active .action-icon {
    color: #fff !important;
}

/* Efek Klik (Feedback Visual) */
.action-item:active {
    transform: scale(0.85);
}

/* Styling Ikon */
.action-icon {
    font-size: 32px !important;
    line-height: 1 !important;
    display: block !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: color 0.3s ease;
}

/* Styling Angka di Bawah Ikon */
.action-count {
    font-size: x-small;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    display: block;
    width: 100%;
}

/* --- AVATAR AUTHOR & FOLLOW PLUS --- */
.avatar-item {
    position: relative;
    margin-bottom: 5px;
    transition: transform 0.2s ease;
}

.avatar-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    display: block;
}

.follow-plus {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff3e3e;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000; /* Style khas TikTok */
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.follow-plus .material-icons {
    font-size: 14px !important;
    font-weight: bold;
}

/* State Loading saat AJAX Berjalan */
.action-item.is-processing {
    opacity: 0.6;
    pointer-events: none;
}

/* =========================================
   2. GLOBAL SHARE MODAL (DARK THEME) - FA VERSION
   ========================================= */
.mp-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none; /* Muncul via JS */
    align-items: center;
    justify-content: center;
}

.mp-share-modal.is-active {
    display: flex;
}

.share-modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.share-modal-content {
    position: relative;
    background: #1a1a1a;
    width: 90%;
    max-width: 350px;
    padding: 25px;
    border-radius: 24px;
    border: 1px solid #333;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 10;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.share-header h4 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.close-share-modal {
    background: #333;
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-share-modal:hover {
    background: #444;
}

/* Grid Sosmed */
.share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.share-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none !important;
    color: #aaa;
    font-size: 11px;
    transition: all 0.2s ease;
}

.icon-circle {
    width: 55px;
    height: 55px;
    background: #2a2a2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

/* Ukuran Icon FontAwesome di Dalam Lingkaran */
.icon-circle i {
    font-size: 22px;
    color: #fff;
}

/* Hover Effects Berdasarkan Brand */
.share-link:hover span { color: #fff; }

.share-link.wa:hover .icon-circle { background: #25D366; border-color: #25D366; }
.share-link.fb:hover .icon-circle { background: #1877F2; border-color: #1877F2; }
.share-link.x-tw:hover .icon-circle { background: #000; border-color: #444; }
.share-link.rd:hover .icon-circle { background: #FF4500; border-color: #FF4500; }
.share-link.pin:hover .icon-circle { background: #BD081C; border-color: #BD081C; }
.share-link.copy-link-btn:hover .icon-circle { background: #444; border-color: #555; }

/* --- ALERT LIKE DAN SAVE FRONTPAGE --- */
.story-toast {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 12px 18px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    min-width: 250px;
}

.story-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.toast-icon { color: #ff4757; font-size: 20px; }
.toast-text { font-size: 13px; font-weight: 500; }

.toast-actions {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    padding: 2px 5px;
}

.toast-btn {
    padding: 6px 15px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff;
    letter-spacing: 0.5px;
}

.toast-btn.login { color: #00d2ff; }
.toast-sep { width: 1px; height: 12px; background: rgba(255,255,255,0.2); }

/* =========================================
   BOTTOM SHEET KOMENTAR (KOLOM DASAR)
   ========================================= */
.mp-comment-sheet {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2500; /* Lebih tinggi dari elemen lain */
    visibility: hidden;
    pointer-events: none;
}

.mp-comment-sheet.is-active {
    visibility: visible;
    pointer-events: auto;
}

/* Overlay Gelap di Belakang */
.comment-sheet-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.mp-comment-sheet.is-active .comment-sheet-overlay {
    opacity: 1;
}

/* Wadah Utama yang Slide Up */
.comment-sheet-content {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    height: 70vh; /* Tinggi 75% layar */
    background: #ffffff; /* Mas ganti ke warna tema Mas di sini */
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 -5px 30px rgba(0,0,0,0.3);
    overflow: hidden; /* Biar isinya nggak tembus pojokan radius */
}

.mp-comment-sheet.is-active .comment-sheet-content {
    transform: translateY(0);
}

/* Bagian Header (Garis Tarik & Judul) */
.sheet-comment-header {
    padding: 10px 0 15px;
    border-bottom: 1px solid #eeeeee;
    flex-shrink: 0; /* Header tidak boleh ikut mengkeret */
}
.handle-bar {
    width: 45px; height: 5px; background: #ddd;
    border-radius: 10px; margin: 0 auto 10px;
}
.header-main {
    display: flex; justify-content: space-between;
    align-items: center; padding: 0 20px;
}
.header-main h4 { margin: 0; font-size: 17px; font-weight: 700; color: #333; }
.close-comment-sheet {
    background: none; border: none; color: #333; cursor: pointer;
    display: flex; align-items: center; padding: 5px;
}

/* Mencegah halaman utama ikut geser saat modal buka */
body.no-scroll { 
    overflow: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
}

/* Gunakan yang ini saja Mas */
.mp-comment-sheet .sheet-comment-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    margin: 0;
    scroll-behavior: smooth;
}

.mp-comment-sheet .comment-list {
    padding: 0 20px;
    margin-bottom: 20px;
}

.mp-comment-sheet .comment-form-container {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 15px 20px;
    z-index: 100;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05); /* Bayangan tetap di bawah */
    border-top: none; 
}

body.single .comment-form-container {
    position: static;
    box-shadow: none;
    background: transparent;
    border-top: 1px solid #eee; /* Beri pemisah untuk single */
    margin-top: 30px;
}

/* ----- BANNER FRONTPAGE ----- */

.ad-in-feed-widget {
    touch-action: pan-y;
}

.ad-in-feed-widget .story-bg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-in-feed-widget .ad-content-render {
    position: relative;
    aspect-ratio: 9/16;
    height: 100vh;
    height: 100dvh;
    margin: auto;
    overflow: hidden;    
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gambar Banner (Struktur WP Block) */
.ad-in-feed-widget .ad-content-render figure {
    margin: 0;
}

.ad-in-feed-widget .ad-content-render img {
    object-fit: contain;
    display: block;
}

/* Elemen Iklan (Iframe, Ins, dsb) */
.ad-in-feed-widget .ad-content-render :is(iframe, ins, div:not(.wp-block-image)) {
    display: block;
    touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
}

.ad-badge-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: x-small;
    color: #999;
    line-height: 1;
}

.ad-badge-wrapper .material-icons-outlined {
    font-size: small;
    background-color: orangered;
    color: #fff;
    border-radius: 50%;
    padding: 5px;
}

