/* =========================================================
   PDlimau PLATFORM - STYLE.CSS (Responsive Pro Edition - Fixed)
   ========================================================= */

/* === 1. RESET & DASAR === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: "Poppins", sans-serif;
  background: linear-gradient(45deg, black, #B22222, #FFD700);
  background-attachment: fixed;
  color: #f1f1f1;
  scroll-behavior: smooth;

  /* === FIX UTAMA (WAJIB) === */
  max-width: 100% !important; 
  overflow-x: hidden !important; 
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* === 2. HEADER === */
.header {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.6em;
  font-weight: 700;
  color: #FFD700;
  cursor: pointer;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
  transition: 0.3s;
}

.nav-links a:hover {
  background: #FFD700;
  color: #000;
}

/* ** START: CSS KOLOM PENCARIAN BARU ** */
.search-form {
  display: flex;
  align-items: center;
  gap: 5px;
}

.search-form input[type="search"] {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3); /* Mengubah latar belakang agar cocok dengan tema */
  color: #ffffff;
  outline: none;
  font-size: 14px;
  width: 200px; /* Lebar standar untuk desktop */
}

.search-form button {
  background: #B22222; /* Merah */
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.3s;
}

.search-form button:hover {
  background: #ff4500; /* Orange-Red */
}
/* ** END: CSS KOLOM PENCARIAN BARU ** */


/* === 3. DASHBOARD LAYOUT === */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1300px;
  margin: auto;
}

.sidebar, .feed-area, .rightbar {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  box-shadow: none;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* === 4. CREATE POST === */
.create-post {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 20px;
}

.create-post textarea {
  width: 100%;
  height: 100px;
  resize: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  outline: none;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
}

.create-post textarea:focus {
  border-color: #FFD700;
}

.create-post button {
  background: #FFD700;
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: 0.3s;
}

.create-post button:hover {
  background: #ffeb3b;
}

/* === 5. POST & EMBED FIXES === */
.post {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: none;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.post-header img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
}

.post-header a {
  color: #FFD700;
  font-weight: 600;
}

.post-content {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
}

.post-content img,
.post-content video {
  margin-top: 10px;
  border-radius: 10px;
  width: 100%;
  height: auto;
  max-height: 450px;
  object-fit: cover;
}

.post-actions {
  display: flex;
  justify-content: space-around;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.post-actions button {
  border: none;
  background: transparent;
  color: #ccc;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
}

.post-actions button:hover {
  color: #FFD700;
}

/* === 6. PROFILE === */
.profile-header {
  text-align: center;
  margin-bottom: 20px;
}

.avatar-big {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #FFD700;
}

.profile-info {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.4;
}

.profile-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.profile-actions button {
  background: #FFD700;
  color: #000;
  padding: 8px 15px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.3s;
}

.profile-actions button:hover {
  background: #ffeb3b;
}

/* === 7. NOTIFICATIONS === */
#notif-popup {
  display: none;
  position: absolute;
  right: 15px;
  top: 60px;
  width: 320px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  padding: 12px;
  border-radius: 12px;
  color: #ffcc00;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 9999;
}

.notif-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.notif-item img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.notif-link {
  color: #ffcc00;
  font-size: 13px;
  text-shadow: 1px 1px 2px #000;
}

.notif-item:last-child {
  border-bottom: none;
}

/* === 8. RESPONSIVE ADAPTATION === */

/* Tablet dan laptop kecil (≤1024px) */
@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr 2fr;
  }
  .rightbar {
    display: none;
  }
}

/* HP layar sedang (≤768px) */
@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .header {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
  }

  .logo {
    font-size: 1.4em;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .create-post textarea {
    font-size: 16px;
  }

  .post-actions {
    justify-content: space-between;
  }

  .avatar-big {
    width: 90px;
    height: 90px;
  }
  
  /* FIX UTAMA: Kunci Kontainer Postingan di Layar Menengah */
  .post, 
  .feed-area {
      max-width: 100% !important; 
      overflow: hidden !important; 
  }
  
  /* Penyesuaian Kolom Pencarian di HP */
  .search-form {
    order: 3; /* Memaksa form pindah ke baris baru di bawah logo dan navigasi */
    width: 100%;
    margin-top: 10px;
  }
  .search-form input[type="search"] {
    flex-grow: 1;
    width: auto;
  }
}

