/* Books Grid Component - Image-focused design */

/* Book Card Wrapper */
.book-card-wrapper {
    position: relative;
    display: block;
}

/* Book Card */
.book-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 5px;
}

.book-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
    border-color: var(--primary-color);
}

/* Book Image Wrapper - More prominent */
.book-image-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
}

.book-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Book Info - More subtle */
.book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0.5rem;
    min-height: 0;
    max-height: 80px; /* Fixed height to prevent card growth */
}

.book-title {
    margin: 0 0 0.25rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    min-height: 1.3em;
    max-height: 2.6em;
}

.book-author {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Book Footer */
.book-footer {
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0.5rem;
}

/* Mode Badges */
.book-mode-badges {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    justify-content: center;
    min-width: 0;
}

/* When there are two badges, each takes 50% */
.book-mode-badges:has(.mode-badge:nth-child(2)) .mode-badge {
    flex: 1;
    max-width: 50%;
}

/* When there's only one badge, it takes full width */
.book-mode-badges:not(:has(.mode-badge:nth-child(2))) .mode-badge {
    flex: 1;
    max-width: 100%;
}

.mode-badge i {
    flex-shrink: 0;
    font-size: 0.6rem;
}

.mode-badge .price {
    font-weight: 600;
    flex-shrink: 0;
}

.mode-sale {
    background: var(--success-light);
    color: var(--success-dark);
}

.mode-share {
    background: var(--info-light);
    color: var(--info-dark);
}

/* Book Save Button */
.book-save-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.book-save-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.book-save-btn i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.book-save-btn i.fas {
    color: var(--primary-color);
}

.book-save-btn:hover i.fas {
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .book-image-wrapper {
        height: 220px;
    }
    
    .book-info {
        padding: 0.5rem 0.75rem;
        max-height: 75px; /* Slightly smaller on tablets */
    }
    
    .book-footer {
        padding: 0.2rem 0.75rem;
    }
    
    .book-save-btn {
        width: 32px;
        height: 32px;
    }
    
    .book-save-btn i {
        font-size: 1rem;
    }
    
    .mode-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.3rem;
    }
    
    .mode-badge i {
        font-size: 0.55rem;
    }
}

@media (max-width: 600px) {
    .book-image-wrapper {
        height: 200px;
    }
    
    .book-info {
        max-height: 70px; /* Even smaller on mobile */
    }
    
    .book-title {
        font-size: 0.8rem;
        max-height: 2.4em; /* Slightly smaller line height on mobile */
    }
    
    .book-author {
        font-size: 0.7rem;
    }
    
    .book-save-btn {
        width: 28px;
        height: 28px;
    }
    
    .book-save-btn i {
        font-size: 0.9rem;
    }
    
    .mode-badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.25rem;
    }
    
    .mode-badge i {
        font-size: 0.5rem;
    }
}
