/* ================================================
   PRODUCT DETAIL PAGE - OPTIMIZED FOR LONG CONTENT
   Version: 2.2 - WITH THUMBNAIL GALLERY & MOBILE SWIPER
   ✅ GIỮ NGUYÊN: Layout cũ, colors, spacing
   ✨ THÊM MỚI: Thumbnail gallery, Mobile swiper, Responsive helpers
   ================================================ */

.product-detail-page {
    padding: 15px 0 30px;
    background: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ================================================
   BREADCRUMB
   ================================================ */
.breadcrumb {
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow-x: auto;
    white-space: nowrap;
}

.breadcrumb a {
    color: #1e5ba8;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #164a8a;
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 6px;
    color: #999;
}

.breadcrumb span:last-child {
    color: #333;
    font-weight: 500;
    white-space: normal;
}

/* ================================================
   PRODUCT MAIN SECTION
   ================================================ */
.product-main {
    display: grid;
    grid-template-columns: 450px 1fr; /* ✅ GIẢM -10%: 500px → 450px */
    gap: 30px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

/* ✅ Product Image - Fixed Height with proper image display */
.product-detail-page .product-image {
    width: 100%;
    height: 450px; /* ✅ ĐỔI: min-height → height (tránh cao bất thường) */
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* ✅ For overlay positioning */
    overflow: hidden; /* ✅ THÊM: Khóa overflow cho hover zoom */
}

.product-detail-page .product-image img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 450px; /* ✅ GIẢM -10%: 500px → 450px */
    display: block;
    margin: 0 auto;
    object-fit: contain; /* ✅ Hiển thị đầy đủ ảnh không bị cắt */
    border-radius: 4px;
    cursor: pointer; /* ✨ THÊM: Pointer cho lightbox */
    transition: transform 0.3s ease; /* ✨ THÊM: Smooth hover */
}

.product-detail-page .product-image img:hover {
    transform: scale(1.02); /* ✨ THÊM: Subtle zoom on hover */
}

/* ✅ OUT OF STOCK OVERLAY - Badge "Tạm hết hàng" ở CHÍNH GIỮA ảnh */
.out-of-stock-overlay {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important; /* ✅ Căn giữa */
    z-index: 10 !important;
}

.out-of-stock-text {
    display: inline-block;
    padding: 12px 24px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.no-image {
    text-align: center;
    color: #999;
    padding: 50px 15px;
}

.no-image i {
    font-size: 60px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

.no-image p {
    font-size: 14px;
    margin: 0;
}

/* ✨ ================================================
   THÊM MỚI: DESKTOP/MOBILE VISIBILITY HELPERS
   ================================================ */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* ✨ ================================================
   THÊM MỚI: MOBILE SWIPER GALLERY
   ================================================ */
.product-image-mobile {
    width: 100%;
    height: 400px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    overflow: hidden;
}

.product-swiper {
    width: 100%;
    height: 100%;
}

.product-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    padding: 20px;
}

.product-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 4px;
}

.product-swiper .swiper-pagination {
    bottom: 15px;
}

.product-swiper .swiper-pagination-bullet {
    background: white;
    opacity: 0.7;
    width: 10px;
    height: 10px;
}

.product-swiper .swiper-pagination-bullet-active {
    background: #1e5ba8;
    opacity: 1;
    width: 24px;
    border-radius: 5px;
}

.product-swiper .swiper-button-next,
.product-swiper .swiper-button-prev {
    color: white;
    background: rgba(0, 0, 0, 0.3);
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.product-swiper .swiper-button-next:after,
.product-swiper .swiper-button-prev:after {
    font-size: 16px;
}

/* Product Info */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-detail-page .category-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 24px; /* ✅ GIẢM: 26px → 24px */
    color: #222;
    margin: 0;
    line-height: 1.3;
    font-weight: 700;
}

.product-price {
    padding: 15px 17px; /* ✅ GIẢM -17%: 18px → 15px, 20px → 17px */
    background: linear-gradient(135deg, #f0f8f0 0%, #e8f5e8 100%);
    border-left: 4px solid #228b22;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(34, 139, 34, 0.1);
}

.price-main {
    font-size: 30px;
    color: #228b22;
    font-weight: 700;
}

.price-unit {
    font-size: 15px;
    color: #666;
    margin-left: 5px;
    font-weight: 500;
}

.product-description {
    padding: 13px 15px; /* ✅ GIẢM -18%: 16px → 13px, 18px → 15px */
    background: #f9f9f9;
    border-radius: 8px;
    border: 3px solid #ffffff;
}

.product-description h3 {
    font-size: 14px;
    color: #333;
    margin: 0 0 10px 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-description p {
    color: #555;
    line-height: 1.7;
    margin: 0;
    font-size: 14px;
}

.product-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.meta-item i {
    color: #1e5ba8;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.meta-item strong {
    color: #333;
    font-weight: 600;
}

/* ✨ ================================================
   THÊM MỚI: THUMBNAIL GALLERY
   Hiển thị sau product-meta, trước product-actions
   ================================================ */
.product-thumbnails {
    padding: 16px 0;
    border-bottom: 1px solid #eee;
}

.thumbnails-title {
    font-size: 14px;
    color: #333;
    margin: 0 0 12px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thumbnails-title i {
    color: #1e5ba8;
    font-size: 16px;
}

.thumbnails-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnail-item {
    width: 72px; /* ✅ GIẢM -10%: 80px → 72px */
    height: 72px; /* ✅ GIẢM -10%: 80px → 72px */
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    background: #fafafa;
}

.thumbnail-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.thumbnail-item:hover {
    border-color: #4a90e2;
    transform: translateY(-2px);
}

.thumbnail-item:hover::before {
    background: rgba(30, 91, 168, 0.1);
}

.thumbnail-item.active {
    border-color: #1e5ba8;
    box-shadow: 0 0 0 2px rgba(30, 91, 168, 0.14); /* ✅ GIẢM -30% opacity: 0.2 → 0.14 */
}

.thumbnail-item.active::before {
    background: rgba(30, 91, 168, 0.15);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ✅ PRODUCT ACTIONS - Updated for out of stock */
.product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

/* CÒN HÀNG - Nút bình thường (xanh dương) */
.btn-call {
    background: linear-gradient(135deg, #1e5ba8 0%, #164a8a 100%);
    color: white;
}

.btn-call:hover {
    background: linear-gradient(135deg, #164a8a 0%, #123a6f 100%);
}

.btn-zalo {
    background: linear-gradient(135deg, #0068ff 0%, #0056d6 100%);
    color: white;
}

.btn-zalo:hover {
    background: linear-gradient(135deg, #0056d6 0%, #0044aa 100%);
}

/* ✅ HẾT HÀNG - Nút màu đỏ với text "Liên hệ để đặt trước khi có hàng" */
.btn-out-of-stock {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    font-size: 14px; /* Slightly smaller for longer text */
}

.btn-out-of-stock:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
}

/* ================================================
   PRODUCT CONTENT - OPTIMIZED FOR QUILL HTML
   ================================================ */
.product-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.product-content h2 {
    font-size: 20px;
    color: #222;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 3px solid #1e5ba8;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-content h2 i {
    color: #1e5ba8;
    font-size: 22px;
}

/* ✅ QUILL CONTENT STYLING - OPTIMIZED FOR LONG CONTENT */
.quill-content {
    color: #333;
    line-height: 1.8;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Headings from Quill */
.quill-content h1,
.quill-content h2,
.quill-content h3,
.quill-content h4,
.quill-content h5,
.quill-content h6 {
    color: #222;
    font-weight: 700;
    margin: 24px 0 12px 0;
    line-height: 1.4;
}

.quill-content h1 { font-size: 28px; }
.quill-content h2 { font-size: 24px; }
.quill-content h3 { font-size: 20px; }
.quill-content h4 { font-size: 18px; }
.quill-content h5 { font-size: 16px; }
.quill-content h6 { font-size: 15px; }

.quill-content h1:first-child,
.quill-content h2:first-child,
.quill-content h3:first-child {
    margin-top: 0;
}

/* Paragraphs */
.quill-content p {
    margin: 0 0 16px 0;
    line-height: 1.8;
}

.quill-content p:last-child {
    margin-bottom: 0;
}

/* Text formatting */
.quill-content strong {
    font-weight: 700;
    color: #222;
}

.quill-content em {
    font-style: italic;
}

.quill-content u {
    text-decoration: underline;
}

.quill-content s {
    text-decoration: line-through;
    opacity: 0.7;
}

/* Lists */
.quill-content ul,
.quill-content ol {
    margin: 0 0 16px 0;
    padding-left: 28px;
}

.quill-content ul li,
.quill-content ol li {
    margin: 6px 0;
    line-height: 1.7;
}

.quill-content ul {
    list-style-type: disc;
}

.quill-content ol {
    list-style-type: decimal;
}

/* Nested lists */
.quill-content ul ul,
.quill-content ol ol,
.quill-content ul ol,
.quill-content ol ul {
    margin: 8px 0;
    padding-left: 24px;
}

/* Links */
.quill-content a {
    color: #1e5ba8;
    text-decoration: underline;
    transition: color 0.2s;
}

.quill-content a:hover {
    color: #164a8a;
}

/* Blockquotes */
.quill-content blockquote {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f9f9f9;
    border-left: 4px solid #1e5ba8;
    font-style: italic;
    color: #555;
}

/* Code blocks */
.quill-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.6;
}

.quill-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #c7254e;
}

.quill-content pre code {
    background: none;
    padding: 0;
    color: #f8f8f2;
}

/* Horizontal rules */
.quill-content hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 24px 0;
}

/* Text alignment */
.quill-content .ql-align-center {
    text-align: center;
}

.quill-content .ql-align-right {
    text-align: right;
}

.quill-content .ql-align-justify {
    text-align: justify;
}

/* Font sizes from Quill */
.quill-content .ql-size-small {
    font-size: 12px;
}

.quill-content .ql-size-large {
    font-size: 18px;
}

.quill-content .ql-size-huge {
    font-size: 24px;
}

/* Tables (if any) */
.quill-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    overflow-x: auto;
    display: block;
}

.quill-content table td,
.quill-content table th {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

.quill-content table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.quill-content table tr:nth-child(even) {
    background: #fafafa;
}

/* Images (if any - though not recommended) */
.quill-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ================================================
   RELATED PRODUCTS
   ================================================ */
.related-products {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.related-products h2 {
    font-size: 20px;
    color: #222;
    margin: 0 0 24px 0;
    text-align: center;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.related-products h2 i {
    color: #1e5ba8;
    font-size: 22px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.product-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.3s;
}

.product-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transform: translateY(-4px);
    border-color: #1e5ba8;
}

.card-image {
    width: 100%;
    height: 160px; /* ✅ GIẢM -11%: 180px → 160px */
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #e5e5e5;
    position: relative; /* ✅ For badge positioning */
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* ✅ SỬA: Không cắt ảnh sản phẩm */
    transition: transform 0.3s;
    background: #fafafa; /* ✅ THÊM: Nền sáng cho ảnh contain */
}

.product-card:hover .card-image img {
    transform: scale(1.05);
}

/* ✅ OUT OF STOCK BADGE on Related Products - CENTER */
.related-out-of-stock-badge {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    padding: 6px 14px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    z-index: 10 !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.5);
    text-transform: uppercase;
    white-space: nowrap;
}

.no-image-small {
    color: #ccc;
}

.no-image-small i {
    font-size: 40px;
    opacity: 0.5;
}

.card-body {
    padding: 14px;
}

.card-body h3 {
    font-size: 14px;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.4;
    /* ✅ SỬA: Bỏ height cứng, chỉ giữ line-clamp */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-weight: 600;
}

.card-body .price {
    color: #228b22;
    font-weight: 700;
    font-size: 15px;
    margin: 0;
}

/* ================================================
   RESPONSIVE - MOBILE OPTIMIZED
   ================================================ */

@media (max-width: 1024px) {
    .product-main {
        grid-template-columns: 360px 1fr; /* ✅ Tablet: giảm tương ứng */
        gap: 25px;
    }
    
    .product-detail-page .product-image {
        min-height: 360px; /* ✅ GIẢM -10%: 400px → 360px */
    }
    
    .product-detail-page .product-image img {
        max-height: 360px; /* ✅ GIẢM -10%: 400px → 360px */
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    /* ✨ THÊM: Switch to mobile layout */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    /* ✅ SỬA: Tắt hover effect trên mobile (vô nghĩa cho touch) */
    .product-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08); /* Giữ shadow nhẹ */
        transform: none; /* Tắt translateY */
        border-color: #e5e5e5; /* Giữ border mặc định */
    }
    
    .product-card:hover .card-image img {
        transform: none; /* Tắt zoom ảnh */
    }
    
    .product-detail-page {
        padding: 10px 0 20px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .breadcrumb {
        font-size: 12px;
        padding: 8px 12px;
        margin-bottom: 12px;
    }
    
    .product-main {
        grid-template-columns: 1fr;
        padding: 18px;
        gap: 18px;
    }
    
    /* ✨ THÊM: Mobile swiper sizing */
    .product-image-mobile {
        height: 350px;
    }
    
    .product-swiper .swiper-slide {
        padding: 15px;
    }
    
    .product-swiper .swiper-slide img {
        max-height: 320px;
    }
    
    /* ✅ Mobile: Out of stock overlay - vẫn ở giữa */
    .out-of-stock-text {
        padding: 10px 20px;
        font-size: 14px;
        letter-spacing: 0.5px;
    }
    
    .product-title {
        font-size: 22px;
    }
    
    .price-main {
        font-size: 24px; /* ✅ GIẢM: 26px → 24px */
    }
    
    .price-unit {
        font-size: 14px;
    }
    
    .product-description {
        padding: 14px 16px;
    }
    
    .product-description h3 {
        font-size: 13px;
    }
    
    .product-description p {
        font-size: 13px;
    }
    
    .product-meta {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .product-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .btn {
        padding: 15px 22px;
        font-size: 15px;
    }
    
    /* ✅ Mobile: Out of stock button text adjustment */
    .btn-out-of-stock {
        font-size: 13px;
        padding: 15px 18px;
    }
    
    .product-content,
    .related-products {
        padding: 18px;
    }
    
    .product-content h2,
    .related-products h2 {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    /* Quill content mobile */
    .quill-content {
        font-size: 14px;
    }
    
    .quill-content h1 { font-size: 24px; }
    .quill-content h2 { font-size: 20px; }
    .quill-content h3 { font-size: 18px; }
    .quill-content h4 { font-size: 16px; }
    .quill-content h5 { font-size: 15px; }
    .quill-content h6 { font-size: 14px; }
    
    .quill-content pre {
        padding: 12px;
        font-size: 12px;
    }
    
    .quill-content table {
        font-size: 13px;
    }
    
    .quill-content table td,
    .quill-content table th {
        padding: 8px 10px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .card-image {
        height: 150px;
    }
    
    .related-out-of-stock-badge {
        padding: 5px 12px;
        font-size: 10px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .card-body h3 {
        font-size: 13px;
        /* ✅ SỬA: Bỏ height cứng, line-clamp tự điều chỉnh */
    }
    
    .card-body .price {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .product-detail-page {
        padding: 8px 0 16px;
    }
    
    .container {
        padding: 0 8px;
    }
    
    .product-main {
        padding: 14px;
    }
    
    /* ✨ THÊM: Small mobile swiper sizing */
    .product-image-mobile {
        height: 270px; /* ✅ GIẢM -10%: 300px → 270px */
    }
    
    .product-swiper .swiper-slide {
        padding: 12px;
    }
    
    .product-swiper .swiper-slide img {
        max-height: 246px; /* ✅ GIẢM -10%: 276px → 246px */
    }
    
    .out-of-stock-text {
        padding: 8px 16px;
        font-size: 12px;
        letter-spacing: 0.3px;
    }
    
    .product-title {
        font-size: 20px;
    }
    
    .price-main {
        font-size: 24px;
    }
    
    .btn-out-of-stock {
        font-size: 12px;
        padding: 14px 16px;
    }
    
    .product-content,
    .related-products {
        padding: 14px;
    }
    
    .quill-content {
        font-size: 13px;
    }
    
    .quill-content h1 { font-size: 22px; }
    .quill-content h2 { font-size: 18px; }
    .quill-content h3 { font-size: 16px; }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .card-image {
        height: 160px; /* ✅ SỬA: Đồng bộ với desktop/tablet, không nhảy nhịp */
    }
}

/* ================================================
   PRINT STYLES (Optional)
   ================================================ */
@media print {
    .breadcrumb,
    .product-actions,
    .related-products,
    .out-of-stock-overlay,
    .product-thumbnails {
        display: none;
    }
    
    .product-main,
    .product-content {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .quill-content {
        color: #000;
    }
}