:root {
    --wood-top: #e89b77;
    --wood-mid: #8b4b45;
    --wood-dark: #3a2225;
    --wood-line: #241517;
    --cream: #fff7e7;
    --text: #2d2020;
    --accent: #5a2d2b;
    --gold: #e5b882;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
}

.library-body,
.viewer-body,
.admin-body {
    background:
        radial-gradient(circle at 50% 0%, rgba(255,255,255,.22), transparent 30%),
        repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 2px, rgba(0,0,0,.02) 2px 4px),
        linear-gradient(90deg, #76433f, #a4625a 45%, #76433f);
}

.top-wood-bar {
    min-height: 52px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.28), transparent 40%),
        repeating-linear-gradient(0deg, rgba(98,43,35,.16) 0 2px, transparent 2px 7px),
        linear-gradient(90deg, #f0aa86, #d98167 50%, #f0aa86);
    border-bottom: 2px solid #6b3732;
    box-shadow: 0 5px 15px rgba(0,0,0,.35);
}

.title-wrap {
    width: min(1200px, 96vw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 52px;
}

.title-wrap h1 {
    margin: 0;
    font-size: clamp(18px, 2.2vw, 24px);
    color: #3b2728;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255,255,255,.35);
}

.admin-shortcut {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 7px 13px;
    border-radius: 999px;
    color: #fff7ed;
    text-decoration: none;
    font-size: 13px;
    background: rgba(63,28,28,.65);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}

.library-frame {
    width: min(1220px, 100%);
    margin: 0 auto;
    padding: 8px 0 70px;
    position: relative;
}

.filter-box {
    display: flex;
    justify-content: center;
    margin: 0 auto 16px;
    position: relative;
    z-index: 3;
}

.filter-box select {
    width: min(240px, 78vw);
    border: 0;
    outline: 0;
    color: #fff0e4;
    font-size: 16px;
    border-radius: 18px;
    padding: 7px 42px 7px 17px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.08)),
        #5d302f;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.28), 0 3px 9px rgba(0,0,0,.28);
}

.bookshelf {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(255,255,255,.05), transparent 11%, rgba(0,0,0,.05) 25%, transparent 45%, rgba(255,255,255,.04) 75%, rgba(0,0,0,.05)),
        repeating-linear-gradient(90deg, #6e3c3d 0 48px, #794847 48px 53px, #5d3135 53px 58px),
        #704040;
    border-left: 3px solid #2d1a1c;
    border-right: 3px solid #2d1a1c;
    box-shadow: inset 0 0 34px rgba(0,0,0,.35), 0 14px 30px rgba(0,0,0,.34);
}

.bookshelf::before,
.bookshelf::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 18px;
    background: linear-gradient(90deg, rgba(0,0,0,.35), transparent), #613738;
    z-index: 1;
}

.bookshelf::before { left: 0; }
.bookshelf::after { right: 0; transform: scaleX(-1); }

.shelf-row {
    position: relative;
    min-height: 172px;
    display: grid;
    grid-template-columns: repeat(8, minmax(82px, 1fr));
    gap: clamp(22px, 4vw, 54px);
    align-items: end;
    padding: 20px clamp(30px, 7vw, 88px) 15px;
    border-bottom: 10px solid #3d2224;
    box-shadow: inset 0 -3px 0 #8f5a50, inset 0 -13px 0 #221416;
}

.shelf-row::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -13px;
    height: 13px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.2)),
        repeating-linear-gradient(90deg, #985d51 0 65px, #7a403d 65px 80px);
    box-shadow: 0 -2px 3px rgba(0,0,0,.45), 0 5px 10px rgba(0,0,0,.35);
    z-index: 2;
}

.book-card {
    position: relative;
    display: block;
    min-width: 0;
    text-decoration: none;
    z-index: 3;
    transform: translateY(0);
    transition: transform .18s ease, filter .18s ease;
}

.book-card:hover {
    transform: translateY(-8px) scale(1.03);
    filter: brightness(1.07);
}

.book-cover-wrap {
    display: block;
    width: min(104px, 12vw);
    max-width: 112px;
    min-width: 70px;
    aspect-ratio: 300 / 430;
    margin: 0 auto;
    border-radius: 2px 7px 7px 2px;
    background: #221414;
    box-shadow: 7px 8px 9px rgba(0,0,0,.42), inset 4px 0 4px rgba(255,255,255,.25);
    overflow: hidden;
}

