/**
 * PERPUS - RS PKU Muhammadiyah Cepu
 * Responsive Stylesheet & Theme System
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* Skala Tampilan Lebih Kompak & Rapi */
html {
    font-size: 14.5px;
    -webkit-text-size-adjust: 100%;
}

@media (max-width: 575.98px) {
    html {
        font-size: 13.5px;
    }
}

*, *::before, *::after {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

:root {
    --pku-primary: #0e703c;
    --pku-primary-dark: #0a4f2a;
    --pku-primary-light: #dcfce7;
    --pku-primary-subtle: #f0fdf4;
    --pku-gold: #f59e0b;
    --pku-gold-light: #fef3c7;
    --pku-gold-dark: #b45309;
    --accent-emerald: #16a34a;
    --dark-slate: #0f172a;
    --muted-slate: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --card-shadow: 0 3px 10px -2px rgba(14, 112, 60, 0.08), 0 2px 5px -1px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 12px 24px -4px rgba(14, 112, 60, 0.14), 0 6px 10px -3px rgba(0, 0, 0, 0.05);
}

html, body,
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
p, span, a, label, input, button, select, textarea,
.btn, .table, .badge, .form-control, .form-select, .nav-link, .dropdown-item,
.offcanvas, .modal, .breadcrumb, .card, .card-header, .card-body, .list-group-item,
code, pre, kbd, samp {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

body {
    background-color: var(--bg-light);
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

main {
    flex: 1 0 auto;
}

/* Custom Typography & PKU Utility Classes */
.text-pku { color: var(--pku-primary) !important; }
.text-gold { color: var(--pku-gold) !important; }
.bg-pku { background-color: var(--pku-primary) !important; color: #ffffff !important; }
.bg-pku-light { background-color: var(--pku-primary-light) !important; color: var(--pku-primary-dark) !important; }
.bg-pku-subtle { background-color: var(--pku-primary-subtle) !important; }
.border-pku { border-color: var(--pku-primary) !important; }

.btn-pku {
    background-color: var(--pku-primary);
    border-color: var(--pku-primary);
    color: #ffffff;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.btn-pku:hover, .btn-pku:focus, .btn-pku:active {
    background-color: var(--pku-primary-dark);
    border-color: var(--pku-primary-dark);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 112, 60, 0.25);
}

.btn-outline-pku {
    border-color: var(--pku-primary);
    color: var(--pku-primary);
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.btn-outline-pku:hover, .btn-outline-pku:focus, .btn-outline-pku:active {
    background-color: var(--pku-primary);
    border-color: var(--pku-primary);
    color: #ffffff;
}

/* Hospital Navbar */
.navbar-hospital {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    z-index: 1030;
}

.brand-logo-img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

.nav-link.active-pku {
    color: var(--pku-primary) !important;
    font-weight: 700 !important;
    position: relative;
}
.nav-link.active-pku::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 12px;
    right: 12px;
    height: 3px;
    background-color: var(--pku-primary);
    border-radius: 2px;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #062b17 0%, #0a4f2a 50%, #0e703c 100%);
    color: #ffffff;
    padding: 2.2rem 0 2.8rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.15), transparent 70%);
    top: -80px;
    right: -60px;
    pointer-events: none;
}

.hero-section::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.12), transparent 70%);
    bottom: -60px;
    left: -40px;
    pointer-events: none;
}

.hero-badge-pku {
    background-color: rgba(245, 158, 11, 0.15);
    color: #fef08a;
    border: 1px solid rgba(245, 158, 11, 0.35);
    backdrop-filter: blur(4px);
}

.hero-search-box {
    background: #ffffff;
    border-radius: 50px;
    padding: 0.28rem 0.35rem 0.28rem 1.15rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.hero-search-box:focus-within {
    box-shadow: 0 12px 28px rgba(14, 112, 60, 0.3);
    border-color: #86efac;
}

.hero-search-box input {
    border: none;
    outline: none;
    font-size: 0.92rem;
    color: #1e293b;
    background: transparent;
}

.hero-search-box input:focus {
    box-shadow: none;
}

/* Category Horizontal Swipeable Bar (Mobile-friendly) */
.category-scroll-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.25rem 0 0.5rem;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.category-scroll-container::-webkit-scrollbar {
    display: none;
}
.category-scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: #334155;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.82rem;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.category-pill:hover {
    background: var(--pku-primary-light);
    color: var(--pku-primary-dark);
    border-color: #86efac;
}

