:root {
    --bg-body: #f3f4f6; 
    --bg-surface: rgba(255, 255, 255, 0.7); 
    --text-main: #111827; 
    --text-sec: #6b7280; 
    --border: rgba(255, 255, 255, 0.5); 
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); 
    --gradient-hero: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%); 
    --gradient-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.dark-mode {
    --bg-body: #0f172a; 
    --bg-surface: rgba(30, 41, 59, 0.7); 
    --text-main: #f8fafc; 
    --text-sec: #94a3b8; 
    --border: rgba(255, 255, 255, 0.1);
    
    --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body { 
    background: var(--bg-body); 
    background-image: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 20%);
    color: var(--text-main); 
    padding-top: 110px; 
    transition: 0.3s; 
    min-height: 100vh;
    position: relative;
    display: flex; flex-direction: column;
}

.navbar { 
    position: absolute; 
    top: 20px; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 1100px; height: 70px; 
    background: var(--bg-surface);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: 20px; 
    z-index: 1000; display: flex; align-items: center; box-shadow: var(--shadow-lg);
}

.nav-content { width: 100%; display: flex; justify-content: space-between; padding: 0 30px; }

.logo { 
    font-weight: 800; font-size: 1.4rem; 
    background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
    display: flex; gap: 8px; cursor: pointer; align-items: center; 
}

