/* =========================================
   1. GLOBAL SETTINGS & VARIABLES
   ========================================= */
:root {
    --font-main: 'Plus Jakarta Sans', sans-serif; /* Font hiện đại */
    --primary-color: #ff6b35;       /* Cam san hô đậm đà hơn */
    --primary-gradient: linear-gradient(135deg, #ff6b35 0%, #f94d1c 100%);
    --secondary-color: #0f172a;     /* Xanh đen (Slate) thay vì đen tuyền */
    --text-body: #475569;           /* Xám trung tính */
    --bg-surface: #ffffff;
    --bg-body: #f1f5f9;             /* Nền body hơi xanh nhạt */
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.08); /* Bóng mờ sang trọng */
    --shadow-hover: 0 20px 40px -10px rgba(255, 107, 53, 0.3);
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-body);
}

/* =========================================
   2. MAIN CARD LAYOUT
   ========================================= */
.book-detail-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 40px;
    margin-top: 20px;
    margin-bottom: 40px;
    border: 1px solid rgba(255,255,255,0.5); /* Viền mờ */
}

/* Layout Grid cho Desktop */
.book-detail-card .row {
    display: grid;
    grid-template-columns: 350px 1fr; /* Cột ảnh cố định, cột nội dung giãn */
    gap: 50px;
}

/* =========================================
   3. BOOK COVER (IMAGE) - Điểm nhấn
   ========================================= */
.book-image {
    width: 100%;
    border-radius: 12px;
    /* Hiệu ứng bóng 3D giống bìa sách thật */
    box-shadow: 
        -10px 0 20px rgba(0,0,0,0.1), /* Gáy sách */
        10px 20px 30px rgba(0,0,0,0.15); 
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Hiệu ứng nhấc sách lên khi hover */
.col-md-4:hover .book-image {
    transform: translateY(-8px) scale(1.02);
}

.no-image-placeholder {
    width: 100%;
    height: 450px;
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed #cbd5e1;
    color: #94a3b8;
}

/* =========================================
   4. TYPOGRAPHY & HEADER
   ========================================= */
.book-title {
    font-size: 2.5rem; /* To hơn */
    font-weight: 800;  /* Đậm hơn */
    color: var(--secondary-color);
    line-height: 1.2;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.book-author {
    font-size: 1.1rem;
    color: var(--text-body);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.book-author a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    position: relative;
}

/* Gạch chân animation cho tên tác giả */
.book-author a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}
.book-author a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* =========================================
   5. INFO GRID (Thay cho hộp xám cũ)
   ========================================= */
.book-info {
    display: flex;
    gap: 30px;
    padding: 20px 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 25px;
    background: transparent; /* Bỏ nền xám */
}

.info-item {
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
}

.info-item strong {
    color: var(--secondary-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    opacity: 0.7;
}

/* =========================================
   6. PRICE & DESCRIPTION
   ========================================= */
.price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--secondary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.price::before {
    content: '$';
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 5px;
}

.description {
    color: var(--text-body);
    line-height: 1.7;
    font-size: 1.05rem;
    margin-bottom: 30px;
    padding-left: 15px;
    border-left: 4px solid var(--primary-color); /* Điểm nhấn viền trái */
    background: none; /* Bỏ nền xám */
}

/* =========================================
   7. CATEGORIES (TAGS)
   ========================================= */
.categories {
    margin-bottom: 30px;
}

.category-tag {
    background: #f1f5f9;
    color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.category-tag:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

/* =========================================
   8. BUTTONS (Modern Gradient)
   ========================================= */
.action-buttons {
    margin-top: auto; /* Đẩy xuống dưới cùng nếu cột dài */
}

.btn {
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
}

/* Nút chính (Add to cart / Buy) */
.btn-warning, .btn-cart, .btn-primary {
    background: var(--primary-gradient);
    color: white !important;
    box-shadow: 0 10px 20px -5px rgba(255, 107, 53, 0.4); /* Bóng màu cam */
}

.btn-warning:hover, .btn-cart:hover, .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(255, 107, 53, 0.5);
    filter: brightness(1.1);
}

.btn-warning:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Nút phụ (Outline) */
.btn-outline-primary, .btn-outline-info {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: var(--secondary-color);
}

.btn-outline-primary:hover, .btn-outline-info:hover {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
}

/* Nút xám (Review) */
.btn-secondary {
    background: #f1f5f9;
    color: var(--text-body);
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: var(--secondary-color);
}

/* Alert box đẹp hơn */
.alert-success {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================================
   9. RESPONSIVE (MOBILE)
   ========================================= */
@media (max-width: 992px) {
    .book-detail-card .row {
        grid-template-columns: 1fr; /* 1 cột duy nhất */
        gap: 30px;
    }
    
    .col-md-4 {
        text-align: center;
    }
    
    .book-image {
        max-width: 300px; /* Giới hạn chiều rộng ảnh trên mobile */
        margin: 0 auto;
    }

    .book-title {
        font-size: 2rem;
        text-align: center;
    }

    .book-author, .price, .book-info {
        justify-content: center;
        text-align: center;
    }
    
    .action-buttons {
        justify-content: center;
        flex-direction: column;
    }
    
    .btn {
        width: 100%; /* Nút full chiều rộng cho dễ bấm */
        justify-content: center;
    }
}

/* --- CSS CHO MODAL TỰ CHẾ (KHÔNG CẦN BOOTSTRAP) --- */

/* 1. Lớp phủ đen mờ toàn màn hình */
.modal {
    display: none; /* Mặc định ẩn */
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); /* Màu đen mờ */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Khi có class .show thì hiện lên */
.modal.show {
    display: flex !important; /* Dùng flex để căn giữa màn hình */
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* 2. Hộp thoại chính */
.modal-dialog {
    width: 100%;
    max-width: 500px; /* Độ rộng tối đa */
    margin: auto;
    pointer-events: auto; /* Để click được vào trong */
}

/* 3. Nội dung bên trong hộp */
.modal-content {
    background-color: #fefefe;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    animation: slideDown 0.3s ease-out;
}

/* Hiệu ứng trượt từ trên xuống */
@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Header, Body, Footer của Modal */
.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}
.btn-close:hover { color: #000; }

.modal-body {
    padding: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}