:root{
  --brand:#159c49;
  --brand-dark:#0d6f34;
  --brand-darker:#084b24;
  --brand-light:#edf8f1;

  --text:#1b1f22;
  --muted:#68727a;

  --line:#dce5df;
  --bg:#f5f7f6;
  --white:#ffffff;

  --shadow:0 12px 30px rgba(0,0,0,.10);
  --radius:16px;
}


/* =====================================================
   GENERAL
===================================================== */

*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  padding:0;
}

body{
  font-family:Arial,Helvetica,sans-serif;
  color:var(--text);
  background:var(--bg);
}

a{
  color:inherit;
}

.wrap{
  width:min(1180px,calc(100% - 32px));
  margin:0 auto;
}


/* =====================================================
   HEADER
===================================================== */

.site-header{
  background:
    linear-gradient(
      135deg,
      var(--brand-darker) 0%,
      var(--brand-dark) 45%,
      var(--brand) 100%
    );

  color:#ffffff;
  padding:34px 0;
}


.header-inner{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:30px;
}


.header-brand{
  display:flex;
  align-items:center;
  gap:22px;
}


.logo-container{
  width:112px;
  height:112px;

  background:#ffffff;

  border-radius:14px;

  display:flex;
  align-items:center;
  justify-content:center;

  padding:7px;

  flex-shrink:0;

  box-shadow:
    0 8px 20px rgba(0,0,0,.14);
}


.ppm-logo{
  width:100%;
  height:100%;

  object-fit:contain;
  display:block;
}


.header-text{
  display:flex;
  flex-direction:column;
  justify-content:center;
}


.eyebrow{
  font-size:13px;

  font-weight:700;

  letter-spacing:1.5px;

  line-height:1.4;

  margin-bottom:7px;

  color:rgba(255,255,255,.86);
}


h1{
  margin:0;

  font-size:clamp(30px,5vw,48px);

  line-height:1.05;

  font-weight:700;

  color:#ffffff;
}


.home-link{
  text-decoration:none;

  border:1px solid rgba(255,255,255,.70);

  background:rgba(255,255,255,.08);

  padding:11px 18px;

  border-radius:999px;

  white-space:nowrap;

  font-size:14px;

  font-weight:700;

  transition:
    background .2s ease,
    color .2s ease;
}


.home-link:hover{
  background:#ffffff;
  color:var(--brand-dark);
}


/* =====================================================
   SEARCH AND FILTER
===================================================== */

.toolbar{
  display:grid;

  grid-template-columns:
    1fr
    180px
    220px;

  gap:12px;

  margin:30px 0 26px;
}


.toolbar input,
.toolbar select{
  width:100%;

  border:1px solid var(--line);

  background:#ffffff;

  color:var(--text);

  padding:13px 14px;

  border-radius:10px;

  font:inherit;

  outline:none;

  transition:
    border-color .2s ease,
    box-shadow .2s ease;
}


.toolbar input:focus,
.toolbar select:focus{
  border-color:var(--brand);

  box-shadow:
    0 0 0 3px rgba(21,156,73,.12);
}


/* =====================================================
   COLLECTION TITLE
===================================================== */

.section-title-row{
  display:flex;

  justify-content:space-between;

  align-items:center;

  gap:20px;
}


.section-title-row h2{
  font-size:24px;

  margin:6px 0 18px;

  color:var(--brand-dark);
}


.count-label{
  color:var(--muted);

  font-size:14px;
}


/* =====================================================
   PUBLICATION GRID
===================================================== */

.book-grid{
  display:grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(220px,1fr)
    );

  gap:24px;

  padding-bottom:44px;
}


.book-card{
  background:#ffffff;

  border:1px solid var(--line);

  border-radius:var(--radius);

  overflow:hidden;

  box-shadow:
    0 5px 18px rgba(0,0,0,.05);

  transition:
    transform .2s ease,
    box-shadow .2s ease,
    border-color .2s ease;
}