.nav-actions { display: flex; gap: 15px; }
.icon-btn { background: transparent; border: none; cursor: pointer; color: var(--text-sec); padding: 8px; border-radius: 50%; transition: 0.2s; }
.icon-btn:hover { background: rgba(0,0,0,0.05); color: #6366f1; }

.btn-primary-outline { 
    border: 2px solid #6366f1; background: transparent; color: #6366f1; 
    padding: 8px 20px; border-radius: 50px; font-weight: 700; cursor: pointer; transition: 0.3s; 
}
.btn-primary-outline:hover { 
    background: var(--gradient-primary); color: white; border-color: transparent; 
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.hero { 
    text-align: center; 
    max-width: 950px; 
    width: 90%;
    margin: 20px auto 80px; 
    padding: 70px 20px;     
    
    border-radius: 30px;    
    background: var(--gradient-hero); 
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.hero h1 { font-size: 2.8rem; margin-bottom: 15px; color: var(--text-main); letter-spacing: -1.5px; }
.hero p { color: var(--text-sec); font-size: 1.1rem; max-width: 600px; margin: 0 auto 40px; opacity: 0.9; font-weight: 500; }

.search-wrapper { 
    max-width: 680px; margin: 0 auto; display: flex; gap: 10px; 
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px; border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.6);
}
body.dark-mode .search-wrapper { background: rgba(30, 41, 59, 0.9); border-color: rgba(255,255,255,0.1); }

.search-wrapper input { 
    flex: 1; padding: 12px 20px; border: none; background: transparent; 
    color: var(--text-main); font-size: 1.1rem; outline: none; 
}

.btn-search-hero { 
    background: var(--gradient-primary); color: white; border: none; padding: 0 30px; border-radius: 14px; 
    font-weight: 700; cursor: pointer; font-size: 1rem; transition: 0.3s; 
    display: flex; align-items: center; justify-content: center;
}
.btn-search-hero:hover { 
    background: var(--gradient-hover); transform: scale(1.05); box-shadow: 0 5px 15px rgba(168, 85, 247, 0.4); 
}

.main-container { 
    max-width: 1200px; margin: 0 auto; padding: 0 20px 40px; 
    width: 100%; flex: 1; 
}
.status-message { text-align: center; margin-bottom: 40px; font-weight: 600; color: var(--text-sec); letter-spacing: 1px; text-transform: uppercase; font-size: 0.8rem; }

.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 35px; }

.book-card { 
    background: var(--bg-surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border); border-radius: 20px; padding: 15px; 
    display: flex; flex-direction: column; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; 
}
.book-card:hover { transform: translateY(-10px) scale(1.02); box-shadow: 0 20px 40px -10px rgba(0,0,0,0.2); border-color: #a855f7; }

.cover-container { width: 100%; aspect-ratio: 2/3; border-radius: 12px; overflow: hidden; margin-bottom: 15px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.cover-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.book-card:hover .cover-img { transform: scale(1.1); }

.book-card h3 { font-size: 1.1rem; margin-bottom: 5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 700; color: var(--text-main); }
.book-card p { font-size: 0.85rem; color: var(--text-sec); margin-bottom: 15px; font-weight: 500; }

.badge { position: absolute; padding: 5px 10px; border-radius: 8px; font-size: 0.65rem; font-weight: 800; color: white; text-transform: uppercase; z-index: 5; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.cat-badge { top: 10px; left: 10px; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.2); }

.status-select { width: 100%; margin-top: auto; padding: 10px; margin-bottom: 10px; background: rgba(0,0,0,0.03); color: var(--text-main); border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 600; outline: none; transition: 0.2s; }
.status-select:hover { background: rgba(0,0,0,0.06); }

.btn-details { width: 100%; padding: 10px; background: transparent; border: 2px solid #6366f1; color: #6366f1; font-weight: 700; border-radius: 10px; cursor: pointer; transition: 0.2s; }
.btn-details:hover { background: var(--gradient-primary); color: white; border-color: transparent; }

.modal-overlay { position: fixed; inset: 0; background: rgba(10, 10, 20, 0.6); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-content { 
    background: var(--bg-surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    width: 95%; max-width: 850px; max-height: 90vh; overflow-y: auto; 
    border-radius: 30px; padding: 0; position: relative; 
    border: 1px solid rgba(255,255,255,0.4); box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes zoomIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.close-btn { position: absolute; top: 20px; right: 25px; background: rgba(0,0,0,0.05); border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 1.5rem; color: var(--text-main); cursor: pointer; z-index: 10; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.close-btn:hover { background: #ef4444; color: white; transform: rotate(90deg); }

.modal-body-grid { display: grid; grid-template-columns: 260px 1fr; gap: 40px; padding: 50px; }
.modal-cover-box { text-align: center; }
.modal-img-big { width: 100%; border-radius: 15px; box-shadow: 0 15px 40px rgba(99, 102, 241, 0.25); transform: perspective(800px) rotateY(-10deg); transition: 0.5s; }
.modal-img-big:hover { transform: perspective(800px) rotateY(0deg) scale(1.05); }

.modal-info-box h2 { font-size: 2.2rem; margin-top: 0; margin-bottom: 10px; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.1; }
.modal-author { font-size: 1.2rem; color: var(--text-main); margin-bottom: 20px; font-weight: 500; opacity: 0.8; }

.meta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 25px; }
.meta-tag { background: rgba(99, 102, 241, 0.1); color: #6366f1; border: 1px solid rgba(99, 102, 241, 0.2); padding: 8px 16px; border-radius: 50px; font-size: 0.85rem; font-weight: 700; }

.desc-box { background: rgba(0,0,0,0.03); padding: 25px; border-radius: 16px; color: var(--text-main); line-height: 1.7; font-size: 1rem; max-height: 250px; overflow-y: auto; margin-bottom: 30px; white-space: pre-line; }

.btn-action { display: inline-flex; align-items: center; justify-content: center; background: var(--gradient-primary); color: white; padding: 16px 40px; border-radius: 16px; font-size: 1rem; font-weight: 700; text-decoration: none; transition: 0.3s; width: 100%; text-align: center; box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3); }
.btn-action:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 15px 30px rgba(168, 85, 247, 0.5); }

.pagination-container { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 50px; padding-bottom: 30px; }
.pagination-container button { 
    padding: 12px 24px; cursor: pointer; background: var(--bg-surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border); color: var(--text-main); border-radius: 50px; font-weight: 600; font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); box-shadow: 0 4px 6px rgba(0,0,0,0.05); display: flex; align-items: center; gap: 5px;
}
.pagination-container button:hover:not(:disabled) { border-color: #6366f1; color: #6366f1; background: rgba(255, 255, 255, 0.9); transform: translateY(-3px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2); }
.pagination-container button:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(100%); box-shadow: none; }
#pageIndicator { 
    font-family: 'Inter', monospace; font-weight: 700; color: #6366f1; background: rgba(99, 102, 241, 0.1); 
    border: 1px solid rgba(99, 102, 241, 0.2); padding: 10px 20px; border-radius: 12px; letter-spacing: 0.5px; min-width: 100px; text-align: center;
}

.main-footer {
    width: 100%; text-align: center; padding: 30px 20px;
    margin-top: auto;
    background: var(--bg-surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); color: var(--text-sec); font-size: 0.85rem; font-weight: 600;
}
.main-footer a { color: #6366f1; text-decoration: none; font-weight: 700; transition: 0.2s; }
.main-footer a:hover { color: #a855f7; text-decoration: underline; }

/* Mobile */
@media (max-width: 768px) {
    .navbar { width: 100%; border-radius: 0; top: 0; position: absolute; }
    .hero { padding-top: 50px; margin-top: 60px; max-width: 100%; width: 100%; border-radius: 0; }
    .modal-body-grid { grid-template-columns: 1fr; text-align: center; padding: 30px 20px; }
    .modal-img-big { max-width: 200px; transform: none; margin: 0 auto; }
    .meta-row { justify-content: center; }
}