/* ============================
   GLOBAL STYLE
============================ */
body {
    background: #f4f6fa;
    font-family: "Inter", sans-serif;
    color: #212529;
}

h2 {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

/* ============================
   SEARCH BAR
============================ */
.search-box .form-control {
    width: 60%;
    max-width: 520px;
    border-radius: 50px;
    padding: 0.8rem 1.3rem;
    font-size: 1rem;
    transition: 0.3s ease;
}

.search-box .form-control:focus {
    border-color: #ee25d381;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* ============================
   EBOOK CARD
============================ */
/* ============================
   EBOOK CARD - OVERLAY TRẮNG
============================ */
.ebook-card {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background-color: #f5f5f5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.ebook-image-wrapper {
    width: 100%;
}

.ebook-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: inherit;
    transition: transform 0.3s ease;
}

.ebook-card:hover .ebook-img {
    transform: scale(1.03);
}

/* Overlay chữ nền trắng */
.ebook-content {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    /* nền trắng hơi trong suốt */
    padding: 10px;
    text-align: center;
    color: #212529;
    /* chữ tối để nhìn rõ trên nền trắng */
    display: flex;
    flex-direction: column;

    /* bắt đầu ẩn dưới card */
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Khi hover, overlay chạy lên */
.ebook-card:hover .ebook-content {
    transform: translateY(0);
    opacity: 1;
}

/* TITLE */
.ebook-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
}

/* DESCRIPTION */
.ebook-desc {
    font-size: 0.85rem;
    margin-top: 4px;
}

/* META */
.ebook-meta {
    margin-top: 6px;
    font-size: 0.72rem;
}

/* BADGE */
.badge {
    font-size: 0.72rem;
    border-radius: 6px;
    padding: 0.23rem 0.45rem;
}




/* ============================
   LAPTOP & TABLET
============================ */
@media (max-width: 1024px) {
    .ebook-image-wrapper {
        height: 230px;
    }

    .ebook-title {
        font-size: 0.96rem;
        min-height: 40px;
    }

    .ebook-desc {
        min-height: 44px;
    }
}

/* ============================
   TABLET DỌC (≤ 768px)
============================ */
@media (max-width: 768px) {
    h2 {
        font-size: 1.9rem;
    }

    .search-box .form-control {
        width: 80%;
    }

    .ebook-card {
        border-radius: 18px;
    }

    .ebook-title {
        font-size: 0.95rem;
    }

    .ebook-desc {
        font-size: 0.82rem;
    }

    .ebook-meta small {
        display: none !important;
        /* ẩn ngày */
    }
}

/* ============================
   MOBILE LARGE (≤ 640px)
============================ */
@media (max-width: 640px) {
    .ebook-card {
        border-radius: 16px;
    }

    .ebook-title {
        font-size: 0.92rem;
    }

    .ebook-desc {
        font-size: 0.8rem;
    }
}

/* ============================
   MOBILE SMALL (≤ 480px)
============================ */
@media (max-width: 480px) {
    .search-box .form-control {
        width: 90%;
        font-size: 0.92rem;
    }

    .ebook-card {
        border-radius: 14px;
    }

    .ebook-title {
        font-size: 0.88rem;
    }

    .ebook-desc {
        font-size: 0.78rem;
    }

    .ebook-meta small {
        font-size: 0.68rem;
    }

    .badge {
        font-size: 0.6rem;
    }
}

/* ============================
   MOBILE SIÊU NHỎ (≤ 360px)
============================ */
@media (max-width: 360px) {
    .ebook-card {
        border-radius: 12px;
    }

    .ebook-title {
        font-size: 0.82rem;
    }

    .ebook-desc {
    font-size: 0.75rem;
    line-clamp: 2; /* Thuộc tính chuẩn */
    -webkit-line-clamp: 2; /* Hỗ trợ Chrome/Safari */

    }
}