.book-card:hover{
  transform:translateY(-4px);

  box-shadow:var(--shadow);

  border-color:#bfd8c7;
}


/* =====================================================
   BOOK COVER
===================================================== */

.cover-wrap{
  aspect-ratio:3/4;

  background:
    linear-gradient(
      160deg,
      var(--brand-darker),
      var(--brand)
    );

  position:relative;

  overflow:hidden;
}


.cover-wrap img{
  width:100%;
  height:100%;

  object-fit:cover;

  display:block;
}


.fallback-cover{
  width:100%;
  height:100%;

  display:flex;

  flex-direction:column;

  justify-content:center;

  align-items:center;

  text-align:center;

  color:#ffffff;

  padding:24px;
}


.fallback-cover .small{
  font-size:12px;

  letter-spacing:1.5px;

  opacity:.78;

  margin-bottom:12px;

  text-transform:uppercase;
}


.fallback-cover strong{
  font-size:22px;

  line-height:1.2;

  font-weight:700;
}


/* =====================================================
   CARD INFORMATION
===================================================== */

.card-body{
  padding:17px;
}


.meta{
  font-size:12px;

  color:var(--brand);

  font-weight:700;

  text-transform:uppercase;

  letter-spacing:.5px;
}


.book-title{
  font-size:17px;

  line-height:1.35;

  margin:8px 0 8px;

  min-height:46px;

  color:#17201a;
}


.description{
  font-size:13px;

  line-height:1.45;

  color:var(--muted);

  margin:0 0 15px;

  min-height:38px;
}


/* =====================================================
   READ BUTTON
===================================================== */

.read-btn{
  display:block;

  text-align:center;

  text-decoration:none;

  background:var(--brand);

  color:#ffffff;

  padding:11px 13px;

  border-radius:9px;

  font-weight:700;

  font-size:13px;

  letter-spacing:.2px;

  transition:
    background .2s ease,
    transform .2s ease;
}


.read-btn:hover{
  background:var(--brand-dark);
}


/* =====================================================
   EMPTY STATE
===================================================== */

.empty-state{
  background:#ffffff;

  border:1px dashed #b8cec0;

  border-radius:var(--radius);

  padding:40px;

  text-align:center;

  color:var(--muted);

  margin-bottom:40px;
}


/* =====================================================
   FOOTER
===================================================== */

.footer{
  border-top:1px solid var(--line);

  padding:24px 0;

  color:var(--muted);

  font-size:13px;

  background:#ffffff;

  text-align:center;
}


/* =====================================================
   VIEWER
   Saiz dan responsive viewer dikekalkan
===================================================== */

.viewer-body{
  height:100vh;

  overflow:hidden;

  background:#edf2ef;

  color:#ffffff;
}


.viewer-header{
  height:58px;

  display:grid;

  grid-template-columns:
    auto
    1fr
    auto;

  align-items:center;

  gap:14px;

  padding:0 14px;

  background:var(--brand-dark);

  border-bottom:
    1px solid rgba(255,255,255,.18);
}


.back-link{
  text-decoration:none;

  color:#ffffff;

  font-size:14px;

  font-weight:700;
}


.viewer-title{
  text-align:center;

  font-weight:700;

  white-space:nowrap;

  overflow:hidden;

  text-overflow:ellipsis;

  color:#ffffff;
}


.viewer-actions{
  display:flex;

  gap:8px;
}


.icon-btn{
  border:
    1px solid rgba(255,255,255,.55);

  background:rgba(255,255,255,.10);

  color:#ffffff;

  border-radius:8px;

  height:36px;

  min-width:42px;

  padding:0 10px;

  display:inline-flex;

  align-items:center;

  justify-content:center;

  text-decoration:none;

  cursor:pointer;

  font:inherit;

  font-size:13px;

  font-weight:700;

  transition:
    background .2s ease,
    color .2s ease;
}


