/* ============================================================
           CATALOG PAGE OVERRIDES & EXTENSIONS
           ============================================================ */
        :root {
            --primary: #1a1a1a;
            --accent: #2c6e49;
            --accent-light: #4a9e6d;
            --bg-page: #f4f5f7;
            --bg-card: #ffffff;
            --border: #e5e7eb;
            --text-muted: #6b7280;
            --text-dark: #111827;
            --badge-fiksi: #fde68a;
            --badge-nonfiksi: #fca5a5;
            --badge-sains: #6ee7b7;
            --badge-sejarah: #93c5fd;
            --badge-biografi: #c4b5fd;
            --badge-pendidikan: #fdba74;
            --badge-agama: #d9f99d;
            --available: #16a34a;
            --loaned: #dc2626;
            --soon: #f59e0b;
        }

        /* Reset for catalog page */
        body {
            background-color: var(--bg-page);
            font-family: 'Outfit', sans-serif;
        }



        /* ── SEARCH BAR ── */
        .search-section {
            background: #fff;
            border-bottom: 1px solid var(--border);
            padding: 16px 0;
        }

        .search-row {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            width: 90%;
            max-width: 1600px;
            margin: 0 auto;
        }

        .search-input-wrap {
            position: relative;
            flex: 1;
            min-width: 240px;
        }

        .search-input-wrap i {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            font-size: 14px;
        }

        .search-input-wrap input {
            width: 100%;
            padding: 11px 14px 11px 40px;
            border: 1.5px solid var(--border);
            border-radius: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            color: var(--text-dark);
            background: #fafafa;
            outline: none;
            transition: border-color 0.25s;
        }

        .search-input-wrap input:focus {
            border-color: var(--accent);
            background: #fff;
        }

        .search-input-wrap input::placeholder { color: #aaa; }

        .btn-search {
            background: var(--primary);
            color: #fff;
            border: none;
            padding: 11px 24px;
            border-radius: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s, box-shadow 0.2s;
            white-space: nowrap;
        }

        .btn-search:hover {
            background: #000;
            box-shadow: 0 4px 12px rgba(0,0,0,0.18);
        }

        .filter-select {
            padding: 11px 14px;
            border: 1.5px solid var(--border);
            border-radius: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            color: var(--text-dark);
            background: #fafafa;
            outline: none;
            cursor: pointer;
            transition: border-color 0.25s;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 34px;
            min-width: 130px;
        }

        .filter-select:focus { border-color: var(--accent); }

        .btn-reset {
            background: transparent;
            border: 1.5px solid var(--border);
            padding: 11px 16px;
            border-radius: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            color: var(--text-muted);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
            transition: border-color 0.2s, color 0.2s;
        }

        .btn-reset:hover { border-color: #aaa; color: var(--text-dark); }

        /* ── MAIN LAYOUT ── */
        .catalog-body {
            display: flex;
            gap: 28px;
            padding: 28px 0 60px;
            align-items: flex-start;
            width: 90%;
            max-width: 1600px;
            margin: 0 auto;
        }

        /* ── SIDEBAR ── */
        .catalog-sidebar {
            width: 220px;
            flex-shrink: 0;
        }

        .sidebar-card {
            background: #fff;
            border-radius: 14px;
            border: 1px solid var(--border);
            padding: 18px;
            margin-bottom: 16px;
        }

        .sidebar-card h3 {
            font-size: 13px;
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 12px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .cat-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 9px 10px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
            text-decoration: none;
            color: var(--text-dark);
        }

        .cat-item:hover { background: #f3f4f6; }

        .cat-item.active {
            background: var(--primary);
            color: #fff;
        }

        .cat-item.active .cat-count { color: rgba(255,255,255,0.7); }

        .cat-item i {
            font-size: 13px;
            width: 18px;
            text-align: center;
            opacity: 0.7;
        }

        .cat-item .cat-name {
            flex: 1;
            font-size: 13px;
            font-weight: 500;
        }

        .cat-count {
            font-size: 12px;
            color: var(--text-muted);
            font-weight: 500;
        }

        /* Availability filter */
        .avail-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 6px 0;
            font-size: 13px;
            cursor: pointer;
        }

        .avail-item input[type="checkbox"] {
            accent-color: var(--primary);
            width: 15px;
            height: 15px;
            cursor: pointer;
        }

        .avail-label { flex: 1; color: var(--text-dark); }
        .avail-count { color: var(--text-muted); font-size: 12px; }

        /* ── MAIN CONTENT ── */
        .catalog-main { flex: 1; min-width: 0; }

        .catalog-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 18px;
            flex-wrap: wrap;
            gap: 12px;
        }

        .catalog-header-left h2 {
            font-size: 20px;
            font-weight: 700;
            color: var(--text-dark);
            margin: 0 0 2px;
        }

        .catalog-header-left p {
            font-size: 13px;
            color: var(--text-muted);
            margin: 0;
        }

        .catalog-header-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .sort-select {
            padding: 9px 30px 9px 12px;
            border: 1.5px solid var(--border);
            border-radius: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            color: var(--text-dark);
            background: #fff;
            outline: none;
            cursor: pointer;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
        }

        .view-toggle {
            display: flex;
            border: 1.5px solid var(--border);
            border-radius: 8px;
            overflow: hidden;
        }

        .view-btn {
            padding: 8px 12px;
            background: #fff;
            border: none;
            cursor: pointer;
            color: var(--text-muted);
            font-size: 14px;
            transition: background 0.2s, color 0.2s;
        }

        .view-btn.active, .view-btn:hover {
            background: var(--primary);
            color: #fff;
        }

        /* ── BOOK GRID ── */
        .books-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
            gap: 18px;
            margin-bottom: 28px;
        }

        .book-card {
            background: #fff;
            border-radius: 12px;
            border: 1px solid var(--border);
            overflow: hidden;
            transition: transform 0.2s, box-shadow 0.2s;
            position: relative;
        }

        .book-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 30px rgba(0,0,0,0.1);
        }

        .book-cover-wrap {
            position: relative;
            width: 100%;
            padding-top: 140%; /* 5:7 aspect ratio */
            overflow: hidden;
            background: #f0ebe3;
        }

        /* Real cover image fills the wrap */
        .book-cover-wrap img {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
            z-index: 1;
        }

        /* If image errors, show transparent (default png already set via onerror) */
        .book-cover-wrap img.img-error {
            display: none;
        }

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

        .book-body {
            padding: 12px;
        }

        .book-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-dark);
            margin: 0 0 3px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            line-height: 1.4;
        }

        .book-author {
            font-size: 11px;
            color: var(--text-muted);
            margin: 0 0 8px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .book-badge {
            display: inline-block;
            font-size: 10px;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 20px;
            margin-bottom: 8px;
        }

        .badge-fiksi    { background: var(--badge-fiksi);    color: #78350f; }
        .badge-nonfiksi { background: var(--badge-nonfiksi); color: #7f1d1d; }
        .badge-sains    { background: var(--badge-sains);    color: #065f46; }
        .badge-sejarah  { background: var(--badge-sejarah);  color: #1e3a8a; }
        .badge-biografi { background: var(--badge-biografi); color: #4c1d95; }
        .badge-pendidikan { background: var(--badge-pendidikan); color: #78350f; }
        .badge-agama    { background: var(--badge-agama);    color: #365314; }
        .badge-default  { background: #e5e7eb;               color: #374151; }

        .book-avail {
            font-size: 11px;
            font-weight: 500;
            margin-bottom: 10px;
        }

        .avail-dot {
            display: inline-block;
            width: 7px;
            height: 7px;
            border-radius: 50%;
            margin-right: 4px;
            background: var(--available);
        }

        .avail-dot.loaned { background: var(--loaned); }
        .avail-dot.soon   { background: var(--soon); }

        .btn-detail {
            display: block;
            width: 100%;
            text-align: center;
            padding: 8px;
            background: var(--primary);
            color: #fff;
            font-family: 'Outfit', sans-serif;
            font-size: 12px;
            font-weight: 600;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            text-decoration: none;
            transition: background 0.2s;
        }

        .btn-detail:hover { background: #000; }

        /* ── LIST VIEW ── */
        .books-list { display: none; margin-bottom: 28px; }

        .book-list-item {
            display: flex;
            align-items: center;
            gap: 16px;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 18px;
            margin-bottom: 12px;
            transition: box-shadow 0.2s;
        }

        .book-list-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }

        .book-list-cover {
            width: 50px;
            height: 70px;
            object-fit: cover;
            border-radius: 6px;
            background: #e5e7eb;
            flex-shrink: 0;
        }

        .book-list-cover-placeholder {
            width: 50px;
            height: 70px;
            flex-shrink: 0;
            background: linear-gradient(135deg, #e8e0f5, #d1e8ff);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .book-list-cover-placeholder i { font-size: 20px; color: rgba(0,0,0,0.2); }

        .book-list-info { flex: 1; min-width: 0; }
        .book-list-title { font-size: 14px; font-weight: 600; color: var(--text-dark); margin: 0 0 2px; }
        .book-list-author { font-size: 12px; color: var(--text-muted); margin: 0 0 6px; }

        .book-list-action { flex-shrink: 0; }

        /* ── PAGINATION ── */
        .pagination-wrap {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            margin-top: 8px;
        }

        .page-btn {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: 1.5px solid var(--border);
            background: #fff;
            color: var(--text-dark);
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            transition: background 0.2s, color 0.2s, border-color 0.2s;
        }

        .page-btn:hover, .page-btn.active {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        .page-btn.disabled { opacity: 0.4; pointer-events: none; }



        /* ── EMPTY STATE ── */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--text-muted);
        }

        .empty-state i { font-size: 56px; margin-bottom: 16px; color: #d1d5db; }
        .empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-dark); margin-bottom: 8px; }
        .empty-state p { font-size: 14px; }

        /* ── RESPONSIVE ── */
        @media (max-width: 992px) {
            .catalog-body {
                flex-direction: column;
                width: 95% !important;
                margin: 30px auto !important;
                padding: 0 10px !important;
            }
            .search-row {
                width: 95% !important;
                margin: 0 auto !important;
            }
            .catalog-sidebar { width: 100%; }
            .books-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
            .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
            .search-section { padding: 14px 10px; }
        }

        @media (max-width: 576px) {
            .search-row { flex-direction: column; }
            .search-input-wrap, .filter-select, .btn-search, .btn-reset { width: 100%; }
            .books-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
            .footer-grid { grid-template-columns: 1fr; }
        }

        /* View toggle logic */
        body.list-view .books-grid { display: none; }
        body.list-view .books-list { display: block; }