/* ============================================
   ALL POST PAGE - Split View Layout (Modern)
   ============================================ */

a, button, .allpost-item, .btn, [role="button"], input, select, textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---- Split View Container ---- */
.allpost-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}
@media (min-width: 900px) {
  .allpost-split {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
}

/* ---- Left: Content Viewer ---- */
.allpost-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  min-height: 400px;
  line-height: 1.9;
  color: var(--gray-700);
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  font-size: 1rem;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}

.content-placeholder {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--gray-400);
}

/* ---- Content Markdown Body (konsisten dengan halaman lain) ---- */
.allpost-content .markdown-body {
  line-height: 1.9;
  color: var(--gray-700);
  font-size: 1rem;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.allpost-content .markdown-body p {
  margin-bottom: 1.25rem;
}
.allpost-content .markdown-body h1,
.allpost-content .markdown-body h2,
.allpost-content .markdown-body h3 {
  font-family: var(--font-display);
  color: var(--gray-900);
  margin: 2rem 0 0.75rem;
  line-height: 1.35;
}
.allpost-content .markdown-body h1 { font-size: 1.8rem; }
.allpost-content .markdown-body h2 { font-size: 1.4rem; }
.allpost-content .markdown-body h3 { font-size: 1.2rem; }
.allpost-content .markdown-body a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: break-word;
}
.allpost-content .markdown-body a:hover { text-decoration: underline; }
.allpost-content .markdown-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--gray-500);
  font-style: italic;
  background: var(--gray-50);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.allpost-content .markdown-body code {
  background: var(--gray-100);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85em;
  word-break: break-word;
}
.allpost-content .markdown-body pre {
  background: var(--gray-900);
  color: var(--gray-100);
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}
.allpost-content .markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.allpost-content .markdown-body ol,
.allpost-content .markdown-body ul {
  margin: 1.25rem 0;
  padding-left: 2rem;
  max-width: 100%;
  overflow-wrap: break-word;
  list-style-position: outside;
}

.allpost-content .markdown-body ol {
  list-style-type: decimal;
}

.allpost-content .markdown-body ul {
  list-style-type: disc;
}
.allpost-content .markdown-body li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* ---- Table Styling (sama seperti halaman berita/pengumuman) ---- */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  width: 100%;
}
.table-wrapper::-webkit-scrollbar { height: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: var(--gray-100); }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

.allpost-content .markdown-body table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.allpost-content .markdown-body thead {
  background-color: var(--gray-100);
}
.allpost-content .markdown-body th,
.allpost-content .markdown-body td {
  border: 1px solid var(--gray-200);
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: middle;
  min-width: 100px;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}
.allpost-content .markdown-body th {
  font-weight: 700;
  color: var(--gray-900);
  background-color: var(--gray-100);
}
.allpost-content .markdown-body tr:nth-child(even) {
  background-color: var(--gray-50);
}
.allpost-content .markdown-body tr:hover {
  background-color: var(--gray-100);
}

@media (max-width: 899px) {
  .allpost-content .markdown-body th,
  .allpost-content .markdown-body td {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
}

/* ---- Code Block (seperti PWA) — header + copy button ---- */
.code-block {
  margin: 1.5rem 0;
  border: 1px solid #334155;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1e293b;
}
.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  font-size: 0.72rem;
}
.code-block__lang {
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
}
.code-block__copy {
  padding: 3px 10px;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.code-block__copy:active {
  background: rgba(14,165,233,0.2);
  color: var(--primary);
  border-color: var(--primary);
}
.markdown-body .code-block pre {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.markdown-body .code-block pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ✅ Video Wrapper — konsisten dengan halaman lain */
.allpost-content .markdown-body .video-wrapper,
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 2rem 0;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  background-color: #000;
  width: 100%;
  min-width: 320px;
  box-sizing: border-box;
}
.allpost-content .markdown-body .video-wrapper iframe,
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
  border-radius: 12px;
  max-width: 100%;
}

/* ✅ Image Wrapper — konsisten dengan halaman lain */
.allpost-content .markdown-body .img-wrapper,
.img-wrapper {
  text-align: center;
  margin: 2rem 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
.allpost-content .markdown-body .img-wrapper img,
.img-wrapper img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  width: auto;
}

/* ---- Right: Sidebar List ---- */
.allpost-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  padding-right: 0.5rem;
  display: flex;
  flex-direction: column;
}
.allpost-list::-webkit-scrollbar { width: 5px; }
.allpost-list::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 3px; }
.allpost-list::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.allpost-list::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.allpost-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}

/* Search & filter tabs — flex-shrink:0 biar tidak terkompresi */
.allpost-sidebar .search-bar,
.allpost-sidebar .filter-tabs {
  flex-shrink: 0;
}

/* ---- All Post List Item (konsisten ukuran dengan halaman lain) ---- */
.allpost-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  position: relative;
  border-left: 4px solid var(--gray-300);
}
.allpost-item:hover {
  border-color: var(--primary-light);
  transform: translateX(5px);
}
.allpost-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.allpost-item.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 75%;
  border-radius: 0 4px 4px 0;
}
/* Warna border kiri berdasarkan tipe */
.allpost-item--berita { border-left-color: var(--primary); }
.allpost-item--pengumuman { border-left-color: var(--accent); }
.allpost-item--agenda { border-left-color: var(--success); }
.allpost-item.active.allpost-item--berita { border-left-color: var(--primary); }
.allpost-item.active.allpost-item--pengumuman { border-left-color: var(--accent); }
.allpost-item.active.allpost-item--agenda { border-left-color: var(--success); }