/* HP kecil (≤480px) */
@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    font-size: 1.3em;
  }

  .nav-links a {
    font-size: 14px;
    margin: 3px 6px;
  }

  .create-post button {
    width: 100%;
    padding: 12px;
  }

  .post {
    padding: 12px;
    /* FIX UTAMA: Kunci Kontainer Postingan di Layar Kecil */
    max-width: 100% !important; 
    overflow: hidden !important; 
  }
  
  .feed-area {
      /* Pastikan area feed utama juga tidak melebar */
      max-width: 100% !important; 
      overflow: hidden !important; 
  }

  .notification {
    font-size: 14px;
  }
  
  /* Penyesuaian Tombol Cari */
  .search-form button {
    padding: 10px 12px; /* Membuat tombol sedikit lebih besar */
  }
  
  /* FIX TAMBAHAN KHUSUS FACEBOOK DI HP */
  /* Menargetkan iframe Facebook agar mengabaikan min-width SDK */
  iframe[src*="facebook.com"], 
  .fb-responsive-container iframe,
  .fb_iframe_widget iframe {
      min-width: unset !important;
  }
}

/* === 9. TAMBAHAN FIX & KOMENTAR (FINAL FIX UNTUK EMBED) === */

/* Global Fixes */
img, video {
  max-width: 100%;
  height: auto;
}

input, textarea, button {
  font-family: inherit;
}

/* Kunci Fix: Memaksa semua IFRAME agar responsif! */
iframe {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important; 
}


/* Tata letak untuk seluruh blok komentar */
.comment {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}

.avatar-mini {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-text {
  font-size: 14px;
  line-height: 1.4;
}

.comment-text strong {
  color: #FFD700;
}

.comment-text span {
  display: block;
}

/* === FIX ISOLASI EMBED FACEBOOK DAN IKLAN (VERSI GABUNGAN & KUAT) === */

/* Targetkan Pembungkus Utama dan Elemen Internal Facebook SDK */
.fb-responsive-container,
.ad-responsive-wrapper,
.fb_iframe_widget, 
.fb_iframe_widget span {
    /* Batasan Lebar Maksimum */
    max-width: 100% !important; 
    width: 100% !important; 
    
    /* Kunci: Menyembunyikan konten yang melebihi batas, mencegah layout melebar */
    overflow: hidden !important; 
    
    /* FIX SPESIFIK FACEBOOK: Menghapus lebar minimum yang disuntikkan */
    min-width: unset !important;
}

/* Tambahan: Untuk memastikan konten di dalam pembungkus tetap di tengah */
.fb-responsive-container,
.ad-responsive-wrapper {
    margin: 0 auto; 
}

/* === 10. STYLE UNTUK PRE-ROLL VIDEO IKLAN === */

.video-container {
    position: relative;
    width: 100%;
    /* Atur tinggi default container video */
    height: 300px; 
    background-color: black;
    margin-bottom: 10px;
}

.preroll-ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 50; /* Pastikan di atas video utama */
    padding: 20px;
}

.preroll-ad-overlay p {
    font-size: 1.1em;
    color: #FFD700;
    margin-bottom: 15px;
}

.ad-content-injected {
    width: 100%;
    /* Memastikan konten iklan dari admin_ad_content terlihat */
}

/* Pastikan video utama memenuhi container */
.main-video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Pastikan skip ad selalu terlihat */
button[id^="skipAd"], button[id^="skipPreroll"] {
    display: block !important;
    opacity: 1 !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
}
.vast-preroll video#vastPlayer<?= $p['id'] ?> {
    position: relative;
    z-index: 1;
}
