#lightbox{
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.8);
    z-index:9999;
    text-align:center;
}

#lightbox img{
    max-width:90%;
    max-height:90%;
    margin-top:5%;
    box-shadow:0 0 20px #000;
    border-radius:10px;
}

#lightboximg {
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.8);
    z-index:9999;
    text-align:center;
}

        :root { --sidebar-width: 260px; --primary-color: #0d6efd; }
        body { background-color: #f4f7f6; font-family: 'Sarabun', sans-serif; }
        
        /* 1. Header Swiper (ปรับปรุงใหม่) */
        .header-swiper {
            width: 100%;
            height: 400px;
        }
        .header-swiper .swiper-slide img {
            width: 100%;
            height: 100%;
            object-fit: var(--object-fit);
            filter: brightness(0.9);
        }
        /* ปรับแต่งสีปุ่มนำทางของ Header */
        .header-swiper {
            --swiper-navigation-color: #fff;
            --swiper-pagination-color: #fff;
        }


        /* Sidebar Responsive */
        .sidebar {
            width: var(--sidebar-width);
            height: 100vh;
            position: fixed;
            background: #fff;
            border-right: 1px solid #e0e0e0;
            padding: 20px;
            transition: all 0.3s;
            z-index: 1000;
        }

        /* 3. Product Gallery */
        .main-img-display img {
            width: 100%;
            height: 450px;
            object-fit: contain;
            background: white;
            border-radius: 12px;
        }
        .thumb-btn { border: 2px solid transparent; background: none; width: 100%; cursor: pointer; padding: 2px; }
        .thumb-btn img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; }
        .thumb-btn.active { border-color: #0d6efd; }

        /* 4. Line Button */
        .btn-line {
            background-color: #06C755; color: white; font-weight: bold; padding: 15px;
            border-radius: 10px; text-decoration: none; display: block; text-align: center; transition: 0.3s;
        }
        .btn-line:hover { background-color: #05a346; color: white; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(6,199,85,0.3); }


        .product-title {
            display: -webkit-box;
            -webkit-line-clamp: 2; /* จำกัด 2 บรรทัด */
            -webkit-box-orient: vertical;
            overflow: hidden;
            height: 3rem; 
            line-height: 1.5rem;
            font-size: 1rem;
            margin-bottom: 0.5rem;
        }

        .main-content {
            margin-left: var(--sidebar-width);
            padding: 30px;
            transition: all 0.3s;
        }

        /* Mobile Adjustments */
        @media (max-width: 991.98px) {
            .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
            .main-content { margin-left: 0; padding: 20px; }
            .sidebar.show { margin-left: 0; }
        }
        .nav-link {
            color: #555;
            padding: 12px 15px;
            border-radius: 8px;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
        }
        .nav-link:hover, .nav-link.active {
            background-color: var(--primary-color);
            color: #fff !important;
        }
        
        .card-setting {
            background: #fff; border: none; border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
            padding: 25px; margin-bottom: 25px;
        }

          /* 3. จัดการ Card สินค้าให้เป็นระเบียบ */
        .product-img-wrapper {
            width: 100%;
            aspect-ratio: 1 / 1; 
            overflow: hidden;
            background-color: #fff;
        }
        .product-img-wrapper img {
            width: 100%;
            height: 100%;
            object-fit: contain; 
            transition: 0.3s;
        }
        .product-card:hover .product-img-wrapper img { transform: scale(1.05); }
        .product-title {
            display: -webkit-box;
            -webkit-line-clamp: 2; /* จำกัด 2 บรรทัด */
            -webkit-box-orient: vertical;
            overflow: hidden;
            height: 3rem; 
            line-height: 1.5rem;
            font-size: 1rem;
            margin-bottom: 0.5rem;
        }
        .product-card {
            display: flex;
            flex-direction: column;
            border: none;
            border-radius: 12px;
            overflow: hidden;
            transition: 0.3s;
            background: #fff;
        }
        .product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
        
        .card-body {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            padding: 1.25rem;
        }    


        /* 5. Swiper Related Products */
        .related-swiper { width: 100%; padding-bottom: 50px !important; }
        .related-card { 
            border: none; border-radius: 12px; transition: 0.3s; 
            height: 100%; background: #fff; display: flex; flex-direction: column;
            text-decoration: none; color: inherit;
        }
        .related-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
        .related-img-wrapper { width: 100%; aspect-ratio: 1/1; overflow: hidden; border-radius: 12px 12px 0 0; }
        .related-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }
        .related-title {
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
            overflow: hidden; height: 2.8rem; line-height: 1.4rem; font-size: 0.95rem;
            margin-bottom: 0.5rem; font-weight: bold;
        }
        .related-card .card-body { display: flex; flex-direction: column; flex-grow: 1; padding: 1rem; }
        
        @media (max-width: 768px) {
            .header-swiper { height: 250px; }
            .main-img-display img { height: 320px; }
        }
        

 .btn-line-sm {
    background: transparent; /* พื้นหลังโปร่งใส */
    color: #06C755; /* ใช้สีเขียว Line เฉพาะข้อความและขอบ */
    border: 1px solid #06C755; /* เส้นขอบบางๆ */
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px; /* มุมโค้งเล็กน้อยพอให้ดูซอฟต์ ไม่ต้องมนเป็นแคปซูล */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    width: 100%;
}
.btn-line-sm:hover {
    background: #06C755; /* สลับสีเมื่อเอาเม้าส์วาง */
    color: white;
}     


 /* Footer Styles */
.main-footer {
    margin-left: var(--sidebar-width);
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 60px 0 30px;
    margin-top: 50px;
}

.footer-title {
    font-weight: 700;
    color: #0d6efd;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background-color: #0d6efd;
}

.footer-link {
    color: #6c757d;
    text-decoration: none;
    transition: 0.3s;
    display: block;
    margin-bottom: 10px;
}

.footer-link:hover {
    color: #0d6efd;
    padding-left: 5px;
}

.copyright {
    border-top: 1px solid #eee;
    padding-top: 25px;
    margin-top: 40px;
    color: #adb5bd;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .main-footer {
        padding-bottom: 100px; /* เผื่อพื้นที่สำหรับปุ่ม Sticky Line บนมือถือ */
        text-align: center;
		margin-left: 0px;
    }
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
}           

/* Container สำหรับวิดีโอ */
.video-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px; /* รัศมีขอบมนตามตัวอย่างภาพ */
    background: #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    
    /* อัตราส่วนเริ่มต้น (แนวนอน 16:9) */
    aspect-ratio: 9 / 16; 
	min-height: 550px;
}