.allpost-item__thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-100);
}
.allpost-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.allpost-item__content {
  flex: 1;
  min-width: 0;
}
.allpost-item__type-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.allpost-item__type-badge--berita {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.allpost-item__type-badge--pengumuman {
  background: #fef3c7;
  color: #d97706;
}
.allpost-item__type-badge--agenda {
  background: #d1fae5;
  color: #059669;
}
.allpost-item__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}
.allpost-item__meta {
  font-size: 0.72rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.allpost-item.active .allpost-item__title { color: var(--primary-dark); }
.allpost-item.active .allpost-item__meta { color: var(--gray-600); }

/* ============================================
   MOBILE DRAWER — Sidebar sebagai panel geser
   ============================================ */

/* Toggle button & drawer — hidden by default (desktop) */
.post-drawer-toggle {
  display: none;
}

@media (max-width: 899px) {
  /* ---- Toggle Button ---- */
  .post-drawer-toggle {
    display: flex;
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    width: 30px;
    height: 72px;
    border-radius: 8px 0 0 8px;
    background: var(--primary);
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: -2px 2px 10px rgba(0,0,0,0.18);
    font-size: 0.95rem;
    transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
    opacity: 0.85;
  }
  .post-drawer-toggle:active {
    opacity: 1;
  }
  .post-drawer-toggle.open {
    background: var(--primary);
    right: min(85vw, 360px);
    border-radius: 8px 0 0 8px;
  }
  .post-drawer-toggle.open i {
    transform: rotate(180deg);
  }

  /* Pill hover — efek timbul */
  .post-drawer-toggle:hover {
    opacity: 1;
    box-shadow: -2px 2px 14px rgba(0,0,0,0.25);
  }

  /* ---- Sidebar menjadi drawer (fixed di kanan) ---- */
  .allpost-sidebar {
    position: fixed !important;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    height: 100dvh;
    z-index: 1002;
    background: var(--white);
    box-shadow: -4px 0 25px rgba(0,0,0,0.18);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 1.25rem 1rem 1.5rem;
    max-height: none !important;
    display: flex;
    flex-direction: column;
  }
  .allpost-sidebar.open {
    transform: translateX(0);
    border-radius: 16px 0 0 16px;
  }

  /* Header drawer */
  .allpost-sidebar::before {
    content: 'Daftar Postingan';
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-100);
    flex-shrink: 0;
  }

  /* Search & filter tabs di dalam drawer — flex shrink biar tetap di atas */
  .allpost-sidebar .search-bar {
    margin-bottom: 0.75rem !important;
    max-width: 100%;
    flex-shrink: 0;
  }
  .allpost-sidebar .search-bar input {
    font-size: 0.85rem;
    padding: 0.7rem 1rem 0.7rem 2.6rem;
  }

  /* Filter tabs */
  .allpost-sidebar .filter-tabs {
    flex-shrink: 0;
    margin-bottom: 0.75rem !important;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .allpost-sidebar .filter-tab {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.35rem 0.9rem;
  }

  /* List di dalam drawer — scroll sendiri */
  .allpost-sidebar .allpost-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }

  /* Item list lebih padat */
  .allpost-sidebar .allpost-item {
    padding: 0.75rem;
    gap: 0.6rem;
  }
  .allpost-sidebar .allpost-item__thumb {
    width: 48px;
    height: 48px;
  }
  .allpost-sidebar .allpost-item__title {
    font-size: 0.82rem;
  }
  .allpost-sidebar .allpost-item__meta {
    font-size: 0.65rem;
  }

  /* Load more di drawer */
  .allpost-sidebar .load-more-btn {
    font-size: 0.78rem;
    padding: 0.5rem 1.25rem;
  }

  /* Content — mobile full width */
  .allpost-content {
    padding: 1.5rem;
  }
}

/* ============================================
   LIGHT THEME — Pertajam tabel & code block
   ============================================ */
[data-theme="light"] .table-wrapper {
  border-color: var(--gray-300);
}
[data-theme="light"] .allpost-content .markdown-body table th {
  background-color: #e8edf5;
  color: #0f172a;
  border-color: #cbd5e1;
}
[data-theme="light"] .allpost-content .markdown-body table td {
  border-color: #cbd5e1;
}
[data-theme="light"] .allpost-content .markdown-body thead {
  background-color: #e8edf5;
}
[data-theme="light"] .allpost-content .markdown-body tr:nth-child(even) {
  background-color: #f0f4fa;
}
[data-theme="light"] .allpost-content .markdown-body tr:hover {
  background-color: #e2eaf5;
}
[data-theme="light"] .allpost-content .markdown-body code:not(pre code) {
  background: #e2e8f0;
  border: 1px solid #d1d9e6;
}
[data-theme="light"] .code-block {
  border-color: #cbd5e1;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
[data-theme="light"] .code-block__header {
  border-bottom-color: #cbd5e1;
  background: #f1f5f9;
}
[data-theme="light"] .code-block__lang {
  color: #64748b;
}
[data-theme="light"] .code-block pre {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
[data-theme="light"] .code-block pre code {
  color: #1e293b;
}