.book-cover-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.book-label {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: 160px;
    padding: 7px 9px;
    border-radius: 9px;
    color: #fff8ea;
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
    background: rgba(40, 22, 22, .92);
    box-shadow: 0 8px 22px rgba(0,0,0,.32);
}

.book-card:hover .book-label { display: block; }
.book-spacer { min-height: 1px; }

.empty-shelf {
    width: min(780px, 92vw);
    margin: 50px auto;
    padding: 35px;
    text-align: center;
    border-radius: 18px;
    color: var(--cream);
    background: rgba(58,32,33,.62);
    box-shadow: 0 12px 26px rgba(0,0,0,.3);
}

.site-footer {
    color: rgba(255,247,231,.75);
    text-align: center;
    padding: 20px;
    font-size: 13px;
}

/* Flipbook */
.viewer-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px clamp(16px, 4vw, 42px);
    color: var(--cream);
    background: rgba(45, 24, 25, .72);
    box-shadow: 0 8px 22px rgba(0,0,0,.25);
}

.viewer-header h1 {
    margin: 0;
    font-size: clamp(19px, 2.4vw, 28px);
}

.back-link {
    color: #fff2df;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
}

.flipbook-page {
    width: min(1160px, 94vw);
    margin: 26px auto 60px;
}

.book-info-panel {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 20px;
    align-items: center;
    color: #fff7e8;
    background: rgba(47, 25, 25, .68);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 14px 26px rgba(0,0,0,.25);
}

.book-info-panel img {
    width: 130px;
    border-radius: 6px;
    box-shadow: 8px 10px 14px rgba(0,0,0,.35);
}

.book-info-panel h2 {
    margin: 4px 0 7px;
    font-size: clamp(22px, 3vw, 34px);
}

.category-pill {
    display: inline-block;
    margin: 0;
    padding: 5px 12px;
    color: #3d241f;
    font-weight: 700;
    border-radius: 999px;
    background: #f4c88e;
}

.muted { opacity: .78; }

.flipbook-shell {
    margin-top: 22px;
    padding: 24px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.1), rgba(0,0,0,.05)),
        rgba(48, 26, 26, .62);
    box-shadow: 0 18px 34px rgba(0,0,0,.3);
}

.flipbook-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #fff7e9;
    margin-bottom: 18px;
}

.flipbook-toolbar button,
.form-actions button,
.btn {
    border: 0;
    border-radius: 999px;
    padding: 10px 17px;
    font-weight: 700;
    cursor: pointer;
    color: #fff6e9;
    text-decoration: none;
    background: linear-gradient(180deg, #78403d, #4c2727);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 10px rgba(0,0,0,.22);
}

.flipbook-toolbar button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.flipbook-stage {
    position: relative;
    height: min(72vh, 720px);
    min-height: 420px;
    display: grid;
    place-items: center;
    perspective: 1600px;
}

.book-shadow {
    position: absolute;
    width: min(620px, 80vw);
    height: 42px;
    bottom: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.35);
    filter: blur(18px);
}

.flip-page-card {
    width: min(480px, 86vw);
    height: min(640px, 66vh);
    min-height: 390px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .42s ease, opacity .42s ease;
}

.page-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 10px 20px 20px 10px;
    background: #f7edd8;
    box-shadow: 18px 20px 30px rgba(0,0,0,.35), inset 10px 0 16px rgba(80,45,28,.17);
    backface-visibility: hidden;
}

.page-face::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0,0,0,.18), transparent 13%, transparent 88%, rgba(0,0,0,.12));
}

.page-face img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #fbf4e6;
}

.flip-out-next { transform: rotateY(-74deg) translateX(-40px); opacity: .25; }
.flip-out-prev { transform: rotateY(74deg) translateX(40px); opacity: .25; }
.flip-in { transform: rotateY(0deg) translateX(0); opacity: 1; }

.flipbook-help {
    color: rgba(255,247,231,.78);
    text-align: center;
    font-size: 13px;
    margin-top: 12px;
}

.viewer-empty {
    width: min(700px, 92vw);
    margin: 70px auto;
    color: var(--cream);
    text-align: center;
}

@media (max-width: 920px) {
    .shelf-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
        padding-left: 42px;
        padding-right: 42px;
    }
    .book-cover-wrap { width: min(105px, 22vw); }
}

