/* =====================================================
   DETAIL BUKU OPAC | Cream, Gold, Dark Brown
   ===================================================== */

:root {
    --brown: #211d1a;
    --brown-soft: #80583f;
    --gold: #c49a58;
    --ink: #292521;
    --muted: #827b73;
    --line: #ebe5dc;
    --bg: #f7f4ef;
    --green: #37866b;
    --green-bg: #e8f3ed;
    --amber: #946a2c;
    --amber-bg: #f6ead7;
    --red: #a43d31;
    --red-bg: #fff0ed;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1080px;
    margin: auto;
    padding: 13px 20px;
}

.brand-link { display: flex; align-items: center; gap: 11px; min-width: 0; }

.mark {
    display: grid;
    place-items: center;
    flex: 0 0 41px;
    width: 41px;
    height: 41px;
    border-radius: 11px;
    background: var(--gold);
    color: #241f19;
    font-size: 19px;
    font-weight: 800;
}

.brand { color: var(--brown); font-size: 14px; font-weight: 800; line-height: 1.3; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.header-label { color: var(--muted); font-size: 11px; }

/* Konten */
.page {
    max-width: 1080px;
    margin: 22px auto 38px;
    padding: 0 20px;
}

.back {
    position: sticky;
    top: 10px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 13px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--brown-soft);
    font-size: 12px;
    font-weight: 750;
    box-shadow: 0 3px 10px rgba(33, 29, 26, .08);
}

.back:hover {
    border-color: #d9c7ad;
    background: #faf7f2;
    color: #60412f;
}

.detail-card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(33, 29, 26, .035);
}

/* Informasi utama */
.book-layout {
    display: grid;
    grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
    align-items: start;
    gap: 25px;
}

.cover {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 290px;
    max-height: 350px;
    padding: 16px;
    overflow: hidden;
    border-radius: 11px;
    background: linear-gradient(135deg, #f7f2e9, #eee5d7);
}

.cover img { display: block; width: 100%; max-height: 315px; object-fit: contain; }

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #9a8462;
    font-size: 10px;
    font-weight: 750;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.placeholder-icon { font-size: 42px; line-height: 1; }

.book-summary { min-width: 0; }

.book-labels {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.category {
    color: var(--brown-soft);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.loan-count {
    padding: 4px 8px;
    border-radius: 20px;
    background: #f6ead7;
    color: #805a32;
    font-size: 10px;
    font-weight: 750;
}

.title {
    margin: 8px 0;
    color: var(--brown);
    font-size: clamp(23px, 3.5vw, 32px);
    line-height: 1.2;
    letter-spacing: -.45px;
    overflow-wrap: anywhere;
}

.author { margin: 0 0 13px; color: var(--muted); font-size: 13px; }

.availability {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
}

.available { background: var(--green-bg); color: var(--green); }
.unavailable { background: var(--amber-bg); color: var(--amber); }

/* Metadata */
.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 17px;
}

.fact {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.fact-label { margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.fact-value { color: var(--ink); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }

/* Deskripsi dan daftar eksemplar */
.detail-section { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.detail-section h2 { margin: 0 0 8px; color: var(--brown); font-size: 16px; }
.description { margin: 0; color: #5e574f; font-size: 12px; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.section-heading h2 { margin-bottom: 3px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.copy-total { color: var(--brown-soft); font-size: 10px; font-weight: 750; white-space: nowrap; }

.table-wrap {
    width: 100%;
    max-height: 270px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.copy-table { width: 100%; min-width: 440px; border-collapse: collapse; font-size: 11px; }
.copy-table th, .copy-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.copy-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f5f0;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.copy-table tbody tr:last-child td { border-bottom: 0; }
.copy-table tbody tr:hover { background: #fdfbf8; }
.copy-number { color: var(--ink); font-weight: 700; }

.status {
    display: inline-flex;
    padding: 4px 7px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.status-tersedia { background: var(--green-bg); color: var(--green); }
.status-dipinjam { background: var(--amber-bg); color: var(--amber); }
.status-rusak, .status-hilang { background: var(--red-bg); color: var(--red); }
.status-lain { background: #f1eee9; color: #62584d; }

.empty {
    padding: 17px 12px;
    border: 1px dashed #ded5c9;
    border-radius: 8px;
    background: #faf8f5;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

/* Galat dan footer */
.error {
    padding: 13px 15px;
    border: 1px solid #f0d0ca;
    border-radius: 9px;
    background: var(--red-bg);
    color: #9c3026;
    font-size: 12px;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 20px 22px;
    color: var(--muted);
    font-size: 10px;
}

/* Tablet dan ponsel */
@media (max-width: 720px) {
    .page { margin-top: 16px; padding: 0 13px; }
    .detail-card { padding: 15px; }
    .book-layout { grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: 16px; }
    .cover { min-height: 230px; max-height: 270px; padding: 11px; }
    .cover img { max-height: 245px; }
    .facts { gap: 7px; }
    .fact { padding: 9px; }
}

@media (max-width: 560px) {
    .header-inner { padding: 11px 13px; }
    .header-label { display: none; }
    .page { margin-bottom: 25px; }
    .book-layout { grid-template-columns: 1fr; gap: 14px; }
    .cover { min-height: 190px; max-height: 225px; }
    .cover img { max-height: 205px; }
    .title { font-size: 24px; }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-section { margin-top: 17px; padding-top: 14px; }
    footer { flex-direction: column; gap: 3px; padding: 15px 13px 20px; }
}

@media (max-width: 360px) {
    .detail-card { padding: 12px; }
    .facts { grid-template-columns: 1fr; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
}