.icon-btn:hover{
  background:#ffffff;

  color:var(--brand-dark);
}


/* =====================================================
   VIEWER MAIN
===================================================== */

.viewer-main{
  height:calc(100vh - 116px);

  display:flex;

  align-items:center;

  justify-content:center;

  overflow:hidden;

  padding:10px;

  background:
    linear-gradient(
      180deg,
      #f5f8f6 0%,
      #e4ece7 100%
    );
}


.loading-box,
.error-box{
  text-align:center;

  max-width:620px;

  padding:24px;
}


.loading-box{
  color:var(--brand-dark);
}


.spinner{
  width:42px;

  height:42px;

  border:
    4px solid rgba(21,156,73,.18);

  border-top-color:var(--brand);

  border-radius:50%;

  margin:0 auto 16px;

  animation:spin 1s linear infinite;
}


@keyframes spin{

  to{
    transform:rotate(360deg);
  }

}


.error-box{
  background:#ffffff;

  color:#842029;

  border:1px solid #f0b7bd;

  border-radius:12px;

  line-height:1.55;

  box-shadow:
    0 8px 24px rgba(0,0,0,.08);
}


/* =====================================================
   FLIPBOOK AREA
===================================================== */

.book-stage{
  width:100%;
  height:100%;

  display:flex;

  align-items:center;

  justify-content:center;
}


#flipbook{
  margin:auto;
}


/* =====================================================
   VIEWER CONTROLS
===================================================== */

.viewer-controls{
  height:58px;

  background:var(--brand-dark);

  border-top:
    1px solid rgba(255,255,255,.18);

  display:flex;

  align-items:center;

  justify-content:center;

  gap:15px;

  padding:8px;
}


.control-btn{
  background:#ffffff;

  border:1px solid #ffffff;

  color:var(--brand-dark);

  border-radius:8px;

  padding:9px 14px;

  cursor:pointer;

  font:inherit;

  font-weight:700;

  transition:
    background .2s ease,
    color .2s ease;
}


.control-btn:hover{
  background:var(--brand-light);

  color:var(--brand-darker);
}


.page-status{
  min-width:88px;

  text-align:center;

  font-size:13px;

  color:#ffffff;

  font-weight:700;
}


/* =====================================================
   PDF PAGES
===================================================== */

.pdf-page{
  background:#ffffff;

  display:flex;

  align-items:center;

  justify-content:center;

  overflow:hidden;
}


.pdf-page img{
  width:100%;
  height:100%;

  object-fit:contain;

  display:block;

  background:#ffffff;
}


/* =====================================================
   RESPONSIVE
   Bahagian asal dikekalkan
===================================================== */

@media (max-width:760px){

  .header-inner{
    align-items:flex-start;

    flex-direction:column;
  }


  .header-brand{
    width:100%;

    align-items:center;
  }


  .logo-container{
    width:88px;
    height:88px;
  }


  .toolbar{
    grid-template-columns:1fr;
  }


  .book-grid{
    grid-template-columns:
      repeat(
        2,
        minmax(0,1fr)
      );

    gap:14px;
  }


  .book-title{
    font-size:15px;

    min-height:auto;
  }


  .description{
    display:none;
  }


  .viewer-title{
    font-size:13px;
  }


  .back-link{
    font-size:0;
  }


  .back-link::before{
    content:"←";

    font-size:22px;
  }

}


@media (max-width:430px){

  .site-header{
    padding:25px 0;
  }


  .header-brand{
    gap:14px;
  }


  .logo-container{
    width:76px;
    height:76px;
  }


  .eyebrow{
    font-size:10px;

    letter-spacing:1px;

    margin-bottom:5px;
  }


  h1{
    font-size:27px;
  }


  .book-grid{
    grid-template-columns:
      1fr
      1fr;
  }


  .card-body{
    padding:12px;
  }


  .read-btn{
    font-size:13px;
  }

}