/* Page Layout & Hero */
.books-hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    color: white;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Floating Shapes */
.hero-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
    opacity: 0.6;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
    animation: float 8s ease-in-out infinite alternate;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: #ec4899;
    bottom: -50px;
    right: -50px;
    animation: float 6s ease-in-out infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 30px); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.books-hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.books-hero p {
    font-size: 1.25rem;
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Filter Container */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    background: white;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
}

.filter-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
}

/* Loading & Error Text */
.loading-text, .error-text, .no-books {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
    font-size: 1.1rem;
    background: #f8fafc;
    border-radius: 16px;
    border: 2px dashed #e2e8f0;
}

/* Book Card Premium Styles */
.book-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}

.book-media {
    height: 220px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 2.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.book-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.book-cat {
    display: inline-flex;
    padding: 0.35rem 0.75rem;
    background: #eff6ff;
    color: var(--primary-color);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.book-lang {
    font-size: 0.75rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
}

.book-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-author::before {
    content: '';
    display: block;
    width: 20px;
    height: 1px;
    background: #cbd5e1;
}

.book-desc {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.book-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@media (max-width: 768px) {
    .books-hero h1 {
        font-size: 1.75rem;
    }

    .books-hero p {
        font-size: 0.95rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .filter-container {
        gap: 0.5rem;
        margin-bottom: 2rem;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .filter-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    /* Compact Card for Mobile */
    .book-card {
        padding: 0.75rem;
        border-radius: 12px;
    }

    .book-media {
        height: 140px;
        margin-bottom: 0.75rem;
        border-radius: 8px;
    }

    .book-placeholder {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .book-cat {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
        margin-bottom: 0.5rem;
    }

    .book-title {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
        -webkit-line-clamp: 2; 
        line-height: 1.3;
    }

    .book-author {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .book-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .book-lang {
        font-size: 0.65rem;
        padding: 0.1rem 0.4rem;
        align-self: flex-start;
    }

    .book-desc {
        display: none; /* Hide description on mobile to save space */
    }

    .book-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
        border-radius: 8px;
        margin-top: auto;
    }
}
