/* =========================================
   PUSTAKA - Main Stylesheet
   ========================================= */

:root {
    --primary:       #4f46e5;
    --primary-dark:  #3730a3;
    --primary-light: #eef2ff;
    --secondary:     #f8fafc;
    --accent:        #06b6d4;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --text-primary:  #0f172a;
    --text-secondary:#64748b;
    --border:        #e2e8f0;
    --card-shadow:   0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --card-shadow-hover: 0 8px 30px rgba(79,70,229,.12);
    --radius:        12px;
    --radius-sm:     8px;
    --radius-lg:     16px;
    --transition:    all .2s ease;
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
    background: #f8fafc;
    min-height: 100vh;
}

/* -- NAVBAR -- */
.navbar-main {
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: .75rem 0;
    z-index: 1030;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary) !important;
    letter-spacing: -.3px;
}
.navbar-brand i { margin-right: 6px; }
.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: .9rem;
    padding: .4rem .75rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-light);
}
.nav-link i { margin-right: 4px; }
.cart-btn { position: relative; font-size: 1.15rem; }
.cart-badge {
    position: absolute;
    top: 0; right: 0;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}
.user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    background: var(--primary); color: #fff;
    border-radius: 50%;
    font-size: .75rem; font-weight: 700;
    margin-right: 6px;
}
.user-menu { display: flex; align-items: center; }

/* -- MAIN CONTENT -- */
.main-content { min-height: calc(100vh - 130px); }

/* -- FOOTER -- */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 1.25rem 0;
    margin-top: 3rem;
}
.footer-brand { font-weight: 700; color: var(--primary); }