.category-pill.active {
    background: var(--pku-primary);
    color: #ffffff;
    border-color: var(--pku-primary);
    box-shadow: 0 4px 10px rgba(14, 112, 60, 0.25);
}

/* Category Card & Icon Box Centering (Sempurna di Tengah & Presisi) */
.category-icon-box, .brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.35rem;
    line-height: 1;
    background: var(--pku-primary-light);
    color: var(--pku-primary);
    flex-shrink: 0;
    transition: all 0.25s ease-in-out;
}

.category-icon-box i,
.brand-icon i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: 0;
    margin: 0;
    padding: 0;
}

.card:hover .category-icon-box,
.card:hover .brand-icon {
    background: var(--pku-primary);
    color: #ffffff;
    transform: scale(1.06);
}

/* Book Card Responsiveness */
.book-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: #86efac;
}

.book-cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.35;
    background-color: #f1f5f9;
    overflow: hidden;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover-img {
    transform: scale(1.04);
}

.book-year-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    z-index: 2;
}

.book-content {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-category {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--pku-primary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.25rem;
}

.book-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--dark-slate);
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.76rem;
    color: var(--muted-slate);
    margin-bottom: 0.45rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-desc-clamp {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.book-card-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.4rem;
}

.book-card-actions .btn {
    flex: 1;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.32rem 0.45rem;
    border-radius: 6px;
}

/* Detail Page */
.detail-cover {
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(14, 112, 60, 0.14);
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1 / 1.35;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* PDF Viewer Responsive (100dvh) */
.pdf-viewer-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    background-color: #0f172a;
    overflow: hidden;
}

.pdf-viewer-toolbar {
    background-color: #0a4f2a;
    color: #ffffff;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid #166534;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    z-index: 20;
}

.pdf-viewer-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: #334155;
}

/* Admin Styling & Offcanvas Sidebar */
.admin-topbar {
    background-color: #0a4f2a;
    border-bottom: 1px solid #166534;
}

.admin-sidebar-desktop {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1rem;
    box-shadow: var(--card-shadow);
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.52rem 0.85rem;
    color: #475569;
    font-weight: 500;
    font-size: 0.86rem;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.2rem;
    transition: all 0.2s ease;
}

.admin-nav-link:hover {
    background: #f0fdf4;
    color: var(--pku-primary);
}

.admin-nav-link.active {
    background: var(--pku-primary-light);
    color: var(--pku-primary-dark);
    font-weight: 700;
}

.admin-stat-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1rem 1.15rem;
    box-shadow: var(--card-shadow);
    height: 100%;
}

.admin-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Footer Hospital */
.hospital-footer {
    background: #062b17;
    color: #94a3b8;
    padding: 1.25rem 0;
    border-top: 1px solid #0a4f2a;
    margin-top: auto;
}

.hospital-footer a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hospital-footer a:hover {
    color: #86efac;
}

/* Mobile & Tablet Specific Media Queries */
@media (max-width: 991.98px) {
    .hero-section {
        padding: 2.5rem 0 3.2rem;
        text-align: center;
    }
    .hero-section h1 {
        font-size: 1.75rem;
    }
    .hero-section p.lead {
        font-size: 0.92rem;
    }
    .admin-sidebar-desktop {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        padding: 2rem 0 2.5rem;
    }
    .hero-search-box {
        padding: 0.35rem 0.4rem 0.35rem 1rem;
    }
    .hero-search-box input {
        font-size: 0.88rem;
    }
    .hero-search-box button {
        padding: 0.45rem 1rem !important;
        font-size: 0.85rem !important;
    }

    /* 2 Columns on smartphone with optimized padding */
    .book-content {
        padding: 0.75rem;
    }
    .book-title {
        font-size: 0.85rem;
        line-height: 1.3;
        margin-bottom: 0.25rem;
    }
    .book-author {
        font-size: 0.74rem;
        margin-bottom: 0.4rem;
    }
    .book-desc-clamp {
        display: none; /* Sembunyikan deskripsi di layar sangat kecil agar card seragam */
    }
    .book-card-actions {
        padding-top: 0.3rem;
        flex-direction: column;
    }
    .book-card-actions .btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.4rem;
    }
    
    .detail-cover {
        max-width: 220px;
    }

    .pdf-viewer-toolbar {
        padding: 0.4rem 0.6rem;
    }

    .admin-stat-card {
        padding: 0.9rem;
    }
    .admin-stat-card h2 {
        font-size: 1.45rem !important;
    }
    .admin-stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
    }
}

.admin-mobile-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.9rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
