﻿/* =========================== BOOK TOP LAYOUT =========================== */
.book-top-full {
    width: 100%;
    margin-top: 10px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

.rating {
    font-size: 14px;
    font-weight: bold;
    align-items: center;
    color: var(--accent-color);
}

/* card bao cả cover + product */
.book-top-card {
    width: min(100%, 1500px);
    display: grid;
    grid-template-columns: 1fr 600px;
    gap: 18px;
    align-items: self-start;
    background: var(--white);
    border-radius: 8px;
    padding: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

/* ---------- cover (giữa) ---------- */
.book-cover {
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover-large {
    max-width: 100%;
    max-height: 520px;
    border-radius: 6px;
    display: block;
}

/* ---------- product card (bên phải) ---------- */
.book-product-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--white);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    box-sizing: border-box;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

    .book-product-card:hover {
        box-shadow: 0 8px 20px rgba(0,0,0,0.2);
        transform: translateY(-4px);
    }

    .book-product-card .product-title {
        font-size: 24px;
        font-weight: 700;
        margin: 0 0 8px 0;
        color: var(--primary-dark);
    }

.product-meta {
    color: var(--text-mute);
    font-size: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
/* option box */
.product-box .product-option {
    background: var(--background-light);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.product-option label {
    font-size: 18px;
    color: var(--primary-dark);
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.option-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}
/* qty control */
.qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .qty-control .qty {
        width: 48px;
        text-align: center;
        padding: 6px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
        background: var(--white);
    }

    .qty-control button {
        padding: 6px 10px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
        background: var(--white);
        cursor: pointer;
    }
/* price + actions */
.product-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    margin-bottom: 8px;
}

    .product-price .label {
        color: var(--primary-dark);
        font-size: 18px;
    }

    .product-price .amount {
        color: var(--danger-color);
        font-weight: 700;
        font-size: 20px;
    }
/* buttons */
.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.btn {
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-buy {
    background: var(--danger-color);
    color: var(--white);
}

    .btn-buy:hover {
        background: var(--background-dark);
    }

.btn-add {
    background: var(--white);
    color: var(--danger-color);
    border: 1px solid rgba(0,0,0,0.06);
}

    .btn-add:hover {
        background: var(--hover-bg);
    }

/* Commercial type styles */
.commercialType {
    display: inline-flex;
    text-decoration: none;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    animation: slideUp 0.6s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Loại 1: Sách nhà nước đặt hàng, chương trình mục tiêu (miễn phí) */
.commercial-state {
    background-color: var(--background-light);
    color: var(--green);
    border: 1px solid var(--border-accent);
}

/* Loại 2: Sách liên kết (không bán-không đọc) */
.commercial-linked {
    background-color: var(--background-light);
    color: var(--light-red);
    border: 1px solid var(--border-accent);
}

/* Dự phòng */
.commercial-default {
    color: var(--primary-color);
}

/* =========================== AUDIO PLAYER =========================== */
.audio-player-box {
    background: var(--background-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

    .audio-player-box .audio-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--primary-dark);
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

.book-audio-player {
    width: 100%;
    height: 42px;
    border-radius: 8px;
    outline: none;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    box-sizing: border-box;
}

.btn-audio {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .btn-audio:hover {
        background: var(--primary-dark);
    }

.audio-select {
    flex: 1;
    min-width: 0;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--white);
    font-size: 14px;
}

/* =========================== PDF =========================== */
.read-btn {
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--background-accent);
    color: #fff;
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

/* =========================== MAIN LAYOUT (below top) =========================== */
.book-detail-layout {
    width: min(100%, 1500px);
    margin: 10px auto;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 2fr 360px; /* main | sidebar */
    gap: 18px;
    box-sizing: border-box;
    overflow: unset;
    height: auto;
}

/* generic card */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 14px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    box-sizing: border-box;
    margin-top: 10px;
}

/* publisher block */
.publisher-grid {
    display: flex;
    gap: 12px;
    padding: 12px;
    align-items: flex-start;
}

.publisher-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.publisher-grid .publisher-field:not(:last-child) {
    padding-right: 12px;
    padding-left: 12px;
    border-right: 2px solid var(--primary-dark);
}

.publisher-grid .publisher-field:last-child {
    padding-left: 12px;
}

.publisher-grid .publisher-field-info {
    color: var(--text-mute);
}
/* specs table */
.book-specs {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

    .book-specs td {
        padding: 10px;
        border-bottom: 1px solid var(--border-color);
        font-size: 14px;
        color: var(--text-color);
    }

/* =========================== TABS =========================== */
.book-tabs .tab-header {
    display: flex;
    gap: 22px;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}

.tab-header .tab-item {
    padding: 8px 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-mute);
    position: relative;
    transition: color .22s ease;
}

    .tab-header .tab-item:hover {
        background-color: var(--hover-bg);
        opacity: 0.8;
    }

    .tab-header .tab-item.active {
        color: var(--primary-color);
        font-weight: 700;
    }

        .tab-header .tab-item.active::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: -2px;
            height: 3px;
            background: var(--primary-color);
            border-radius: 2px;
        }

/* tab content show/hide */
.tab-content {
    display: none;
    white-space: pre-line;
    color: var(--text-color);
}

    .tab-content.active {
        display: block;
    }



/* =========================== COMMENTS =========================== */
.review-session h1, h2, h3, h4 {
    margin-left: 5px;
    font-weight: 700;
    color: var(--primary-dark);
}

.review-session h5, h6 {
    margin-left: 5px;
    font-weight: 500;
    font-size: 18px;
    color: var(--primary-dark);
}

.review-form {
    margin-left: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

.comment-input {
    resize: vertical;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
}

    .comment-input:focus {
        border-color: var(--primary-color);
        outline: none;
        background: var(--background-light);
    }

/* Star Selection */
.rating-select {
    align-items: center;
}

.stars-input {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
}

    .stars-input input {
        display: none;
    }

    .stars-input label {
        font-size: 22px;
        color: var(--border-color);
        cursor: pointer;
    }

        .stars-input label:hover,
        .stars-input label:hover ~ label,
        .stars-input input:checked ~ label {
            color: var(--accent-color);
        }

.btn-review {
    align-self: flex-end;
    padding: 8px 16px;
    border-radius: 6px;
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    cursor: pointer;
    border: none;
    margin-bottom: 10px;
    transition: background 0.2s ease;
}

    .btn-review:hover {
        background: var(--primary-dark);
        color: var(--white);
    }

.review-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.review-item {
    padding: 10px;
    border-radius: 6px;
    background: var(--background-light);
    border: 1px solid var(--border-color);
}

.review-author {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 2px;
}

.review-date {
    font-size: 12px;
    color: var(--text-mute);
    margin-bottom: 6px;
}

.comment-text {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.4;
}


/* =========================== RELATED (sidebar) =========================== */
.book-sidebar-wrapper {
    height: auto;
}

.book-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 60px;
}

.related-section h4,
.related-section h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: var(--primary-dark)
}

.book-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}


    .book-list li {
        background: var(--background-light);
        border-radius: 8px;
        padding: 8px;
        border: 1px solid var(--border-color);
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
        box-sizing: border-box;
        transition: box-shadow 0.25s ease, transform 0.25s ease;
    }

        .book-list li:hover {
            box-shadow: 0 8px 20px rgba(0,0,0,0.12);
            transform: translateY(-3px);
        }

        .book-list li a {
            display: flex;
            gap: 10px;
            align-items: stretch;
            text-decoration: none;
            width: 100%;
        }



    .book-list img {
        width: 50px;
        height: 70px;
        object-fit: cover;
        border-radius: 6px;
        border: 1px solid var(--border-color);
    }

.book-mini-title {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    flex: 1;
}

    .book-mini-title .book-title {
        color: var(--primary-color);
        font-weight: bold;
    }

    .book-mini-title .book-view {
        font-size: 14px;
        color: var(--text-mute)
    }

/* =========================== UTILITY =========================== */
.card-inline {
    padding: 12px;
}

/* =========================== MOBILE FIX =========================== */
@media (max-width: 1000px) {
    /* Top card chuyển sang 1 cột */
    .book-top-card {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 10px;
        width: 495px;
    }

    .book-product-card {
        max-width: 475px;
    }

    /* Ảnh sách full-width, đứng riêng */
    .book-cover {
        width: 100%;
        max-width: 475px;
        justify-content: center;
    }

    .book-cover-large {
        width: 100%;
        max-width: 475px;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    /* Product card nằm dưới, cân ngang */
    .book-product-card {
        width: 100%;
        padding: 14px;
        order: 2;
    }

    /* Layout dưới chỉ còn 1 cột */
    .book-detail-layout {
        grid-template-columns: 1fr;
        padding: 0 12px;
    }

    /* Sidebar xuống dưới */
    .book-sidebar {
        position: static;
        top: auto;
    }

    .book-sidebar-wrapper {
        margin-top: -15px;
    }
}