/* -- BOOK CARD -- */
.book-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}
.book-cover {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 100%);
    overflow: hidden;
    flex-shrink: 0;
}
.book-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.book-card:hover .book-cover img { transform: scale(1.05); }
.stock-badge {
    position: absolute; top: 10px; right: 10px;
    font-size: .7rem; font-weight: 600;
    padding: 3px 10px; border-radius: 99px;
}
.stock-badge.available { background: #d1fae5; color: #065f46; }
.stock-badge.low       { background: #fef3c7; color: #92400e; }
.stock-badge.out       { background: #fee2e2; color: #991b1b; }
.book-info { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }
.book-genre {
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--primary); margin-bottom: 4px;
}
.book-title {
    font-size: .95rem; font-weight: 700; line-height: 1.35;
    color: var(--text-primary); margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-author {
    font-size: .8rem; color: var(--text-secondary); margin-bottom: auto; padding-bottom: .75rem;
}
.book-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.book-actions .btn { flex: 1; font-size: .8rem; }

/* -- KATALOG HEADER -- */
.katalog-header {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    color: #fff;
    margin-bottom: 2rem;
}
.katalog-header h1 { font-weight: 800; font-size: 1.8rem; margin: 0; }
.katalog-header p  { opacity: .85; margin: .5rem 0 0; font-size: .95rem; }

/* -- FILTER BAR -- */
.filter-bar {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    margin-bottom: 1.75rem;
    box-shadow: var(--card-shadow);
}
.filter-bar .form-control, .filter-bar .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: .875rem;
}
.filter-bar .form-control:focus, .filter-bar .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* -- AUTH PAGES -- */
.auth-body { background: #f1f5f9; display: flex; align-items: stretch; min-height: 100vh; }
.auth-wrapper { display: flex; width: 100%; min-height: 100vh; }
.auth-left {
    flex: 1; max-width: 45%;
    background: linear-gradient(150deg, var(--primary) 0%, #6366f1 60%, var(--accent) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 3rem;
}
.auth-left-content { color: #fff; max-width: 360px; }
.auth-brand { font-size: 1.5rem; font-weight: 800; margin-bottom: 2rem; }
.auth-brand i { margin-right: 8px; }
.auth-left-content h2 { font-size: 1.75rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.3; }
.auth-left-content p  { opacity: .85; font-size: .95rem; line-height: 1.6; }
.auth-features { margin-top: 2rem; display: flex; flex-direction: column; gap: .75rem; }
.auth-feature { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.auth-feature i { color: #a5f3fc; font-size: 1rem; }
.auth-right {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}
.auth-card {
    background: #fff; border-radius: var(--radius-lg); padding: 2.5rem;
    width: 100%; max-width: 420px; box-shadow: var(--card-shadow);
}
.auth-brand-mobile { font-size: 1.4rem; font-weight: 800; color: var(--primary); margin-bottom: 1.5rem; }
.auth-title { font-size: 1.6rem; font-weight: 800; margin-bottom: .25rem; }
.auth-subtitle { color: var(--text-secondary); font-size: .9rem; margin-bottom: 1.75rem; }
.auth-subtitle a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-subtitle a:hover { text-decoration: underline; }
.btn-auth { padding: .7rem; font-weight: 600; border-radius: var(--radius-sm); }
.auth-divider {
    text-align: center; margin: 1.5rem 0; position: relative;
    color: var(--text-secondary); font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
    content: ''; position: absolute; top: 50%; width: 30%; height: 1px;
    background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-divider span { background: #fff; padding: 0 .75rem; }
.demo-accounts { display: flex; gap: .75rem; }
.demo-btn {
    flex: 1; padding: .5rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: #fff;
    font-size: .8rem; font-weight: 500; cursor: pointer;
    transition: var(--transition); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.demo-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* -- INPUT WITH ICON -- */
.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
    color: var(--text-secondary); font-size: .9rem; z-index: 1; pointer-events: none;
}

.input-icon-wrap .form-control.input-with-icon { padding-left: 2.8rem !important; border-radius: var(--radius-sm) !important; }
.password-toggle {
    position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
    border: none; background: transparent; color: var(--text-secondary);
    cursor: pointer; padding: .25rem; z-index: 1; font-size: .9rem;
}
.password-toggle:hover { color: var(--primary); }
.form-label { font-weight: 600; font-size: .85rem; color: var(--text-primary); margin-bottom: .4rem; }
.form-control, .form-select {
    border-radius: var(--radius-sm) !important;
    border-color: var(--border);
    font-size: .9rem;
    padding: .55rem .9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* -- BUTTONS -- */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary {
    color: var(--primary); border-color: var(--primary);
    font-weight: 600; border-radius: var(--radius-sm);
}
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* -- CART -- */
.cart-item {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem;
    transition: var(--transition);
}
.cart-item:hover { box-shadow: var(--card-shadow-hover); }
.cart-item-img { width: 60px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-item-title { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.cart-item-author { font-size: .8rem; color: var(--text-secondary); }
.cart-summary {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    padding: 1.5rem; position: sticky; top: 100px;
}
.cart-summary h5 { font-weight: 700; margin-bottom: 1rem; }
.summary-row { display: flex; justify-content: space-between; font-size: .9rem; padding: .4rem 0; }
.summary-row.total { font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .25rem; }

/* -- ADMIN LAYOUT -- */
.admin-body { background: #f1f5f9; }
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 250px; flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh;
    overflow-y: auto; z-index: 100;
    transition: transform .3s ease;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.2rem; font-weight: 800;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .6rem;
}
.sidebar-user {
    padding: 1rem 1.25rem;
    display: flex; align-items: center; gap: .75rem;
    border-bottom: 1px solid var(--border);
    background: var(--primary-light);
}
.sidebar-avatar {
    width: 36px; height: 36px;
    background: var(--primary); color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.sidebar-username { font-weight: 600; font-size: .875rem; color: var(--text-primary); }
.sidebar-role     { font-size: .75rem; color: var(--primary); font-weight: 500; }
.sidebar-nav      { padding: 1rem .75rem; flex: 1; }
.nav-label {
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; color: var(--text-secondary);
    padding: .25rem .75rem; margin-bottom: .25rem;
}
.sidebar-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem .85rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: .875rem; font-weight: 500;
    transition: var(--transition); margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-link i { font-size: 1rem; width: 18px; flex-shrink: 0; }
.admin-main { margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh; flex: 1; }
.admin-topbar {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: .9rem 1.75rem; display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 50;
}
.admin-page-title { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.admin-content { padding: 1.75rem; flex: 1; }

/* -- STAT CARDS -- */
.stat-card {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--card-shadow); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.stat-icon {
    width: 52px; height: 52px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.yellow { background: #fffbeb; color: var(--warning); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; color: var(--text-primary); }
.stat-label { font-size: .8rem; color: var(--text-secondary); font-weight: 500; margin-top: .2rem; }

/* -- TABLES -- */
.table-card {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    overflow: hidden; box-shadow: var(--card-shadow);
}
.table-card-header {
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.table-card-header h5 { font-weight: 700; margin: 0; font-size: 1rem; }
.table { margin: 0; font-size: .875rem; }
.table th {
    font-weight: 600; color: var(--text-secondary); font-size: .8rem;
    text-transform: uppercase; letter-spacing: .4px;
    padding: .85rem 1.25rem; background: #f8fafc;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: .85rem 1.25rem; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* -- STATUS BADGES -- */
.status-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .75rem; border-radius: 99px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.status-menunggu_bukti        { background: #f1f5f9; color: #64748b; }
.status-menunggu_verifikasi   { background: #fef3c7; color: #92400e; }
.status-dipinjam              { background: #dbeafe; color: #1d4ed8; }
.status-dikembalikan          { background: #d1fae5; color: #065f46; }
.status-terlambat             { background: #fee2e2; color: #991b1b; }
.status-pending               { background: #fef3c7; color: #92400e; }
.status-verified              { background: #d1fae5; color: #065f46; }
.status-rejected              { background: #fee2e2; color: #991b1b; }

/* -- PAGE HEADER -- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.75rem;
}
.page-header h2 { font-weight: 800; font-size: 1.4rem; margin: 0; }
.page-header p  { color: var(--text-secondary); margin: .2rem 0 0; font-size: .875rem; }

/* -- CHECKOUT -- */
.checkout-card {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    padding: 1.75rem; box-shadow: var(--card-shadow);
}
.deposit-info {
    background: var(--primary-light); border-radius: var(--radius);
    border: 1px solid #c7d2fe; padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
}
.deposit-info i { font-size: 1.5rem; color: var(--primary); }

/* -- UPLOAD AREA -- */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 2.5rem; text-align: center; cursor: pointer;
    transition: var(--transition); background: #f8fafc;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary); background: var(--primary-light);
}
.upload-zone i { font-size: 2.5rem; color: var(--text-secondary); display: block; margin-bottom: .75rem; }
.upload-zone p { color: var(--text-secondary); font-size: .9rem; margin: 0; }

/* -- RIWAYAT -- */
.riwayat-card {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: var(--card-shadow);
    transition: var(--transition);
}
.riwayat-card:hover { box-shadow: var(--card-shadow-hover); }

/* -- STAR RATING -- */
.star-rating { display: flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-rating input { display: none; }
.star-rating label { font-size: 1.4rem; color: #cbd5e1; cursor: pointer; transition: color .15s; }
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: #f59e0b; }

/* -- DETAIL BUKU -- */
.buku-detail-cover {
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--card-shadow-hover);
    aspect-ratio: 3/4; background: var(--primary-light);
}
.buku-detail-cover img { width: 100%; height: 100%; object-fit: cover; }

/* -- RESPONSIVE -- */
@media (max-width: 991px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .auth-left { display: none !important; }
    .auth-right { flex: 1; }
}
@media (max-width: 576px) {
    .auth-card { padding: 1.75rem 1.25rem; }
    .admin-content { padding: 1rem; }
}

/* -- EMPTY STATE -- */
.empty-state {
    text-align: center; padding: 4rem 2rem;
    color: var(--text-secondary);
}
.empty-state i { font-size: 3.5rem; margin-bottom: 1rem; opacity: .3; display: block; }
.empty-state h5 { font-weight: 700; color: var(--text-primary); margin-bottom: .5rem; }
.empty-state p  { font-size: .9rem; }

/* -- ALERTS -- */
.alert { border-radius: var(--radius-sm); border: none; font-size: .875rem; }
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-danger  { background: #fef2f2; color: #dc2626; }
.alert-warning { background: #fffbeb; color: #d97706; }
.alert-info    { background: #eff6ff; color: #2563eb; }

/* -- DROPDOWN -- */
.dropdown-menu {
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,.1); font-size: .875rem;
}
.dropdown-item { padding: .5rem 1rem; border-radius: var(--radius-sm); margin: 1px; }
.dropdown-item:hover { background: var(--primary-light); color: var(--primary); }

/* -- MISC -- */
.badge-category {
    background: var(--primary-light); color: var(--primary);
    padding: .3rem .8rem; border-radius: 99px;
    font-size: .75rem; font-weight: 600;
}
