/* ===============================
   JMG Informasi – UI Core
   =============================== */

:root {
  --jmg-primary: #0D2243;
  --jmg-secondary: #0345BF;
  --bg-light: #F6F7F8;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --card-bg: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-main);
}

/* ===============================
   Header
   =============================== */

.app-header {
  background: var(--jmg-primary);
  color: #fff;
  padding: 14px 0;
}

.app-header .container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-title {
  font-size: 18px;
  font-weight: 600;
}

/* ===============================
   Layout
   =============================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===============================
   Search Box
   =============================== */

.search-box {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-box input,
.search-box select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

.search-box button {
  background: var(--jmg-secondary);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

.search-box button:hover {
  opacity: 0.9;
}

/* ===============================
   Grid Cards
   =============================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  transition: transform .15s ease, box-shadow .15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #e5e7eb;
}

.card-body {
  padding: 14px;
}

.card-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.card-title a {
  text-decoration: none;
  color: var(--text-main);
}

.card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-summary {
  font-size: 14px;
  color: #374151;
}

/* ===============================
   Detail Page
   =============================== */

.detail-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.detail-header {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.detail-cover {
  width: 260px;
}

.detail-cover img {
  width: 100%;
  border-radius: 8px;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.btn-primary {
  display: inline-block;
  background: var(--jmg-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
}

.btn-primary:hover {
  background: #08182f;
}

/* ===============================
   Footer
   =============================== */

.app-footer {
  margin-top: 40px;
  padding: 16px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.content { flex: 1; }
.description { font-size: 15px; line-height: 1.6; color: #374151; }
.actions { margin-top: 18px; }
.back { margin-top: 16px; }
.back a { text-decoration: none; color: var(--jmg-primary); }
.back a:hover { text-decoration: underline; }

/* ===============================
   Sub-Category Horizontal Cards
   =============================== */

.subcat-card {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 16px 18px 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.subcat-header h3 {
  font-size: 16px;
  color: var(--jmg-secondary);
  margin: 0 0 12px;
}

.subcat-count {
  font-size: 12px;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  color: #374151;
}

/* Row scroll */
.subcat-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

/* Hide scrollbar (nice UX) */
.subcat-row::-webkit-scrollbar {
  height: 6px;
}
.subcat-row::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

/* Item */
.subcat-item {
  min-width: 160px;
  max-width: 160px;
  flex-shrink: 0;
}

.subcat-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e7eb;
}

.subcat-title {
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

.subcat-title a {
  text-decoration: none;
  color: var(--text-main);
}

.subcat-title a:hover {
  text-decoration: underline;
}

.subcat-year {
  font-size: 12px;
  color: var(--text-muted);
}

/* Mobile tweak */
@media (max-width: 640px) {
  .subcat-item {
    min-width: 140px;
    max-width: 140px;
  }
  .subcat-item img {
    height: 180px;
  }
}
/* ================= Header Branding ================= */

.app-header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-brand {
  display: flex;
  align-items: center;
}

.app-logo {
  height: 75px;          /* desktop */
  width: auto;
}

/* Tajuk */
.app-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

/* Mobile */
@media (max-width: 640px) {
  .app-logo {
    height: 36px;
  }
  .app-title {
    font-size: 16px;
  }
}
/* ===============================
   Hero Search (Big Search Bar)
   =============================== */

.search-hero {
  background: #fff;
  padding: 22px;
  border-radius: 14px;
  margin: 20px 0 24px;
  display: grid;
  grid-template-columns: 1fr 220px 120px auto;
  gap: 12px;
  align-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.search-input {
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
}

.search-select,
.search-year {
  padding: 14px 14px;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
}

.search-button {
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: var(--jmg-primary);
  color: #fff;
  white-space: nowrap;
}

.search-button:hover {
  background: #08182f;
}

/* Responsive */
@media (max-width: 900px) {
  .search-hero {
    grid-template-columns: 1fr;
  }

  .search-button {
    width: 100%;
    justify-content: center;
  }
}
.subcat-title-link a {
  color: var(--jmg-secondary);
  text-decoration: none;
}
.subcat-title-link a:hover {
  text-decoration: underline;
}
/* ===============================
   Archive Box (Index & Category)
   =============================== */

.archive-box {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  margin-top: 18px;
}

.archive-box-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--jmg-primary);
}

.archive-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
}
/* ===============================
   Admin Header – Logout Button
   =============================== */

.admin-header-bar {
  justify-content: space-between;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-header-right {
  display: flex;
  align-items: center;
}

.admin-logout-btn {
  background: rgba(255,255,255,.15);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.admin-logout-btn:hover {
  background: rgba(255,255,255,.25);
}
/* ===============================
   Admin Header (FIX VISIBILITY)
   =============================== */

.admin-header {
  background: #0D2243; /* JMG Navy */
  color: #ffffff;
}

.admin-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 90px;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header-left h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.admin-header-left p {
  margin: 0;
  font-size: 14px;
  color: #dbeafe;
}

.admin-header-right {
  display: flex;
  align-items: center;
}

/* Log keluar button */
.admin-logout-btn {
  background: #ef4444;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

.admin-logout-btn:hover {
  background: #dc2626;
}
/* =========================================
   Page background stripes (subtle & readable)
   ========================================= */
body.page-stripes {
  background: repeating-linear-gradient(
  45deg,
  #ffffff 0,
  #ffffff 4px,
  #fafafa 4px,
  #fafafa 8px
  );
}

/* ===============================
   JMG Header – Dark Blue
   =============================== */
.jmg-header {
  background-color: #152042;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Logo kiri – besar & kemas */
.jmg-logo {
  height: 64px;
  width: auto;
}

/* Tajuk kanan – hujung header */
.jmg-header-title {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .jmg-header-title {
    font-size: 0.95rem;
  }

  .jmg-logo {
    height: 52px;
  }
}

/* ===============================
   Document Cover (A4 style)
   =============================== */
.doc-cover {
  width: 100%;
  aspect-ratio: 1 / 1.414;   /* Nisbah A4 */
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.doc-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;   /* crop cantik, tak herot */
  display: block;
}
/* ===============================
   DOCUMENT BOOK COVER STYLE
   =============================== */

.doc-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.2; /* hampir A4 */
  background: #f8f9fa;
  border-radius: 4px;
  overflow: hidden;

  /* bayang buku */
  box-shadow:
    0 10px 18px rgba(0,0,0,0.18),
    0 2px 4px rgba(0,0,0,0.12);

  transition: transform .25s ease, box-shadow .25s ease;
}

/* Spine buku (tulang kiri) */
.doc-cover::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 8%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.25),
    rgba(0,0,0,0.05)
  );
  z-index: 2;
}

/* Highlight nipis tepi kanan */
.doc-cover::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(255,255,255,0.6);
  z-index: 2;
}

/* Imej cover */
.doc-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hover effect */
a:hover .doc-cover {
  transform: translateY(-6px);
  box-shadow:
    0 16px 28px rgba(0,0,0,0.25),
    0 6px 10px rgba(0,0,0,0.18);
}
/* ===============================
   DOCUMENT COVER (VIEW PAGE)
   =============================== */
.doc-cover-wrapper {
  max-width: 260px;
  margin: 0 auto;
}

.doc-cover {
  aspect-ratio: 3 / 4;           /* buku laporan */
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 8px 20px rgba(0,0,0,.15),
    0 2px 6px rgba(0,0,0,.08);
}

.doc-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;             /* elak herot */
  display: block;
}
/* Default – seragam macam buku rak */
.doc-cover.cover-standard {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
}

.doc-cover.cover-standard img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Natural size – ikut saiz asal imej */
.doc-cover.cover-natural {
  aspect-ratio: auto;
  background: transparent;
}

.doc-cover.cover-natural img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.visitor-counter {
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding-bottom: 0;
}
