/*
Theme Name: EreadHub Theme
Description: A simple theme for displaying ebooks with grid layout and detail pages.
Version: 1.0.0
Author: Your Name
Text Domain: ereadhubtheme
*/

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    margin-bottom: 40px;
}

.site-title {
    font-size: 2em;
    font-weight: bold;
    color: #007cba;
    text-decoration: none;
    display: inline-block;
}

.site-title:hover {
    color: #005a87;
    text-decoration: none;
}

.site-description {
    color: #666;
    font-size: 1.1em;
    margin-top: 5px;
}

/* Main Content */
.site-main {
    min-height: 60vh;
}

/* Ebook Grid */
.ebook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.ebook-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    height: 480px; /* Fixed card height */
    display: flex;
    flex-direction: column;
}

.ebook-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.ebook-card-image {
    width: 100%;
    height: 200px; /* Fixed image height */
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    flex-shrink: 0; /* Prevent image area from shrinking */
    overflow: hidden;
}

.ebook-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.ebook-card-content {
    padding: 20px;
    flex: 1; /* Take up remaining space */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ebook-card-info {
    flex: 1;
    margin-bottom: 15px;
}

.ebook-card-title {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit title to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;

}

.ebook-card-title a {
    color: inherit;
    text-decoration: none;
}

.ebook-card-title a:hover {
    color: #007cba;
}

.ebook-card-excerpt {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 6; /* Limit excerpt to 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 8.8em; /* Fixed height for 3 lines */
}

.ebook-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
}

.ebook-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    flex: 1;
    min-width: 90px;
}

.ebook-btn-primary {
    background-color: #007cba;
    color: white;
}

.ebook-btn-primary:hover {
    background-color: #005a87;
    color: white;
    text-decoration: none;
}

.ebook-btn-secondary {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

.ebook-btn-secondary:hover {
    background-color: #e9ecef;
    color: #333;
    text-decoration: none;
}

/* Ebook Detail Page */
.ebook-detail {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 40px 0;
}

.ebook-detail-header {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.ebook-detail-cover {
    flex-shrink: 0;
}

.ebook-detail-cover img {
    width: 250px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ebook-detail-info {
    flex: 1;
    min-width: 300px;
}

.ebook-detail-title {
    font-size: 2.5em;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #333;
    line-height: 1.2;
}

.ebook-detail-excerpt {
    font-size: 1.2em;
    color: #666;
    line-height: 1.6;
    margin: 0 0 30px 0;
}

.ebook-detail-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ebook-detail-actions .ebook-btn {
    min-width: 140px;
    padding: 12px 24px;
    font-size: 1em;
}

.ebook-detail-content {
    margin-top: 40px;
    line-height: 1.8;
    font-size: 1.1em;
}

.ebook-detail-content h2,
.ebook-detail-content h3 {
    margin: 30px 0 15px 0;
    color: #333;
}

.ebook-detail-content p {
    margin: 0 0 20px 0;
}

/* Carousel Images */
.ebook-carousel {
    margin: 40px 0;
}

.ebook-carousel h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3em;
}

.ebook-carousel-images {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ebook-carousel img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.ebook-carousel img:hover {
    transform: scale(1.05);
    border-color: #007cba;
}

/* Footer */
.site-footer {
    background: #333;
    color: #fff;
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
}

.site-footer p {
    margin: 0;
    opacity: 0.8;
}



/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .ebook-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        margin: 30px 0;
    }

    .ebook-card {
        height: 420px; /* Smaller height for mobile */
    }

    .ebook-card-image {
        height: 180px; /* Smaller image height for mobile */
    }

    .ebook-card-content {
        padding: 15px;
    }

    .ebook-card-excerpt {
        font-size: 0.85em;
        height: 3.6em; /* Adjust for smaller font */
    }

    .ebook-detail {
        padding: 25px;
        margin: 20px 0;
    }

    .ebook-detail-header {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }

    .ebook-detail-cover img {
        width: 200px;
    }

    .ebook-detail-title {
        font-size: 2em;
    }

    .ebook-detail-actions {
        justify-content: center;
    }

    .ebook-card-actions {
        flex-direction: column;
    }

    .ebook-carousel-images {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.5em;
    }

    .ebook-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .ebook-card {
        height: 380px; /* Even smaller for very small screens */
        margin: 0 10px;
    }

    .ebook-card-image {
        height: 160px;
    }

    .ebook-card-content {
        padding: 12px;
    }


    .ebook-card-excerpt {
        font-size: 0.8em;
        height: 3.2em;
        -webkit-line-clamp: 2; /* Reduce to 2 lines on very small screens */
    }

    .ebook-card-actions {
        gap: 8px;
    }

    .ebook-btn {
        padding: 8px 12px;
        font-size: 0.8em;
    }

    .ebook-detail-title {
        font-size: 1.8em;
    }

    .ebook-detail-cover img {
        width: 150px;
    }

    .ebook-carousel img {
        width: 80px;
        height: 80px;
    }
}
