﻿.back-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease;
}

    .back-button:hover {
        background-color: #5a6268;
    }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.book-detail {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}


.book-info {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.book-cover {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}


    .book-cover img {
        width: 100%;
        height: 400px;
        object-fit: cover;
    }

.book-meta {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.book-title {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.book-author {
    font-size: 1.3em;
    color: #7f8c8d;
    margin-bottom: 20px;
    font-style: italic;
}

.book-category {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: bold;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.book-rating {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.stars {
    color: #f39c12;
    font-size: 1.5em;
    margin-right: 10px;
}

.rating-text {
    color: #7f8c8d;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

    .btn-primary:hover {
        box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6);
    }

.btn-secondary {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

    .btn-secondary:hover {
        box-shadow: 0 8px 25px rgba(149, 165, 166, 0.6);
    }

.book-description {
    margin-bottom: 40px;
}

    .book-description h3 {
        font-size: 1.5em;
        color: #2c3e50;
        margin-bottom: 15px;
        border-bottom: 3px solid #3498db;
        padding-bottom: 10px;
    }

    .book-description p {
        font-size: 1.1em;
        line-height: 1.8;
        color: #555;
        text-align: justify;
    }

.related-books {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

    .related-books h2 {
        font-size: 2em;
        color: #2c3e50;
        margin-bottom: 30px;
        text-align: left;
        position: relative;
    }

        .related-books h2:after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 0;
            transform: none;
            width: 60px;
            height: 3px;
            background: linear-gradient(45deg, #ff6b6b, #ee5a52);
            border-radius: 2px;
        }

    .related-books .books-grid {
        display: flex;
        overflow-x: auto;
        gap: 15px;
        padding: 10px 0 15px 0;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

        /* Style cho scrollbar */
        .related-books .books-grid::-webkit-scrollbar {
            height: 6px;
        }

        .related-books .books-grid::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 3px;
        }

        .related-books .books-grid::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 3px;
        }

            .related-books .books-grid::-webkit-scrollbar-thumb:hover {
                background: #a8a8a8;
            }

    .related-books .book-card {
        flex: 0 0 150px; /* Fixed width, không co giãn */
        width: 150px;
        text-align: center;
        cursor: pointer;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        background: white;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

        .related-books .book-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 20px rgba(0,0,0,0.15);
        }

        .related-books .book-card img {
            width: 100%;
            height: 180px;
            object-fit: cover;
            border-radius: 6px;
            margin-bottom: 10px;
            transition: transform 0.3s ease;
        }

        .related-books .book-card:hover img {
            transform: scale(1.05);
        }

        .related-books .book-card h4 {
            font-size: 13px;
            font-weight: 600;
            color: #333;
            margin: 8px 0 5px 0;
            line-height: 1.3;
            height: 32px; /* Fixed height để đồng nhất */
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .related-books .book-card .author {
            font-size: 11px;
            color: #666;
            margin: 0;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-overflow: ellipsis;
        }

/* Responsive cho mobile */
@media (max-width: 768px) {
    .related-books {
        padding: 0 10px;
    }

        .related-books h2 {
            font-size: 1.3em;
            margin-bottom: 15px;
        }

        .related-books .books-grid {
            gap: 12px;
            padding: 5px 0 10px 0;
        }

        .related-books .book-card {
            flex: 0 0 120px;
            width: 120px;
            padding: 8px;
        }

            .related-books .book-card img {
                height: 150px;
            }

            .related-books .book-card h4 {
                font-size: 12px;
                height: 30px;
            }

            .related-books .book-card .author {
                font-size: 10px;
            }
}

@media (max-width: 480px) {
    .related-books .book-card {
        flex: 0 0 100px;
        width: 100px;
        padding: 6px;
    }

        .related-books .book-card img {
            height: 130px;
        }

        .related-books .book-card h4 {
            font-size: 11px;
            height: 28px;
        }

    .back-button {
        position: static;
        margin: 3px;
    }
}

.books-grid {
    display: flex;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.book-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

    .book-card:before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    }

    .book-card:hover:before {
        left: 100%;
    }

    .book-card:hover {
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
        transform: translateY(-2px);
    }

    .book-card img {
        width: 120px;
        height: 160px;
        object-fit: cover;
        border-radius: 10px;
        margin-bottom: 15px;
    }

    .book-card h4 {
        font-size: 1.1em;
        color: #2c3e50;
        margin-bottom: 8px;
        font-weight: bold;
    }

    .book-card .author {
        color: #7f8c8d;
        font-size: 0.9em;
        margin-bottom: 10px;
        font-style: italic;
    }

.book-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.spec-item {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.spec-label {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.spec-value {
    color: #555;
}

@media (max-width: 768px) {
    .book-info {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .book-title {
        font-size: 2em;
    }

    .action-buttons {
        justify-content: center;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #3498db;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

    .quantity-btn:hover {
        background: #2980b9;
        transform: scale(1.1);
    }

.quantity-input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 2px solid #3498db;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
}

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    padding: 25px;
    max-width: 420px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.popup-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px 30px 30px 30px;
}

.popup-title {
    font-size: 1.5em;
    color: white;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

    .popup-title::before {
        display: none !important;
    }

.popup-subtitle {
    color: #EFF836;
    font-size: 0.9em;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

    .form-input:focus {
        outline: none;
        border-color: #3498db;
        box-shadow: 0 0 10px rgba(52, 152, 219, 0.2);
    }

    .form-input:invalid {
        border-color: #e74c3c;
    }

.popup-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.popup-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.popup-btn-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

    .popup-btn-primary:hover {
        box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6);
        transform: translateY(-2px);
    }

.popup-btn-secondary {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

    .popup-btn-secondary:hover {
        box-shadow: 0 8px 25px rgba(149, 165, 166, 0.6);
        transform: translateY(-2px);
    }

.close-popup {
    position: absolute;
    top: 30px;
    right: 35px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 10001;
}

    .close-popup:hover {
        color: #e74c3c;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

.success-message {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
    display: none;
    font-size: 0.95em;
}

@media (max-width: 480px) {
    .popup-container {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
    }

    .popup-buttons {
        flex-direction: column;
    }

    .popup-btn {
        width: 100%;
    }
}

.popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
}

.popup-close {
    font-size: 30px;
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}