/* เพิ่มส่วนนี้เพื่อให้รองรับ TikTok */
.video-container tiktok-app, 
.video-container blockquote.tiktok-embed {
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    /* บังคับให้เต็มพื้นที่ */
    min-width: 100% !important; 
}

/* ปรับแต่งเฉพาะเมื่อเปิดบนมือถือ (หน้าจอไม่เกิน 767px) */
@media (max-width: 767px) {
    
    /* เมื่อถือเครื่องแนวตั้ง (Portrait) - เหมาะกับวิดีโอแบบ Shorts/Reels */
    @media (orientation: portrait) {
        .video-container {
            aspect-ratio: 9 / 16; /* ปรับสัดส่วนเป็นแนวตั้ง */
            max-height: 85vh;    /* ป้องกันไม่ให้สูงจนล้นจอเกินไป */
        }
    }

    /* เมื่อถือเครื่องแนวนอน (Landscape) */
    @media (orientation: landscape) {
        .video-container {
            aspect-ratio: 16 / 9; /* กลับมาเป็นแนวนอน */
            width: 70%;          /* ปรับความกว้างให้พอดีสายตา */
            margin: 0 auto;
        }
    }
}

/* ปรับแต่ง iframe ให้ขยายเต็ม Container */
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    
    /* เทคนิคสำคัญ: พยายามขยายวิดีโอให้เต็มพื้นที่ขอบ */
    object-fit: cover; 
}

.video-section-title {
    border-left: 5px solid #0d6efd;
    padding-left: 15px;
    margin-bottom: 25px;
}  

/* เพิ่มส่วนนี้เข้าไปครับ */
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* 
       เลือกใช้อย่างใดอย่างหนึ่ง:
       1. cover: ขยายเต็มจอ (อาจตัดขอบเล็กน้อยเพื่อให้พอดีสัดส่วน 9:16 เหมือน TikTok) 
       2. contain: แสดงครบทุกเม็ด (แต่ถ้าสัดส่วนวิดีโอไม่ใช่ 9:16 จะเหลือขอบดำ)
    */
    object-fit: cover; 
}