@media (max-width: 560px) {
    .title-wrap { padding: 0 8px; }
    .admin-shortcut { display: none; }
    .shelf-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px 16px;
        padding-left: 22px;
        padding-right: 22px;
    }
    .book-cover-wrap { width: min(94px, 26vw); min-width: 64px; }
    .book-info-panel { grid-template-columns: 1fr; text-align: center; }
    .book-info-panel img { margin: 0 auto; }
    .viewer-header { flex-direction: column; align-items: flex-start; }
    .flipbook-shell { padding: 15px; }
    .flipbook-toolbar { gap: 8px; flex-wrap: wrap; }
}


/* Clean Architecture V4 - Visitor, Page View, WhatsApp UI */
.homepage-stats {
    width: min(1220px, 100%);
    margin: 0 auto;
    padding: 10px 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    color: #fff7e8;
    font-weight: 700;
    background: rgba(45, 24, 25, .38);
    border-bottom: 1px solid rgba(255,255,255,.13);
}

.homepage-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.book-view-count {
    display: block;
    width: max-content;
    max-width: 120px;
    margin: 7px auto 0;
    padding: 3px 7px;
    border-radius: 999px;
    color: #fff8e8;
    font-size: 10.5px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    background: rgba(40, 22, 22, .74);
    box-shadow: 0 3px 8px rgba(0,0,0,.25);
}

.viewer-stat-line {
    display: inline-block;
    margin: 3px 0 8px;
    padding: 5px 10px;
    border-radius: 999px;
    color: #fff7e8;
    background: rgba(255,255,255,.12);
}

.ask-me-whatsapp {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 12px 17px;
    border-radius: 999px;
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    background: #25D366;
    box-shadow: 0 10px 24px rgba(0,0,0,.32);
}

.ask-me-whatsapp:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

@media (max-width: 560px) {
    .homepage-stats {
        padding: 8px 10px;
        gap: 8px;
        font-size: 13px;
    }
    .book-view-count {
        font-size: 10px;
        padding: 3px 6px;
        max-width: 100px;
    }
    .ask-me-whatsapp {
        right: 12px;
        bottom: 12px;
        padding: 10px 14px;
        font-size: 14px;
    }
}


/* ENHANCED UI STATS */
.stats-card{
position:sticky;
top:0;
background:linear-gradient(90deg,#25d366,#128c7e);
color:white;
display:flex;
justify-content:space-around;
padding:12px;
font-weight:bold;
z-index:999;
box-shadow:0 4px 10px rgba(0,0,0,0.2);
}

.ask-me-whatsapp{
position:fixed;
bottom:20px;
right:20px;
background:#25d366;
color:white;
padding:14px 18px;
border-radius:50px;
font-weight:bold;
box-shadow:0 6px 15px rgba(0,0,0,0.3);
z-index:9999;
}

.shelf-row{
gap:10px;
}

.book-card{
transition:transform .2s;
}
.book-card:hover{
transform:scale(1.05);
}


/* === ENHANCED STATS BIG VISIBILITY === */
.homepage-stats.stats-card{
    display:flex;
    justify-content:center;
    gap:20px;
    padding:15px;
    margin:10px;
    background:#fff3e6;
    border-radius:12px;
    box-shadow:0 6px 15px rgba(0,0,0,0.15);
    font-size:20px;
    font-weight:bold;
}

.homepage-stats.stats-card span{
    padding:8px 14px;
    background:#ffffff;
    border-radius:10px;
}

/* === FLOATING WHATSAPP BUTTON BIG === */
.wa-float{
    position:fixed;
    right:20px;
    bottom:20px;
    background:#25D366;
    color:#fff;
    padding:16px 22px;
    border-radius:50px;
    font-size:18px;
    font-weight:bold;
    text-decoration:none;
    box-shadow:0 10px 25px rgba(0,0,0,0.3);
    z-index:99999;
    display:flex;
    align-items:center;
    gap:10px;
    animation:pulse 1.5s infinite;
}

.wa-float:hover{
    transform:scale(1.08);
}

@keyframes pulse{
    0%{box-shadow:0 0 0 0 rgba(37,211,102,0.6);}
    70%{box-shadow:0 0 0 20px rgba(37,211,102,0);}
    100%{box-shadow:0 0 0 0 rgba(37,211,102,0);}
}
.homepage-stats.stats-card {
    background: #ffffff;   /* background putih supaya clean */
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    gap: 20px;

    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* TEXT VISITOR + PAGE VIEW */
.homepage-stats.stats-card span {
    color: #111111;   /* 🔥 HITAM JELAS */
    font-weight: 700;
    font-size: 16px;
}

/* ICON optional highlight */
.homepage-stats.stats-card span:first-child {
    color: #000000;
}