/* --- 1. Variables & Reset --- */
        :root {
            /* Google Material 3 Palette */
            --md-primary: #0b57d0;
            --md-on-primary: #ffffff;
            --md-primary-container: #d3e3fd;
            --md-on-primary-container: #041e49;
            --md-surface: #ffffff;
            --md-surface-variant: #f0f4f9;
            --md-outline: #747775;
            --md-text-main: #1f1f1f;
            --md-text-sub: #444746;
            
            /* Spacing & Layout */
            --radius-md: 12px;
            --radius-lg: 24px;
            --radius-pill: 50px;
            --header-height: 64px;
            --max-width: 1280px;
            
            /* Animation */
            --trans-fast: 0.2s cubic-bezier(0.2, 0.0, 0, 1.0);
            --trans-smooth: 0.4s cubic-bezier(0.2, 0.0, 0, 1.0);
        }

        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        
        body {
            font-family: 'Roboto', sans-serif;
            background-color: var(--md-surface);
            color: var(--md-text-main);
            overflow-x: hidden;
            display: flex; flex-direction: column; min-height: 100vh;
        }

        h1, h2, h3, .brand-font { font-family: 'Google Sans', sans-serif; }

        /* --- 2. Preloader --- */
        #preloader {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: #fff;
            z-index: 9999;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: opacity 0.5s ease;
        }
        .spinner {
            width: 48px; height: 48px;
            border: 5px solid #e0e0e0;
            border-bottom-color: var(--md-primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        /* --- 3. Navigation --- */
        .navbar {
            position: sticky; top: 0;
            height: var(--header-height);
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid #e0e3e7;
            z-index: 100;
            display: flex; align-items: center;
            padding: 0 24px;
        }
        .nav-inner {
            width: 100%; max-width: var(--max-width); margin: 0 auto;
            display: flex; justify-content: space-between; align-items: center;
        }
        .logo {
            display: flex; align-items: center; gap: 8px;
            font-family: 'Google Sans', sans-serif;
            font-size: 22px; font-weight: 500; color: #444;
            text-decoration: none;
        }
        .nav-actions { display: flex; gap: 12px; }
        .nav-btn {
            font-family: 'Google Sans', sans-serif;
            font-size: 14px; font-weight: 500;
            color: var(--md-text-sub);
            padding: 8px 16px;
            border-radius: var(--radius-pill);
            cursor: pointer; transition: var(--trans-fast);
            user-select: none;
        }
        .nav-btn:hover { background-color: var(--md-surface-variant); color: #000; }
        .btn-primary {
            background-color: var(--md-primary); color: #fff; border: none;
        }
        .btn-primary:hover { 
            background-color: #0842a0; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); 
        }

        /* --- 4. Hero Section --- */
        .hero {
            text-align: center; padding: 80px 20px 40px;
            background: radial-gradient(circle at 50% -20%, #f0f6ff, #fff 60%);
        }
        .hero h1 {
            font-size: clamp(2rem, 5vw, 3.5rem);
            line-height: 1.1; margin-bottom: 20px; color: #1f1f1f;
        }
        .search-container {
            max-width: 600px; margin: 40px auto; position: relative;
        }
        .search-input {
            width: 100%; height: 56px;
            border-radius: 28px; border: 1px solid #dfe1e5;
            padding: 0 20px 0 52px; font-size: 16px;
            box-shadow: 0 1px 6px rgba(32,33,36,0.1);
            outline: none; transition: var(--trans-fast);
        }
        .search-input:focus {
            box-shadow: 0 1px 6px rgba(32,33,36,0.2); border-color: transparent;
        }
        .search-icon {
            position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
            color: #9aa0a6; pointer-events: none;
        }

        /* --- 5. Grid & Cards --- */
        .container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; flex: 1; width: 100%; }
        
        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 24px; padding-bottom: 40px;
        }

        .book-card {
           
            display: flex; flex-direction: column;
            position: relative; overflow: hidden;
            
        }
        
        .card-img-wrap {
            aspect-ratio: 2/3; width: 100%;
            background: #f1f3f4; position: relative;
            overflow: hidden;
        }
        .card-img-wrap img {
            width: 100%; height: 100%; object-fit: cover;
            transition: transform 0.4s;
        }

        .card-body { padding: 16px 0; flex: 1; display: flex; flex-direction: column; }
        .card-title {
            font-family: 'Google Sans', sans-serif;
            font-size: 16px; font-weight: 500; margin-bottom: 4px;
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        }
        .card-author { font-size: 13px; color: #5f6368; margin-bottom: 12px; font-weight: 500; }
        
        .card-footer {
            margin-top: auto; display: flex; justify-content: space-between; align-items: center;
        }
        .chip {
            background: #efefef; color: #565656;
            padding: 4px 10px; border-radius: 60px; font-size: 11px; font-weight: 500;
        }
        .action-btn {
            background: none; border: none; cursor: pointer;
            padding: 8px; border-radius: 50%; color: #444;
            transition: background 0.2s;
            text-decoration: none; display: inline-flex;
            align-items: center; justify-content: center;
        }
        .action-btn:hover { background: #f5f5f5; }
        .action-btn.saved .material-icons { color: var(--md-primary); }

        /* --- 6. Pagination --- */
        .pagination-container {
            display: flex; justify-content: center; align-items: center; gap: 8px;
            margin: 20px 0 80px;
        }
        .page-btn {
            min-width: 40px; height: 40px; padding: 0 16px;
            border-radius: 20px; border: 2px solid #e0e3e7;
            background: #fff; color: var(--md-text-main);
            font-family: 'Google Sans', sans-serif; font-size: 14px; font-weight: 600;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: all 0.2s; user-select: none;
        }
        .page-btn:hover:not(:disabled) { background: var(--md-surface-variant); }
        .page-btn.active {
            background: var(--md-primary); color: #fff; border-color: var(--md-primary);
        }
        .page-btn:disabled {
            opacity: 0.5; cursor: not-allowed; background: #f9f9f9;
        }
        .page-dots { color: #999; letter-spacing: 2px; }

        /* --- 7. Drawer (Right Side) --- */
        .drawer-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.5);
            z-index: 900; opacity: 0; pointer-events: none; transition: opacity 0.3s;
        }
        .drawer-overlay.open { opacity: 1; pointer-events: auto; }
        
        .drawer {
            position: fixed; top: 0; right: 0; bottom: 0;
            width: 380px; max-width: 90%; background: #fff;
            z-index: 901; transform: translateX(100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex; flex-direction: column;
            box-shadow: -4px 0 24px rgba(0,0,0,0.15);
        }
        .drawer.open { transform: translateX(0); }
        
        .drawer-header {
            padding: 16px 24px; border-bottom: 1px solid #eee;
            display: flex; justify-content: space-between; align-items: center;
        }
        .drawer-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
        
        /* Drawer Items */
        .saved-item {
            display: flex; gap: 16px; margin-bottom: 16px; padding-bottom: 16px;
            border-bottom: 2px solid #e4e4e4; align-items: center;
        }
        .saved-item img {
            width: 70px; height: 100px; object-fit: cover; border-radius: 1px; background: #eee;
        }
        .saved-info h4 { font-size: 14px; margin-bottom: 4px; }
        .remove-btn { color: #d93025; font-size: 12px; cursor: pointer; font-weight: 500; }

        .collection-tag {
            display: inline-block; padding: 10px 16px;
            border: 2px solid #d6d8dc; border-radius: 60px;
            margin: 0 8px 12px 0; font-size: 14px; cursor: pointer;
            transition: all 0.2s;
        }
        .collection-tag:hover { border-color: var(--md-primary); background: #f0f6ff; color: var(--md-primary); }

        /* --- 8. Toast Notification --- */
        .toast {
            position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
            background: #323232; color: white;
            padding: 14px 24px; border-radius: 4px;
            font-size: 14px; opacity: 0; transition: all 0.3s; z-index: 2000;
            display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        .toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

        /* Responsive Tweaks */
        @media (max-width: 600px) {
            .navbar { padding: 0 16px; }
            .nav-btn.desktop-only { display: none; }
            .hero h1 { font-size: 2rem; }
            .book-card { flex-direction: row; height: 140px; }
            .card-img-wrap { width: 100px; height: 100%; aspect-ratio: unset; }
            .gallery-grid { grid-template-columns: 1fr; }
            .card-body { padding: 12px 16px; }
        }