
.layout_padding {
  padding-top: 20px;
  padding-bottom: 30px;
}

/* --- Global ปรับปรุงให้เต็มหน้าจอ --- */
.container-fluid {
    max-width: 100% !important;
    padding-left: 2rem;
    padding-right: 2rem;
}

.main-content-card {
    border-radius: 25px;
    padding: 50px !important;
}

.detail-title {
    color: #333;
    font-weight: bold;
    /* ใช้ clamp เพื่อจำกัดขนาด: ต่ำสุด 1.4rem, ขนาดแปรผันตามจอ, สูงสุด 2.2rem */
    /* font-size: clamp(1.4rem, 4vw, 2.2rem);  */
    margin-bottom: 15px;
    line-height: 1.3;
}

/* --- รูปภาพหลัก --- */
.main-img-detail {
    /* กำหนดความสูงสูงสุดไม่ให้เกิน 500px เพื่อไม่ให้ภาพกินพื้นที่จอมากเกินไป */
    max-height: 500px; /* ลดจาก 750px ลงมาเหลือ 500px */
    width: auto; /* ให้ความกว้างปรับตามอัตโนมัติ */
    max-width: 100%; /* แต่ความกว้างห้ามเกิน Container */
    object-fit: contain; /* โชว์ครบทั้งรูปโดยไม่ตัดส่วนใดออก */
    border-radius: 15px; /* ลดรัศมีขอบมนลงเล็กน้อยเพื่อให้ดูคมชัดขึ้น */
    display: block;
    margin: 0 auto; /* จัดกึ่งกลางภาพ */
}

/* --- รายละเอียดเนื้อหา --- */
.content-body {
    /* เนื้อหาหลัก: ต่ำสุด 0.95rem, สูงสุด 1.1rem */
    font-size: clamp(0.95rem, 1vw + 0.5rem, 1.1rem);
    line-height: 1.8;
    color: #444;
}

/* --- ส่วนที่เพิ่มใหม่ --- */
.content-body p {
  text-indent: 50px;
  /* ย่อหน้า 50px */
}

.content-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
}

/* รูปปกหลัก (เพิ่มใหม่) */
.main-cover-img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 25px;
}


.section-title-custom {
    /* หัวข้อส่วนต่างๆ: ต่ำสุด 1.1rem, สูงสุด 1.3rem */
    /* font-size: clamp(1.1rem, 2vw, 1.3rem); */
    font-weight: 700;
    color: #680268;
    border-left: 6px solid #680268;
    padding-left: 15px;
    display: inline-block;
}

/* --- ส่วนปรับปรุง อัลบั้มภาพกิจกรรม (Thumbnail) --- */
.gallery-grid-full {
    display: grid;
    /* ปรับช่องว่างและความกว้าง: minmax(140px, 1fr) จะทำให้รูปเล็กลงและเรียงสวยขึ้น */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 12px;
    margin-top: 20px;
}

.gallery-item-new {
    /* บังคับสัดส่วนภาพเป็น 1:1 (สี่เหลี่ยมจัตุรัส) หรือ 4:3 ตามชอบ */
    aspect-ratio: 1 / 1; 
    overflow: hidden;
    border-radius: 12px; /* ขอบมนให้เข้ากับดีไซน์ใหม่ */
    cursor: pointer;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.gallery-item-new img {
    width: 100%;
    height: 100%;
    /* สำคัญ: ให้ภาพเต็มช่องโดยไม่เสียสัดส่วน และไม่ยืด */
    object-fit: cover; 
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #680268;
}

.gallery-item-new:hover img {
    transform: scale(1.1); /* ขยายรูปเบาๆ ตอนชี้ */
}
/* --- ส่วนปรับปรุงรูปภาพที่เด้งขึ้นมา (Gallery Modal) --- */
/* --- ส่วนปรับปรุง Gallery Modal ให้รูปเล็กลงอีก --- */
#imageGalleryModal .modal-dialog {
    display: flex;
    align-items: center; /* จัดกึ่งกลางแนวตั้ง */
    justify-content: center; /* จัดกึ่งกลางแนวนอน */
    min-height: calc(100% - 1rem);
    margin: 0 auto;
}

#imageGalleryModal .modal-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: auto;
}

#imageGalleryModal .modal-body {
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- ปรับขนาดรูปให้เล็กกลง (Compact Size) --- */
.gallery-main-img {
    /* ปรับลดความสูงลงเหลือ 65% ของหน้าจอ เพื่อให้ดูเล็กกะทัดรัด */
    max-height: 65vh !important; 
    /* ปรับลดความกว้างลงเหลือ 80% ของหน้าจอ */
    max-width: 80vw !important;  
    
    object-fit: contain;
    /* border_radius: 12px; */
    border: 4px solid #fff; /* กรอบขาวทำให้รูปดูเด่น */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important; /* ลดเงาลงเล็กน้อยให้เข้ากับขนาด */
    transition: all 0.3s ease; /* เพิ่ม transition นุ่มนวล */
}

/* --- ปรับปรุงปุ่มลูกศรให้เล็กลงและดูโปร่งขึ้น --- */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15); /* โปร่งแสงมากขึ้น */
    color: rgba(255, 255, 255, 0.8) !important; /* สีตัวอักษรจางลงเล็กน้อย */
    width: 44px; /* ลดขนาดปุ่ม */
    height: 44px; /* ลดขนาดปุ่ม */
    /* border_radius: 50%; */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem !important; /* ลดขนาด Icon */
    /* text_decoration: none !important; */
    transition: all 0.3s ease;
    z-index: 1051;
}

.nav-arrow:hover {
    background: rgba(104, 2, 104, 0.9); /* สีม่วงตามธีม */
    color: #fff !important;
    transform: translateY(-50%) scale(1.05);
}

/* ปรับระยะห่างลูกศรให้พอดีกับรูปลง */
.nav-arrow.prev { left: -60px; }
.nav-arrow.next { right: -60px; }




/* --- ปรับปรุงปุ่มปิดให้เล็กลงเล็กน้อย --- */
.close-btn-gallery {
    position: absolute;
    top: -40px; /* ขยับขึ้นเล็กน้อย */
    right: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 2rem; /* ลดขนาดปุ่มปิด */
    background: none;
    border: none;
    cursor: pointer;
    /* line_height: 1; */
    transition: all 0.3s ease;
}

.close-btn-gallery:hover {
    color: #ffc107;
}

/* --- Sidebar Style --- */
/* Sidebar Styling */
.sidebar-card {
    border-radius: 20px;
    padding: 25px !important; /* ลด padding เพื่อให้ประหยัดพื้นที่ */
}

.speaker-pill-new {
    /* ให้ความกว้างปรับตามเนื้อหา (Auto width) */
    /* width: fit-content;  */
    min-width: 180px;
    /* ป้องกันชื่อติดขอบขวาเกินไป */
    padding-right: 20px !important; 
    transition: all 0.3s ease;
}

.speaker-pill-new img {
    width: 35px !important; /* ลดขนาดรูปโปรไฟล์วิทยากรนิดหน่อย */
    height: 35px !important;
}

.speaker-pill-new span {
    /* บังคับไม่ให้ตัดคำด้วยจุดไข่ปลา */
    white-space: nowrap; 
    font-size: 0.9rem; /* ปรับขนาดตัวอักษรให้พอดีสายตา */
}



.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.speaker-pill-new {
    transition: 0.3s;
}

.speaker-pill-new:hover {
    transform: translateX(5px);
    border-color: #680268 !important; /* เปลี่ยนสีขอบเมื่อชี้ */
    background-color: #fdf2fd !important;
    box-shadow: 0 4px 8px rgba(104, 2, 104, 0.1) !important;
}

/* --- Gallery Modal Custom --- */
.close-btn-gallery {
    position: absolute;
    right: -20px;
    top: -40px;
    color: white;
    font-size: 3rem;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 4rem;
    cursor: pointer;
    padding: 20px;
    text-decoration: none !important;
    user-select: none;
}

.nav-arrow.prev { left: -100px; }
.nav-arrow.next { right: -100px; }



/* --- Sidebar ใหม่ --- */
.rounded-20 { border-radius: 20px !important; }
.sidebar-card.border {
    border: 1px solid #e0e0e0 !important;
}

.shadow-xs {
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* เงาบางๆ */
}

.transition-hover {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.speaker-pill-new {
    border: 1px solid #ebebeb !important;
    transition: all 0.25s ease;
}

.speaker-pill-new:hover {
    transform: translateX(8px); /* เลื่อนไปทางขวานิดหน่อยเมื่อชี้ */
    border-color: #680268 !important;
    background: #fdf2fd !important;
    box-shadow: 0 4px 10px rgba(104, 2, 104, 0.1) !important;
}

/* ปุ่มสไตล์ Soft UI */
.btn-sidebar-info {
    background: #eefbff;
    color: #0084a5;
    border: 1px solid #d4f5fd;
    border-radius: 15px;
    font-weight: 600;
    transition: 0.3s;
}
.btn-sidebar-info:hover { background: #0084a5; color: #fff; }

.btn-sidebar-danger {
    background: #fff5f5;
    color: #dc3545;
    border: 1px solid #ffe3e3;
    border-radius: 15px;
    font-weight: 600;
    transition: 0.3s;
}
.btn-sidebar-danger:hover { background: #dc3545; color: #fff; }

.btn-sidebar-outline {
    background: #f5ebf5;
    color: #680268;
    border: 1px solid #f9b7f9;
    border-radius: 15px;
    font-weight: 600;
    transition: 0.3s;
}
.btn-sidebar-outline:hover { background: #680268; color: #fff; border-color: #680268; }

/* จัดการขนาดวิดีโอใน Sidebar */
.yt-mini-container .yt-container {
    margin: 0 !important;
    padding-bottom: 56.25%;
    border-radius: 15px;
}

.speaker-pill-new img {
    border: 2px solid #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
    image-rendering: -webkit-optimize-contrast; /* ทำให้รูปชัดขึ้นบนบางเบราว์เซอร์ */
}

/* คอนเทนเนอร์วิดีโอหลัก */
.video-main-container .yt-container {
    position: relative;
    padding-bottom: 56.25%; /* อัตราส่วน 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 20px; /* ขอบมนให้เข้ากับดีไซน์ใหม่ */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.video-main-container .yt-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ปรับขนาดรูปภาพหลักให้ไม่เบลอและขนาดพอดี */
.main-img-detail {
    border-radius: 20px;
    object-fit: contain;
    background-color: #f8f9fa; /* เพิ่มพื้นหลังจางๆ กรณีรูปแนวตั้ง */
}

/* ควบคุมขนาดรูปภาพหลัก */
.main-img-detail-fixed {
    /* กำหนดความสูงสูงสุดที่เหมาะสม (เช่น 450px หรือ 500px) */
    max-height: 480px; 
    
    /* ให้ความกว้างปรับตามสัดส่วนอัตโนมัติ */
    width: auto; 
    
    /* ห้ามกว้างเกิน Container */
    max-width: 100%; 
    
    /* สำคัญ: แสดงรูปครบทั้งรูปโดยไม่ตัดส่วนใดออก */
    object-fit: contain; 
    
    /* เพิ่ม Animation นุ่มนวลตอนโหลด */
    transition: all 0.3s ease;
    display: block;
}

/* เพิ่ม Effect เมื่อเอาเมาส์ไปชี้ที่รูป (Optional) */
.image-wrapper:hover .main-img-detail-fixed {
    transform: scale(1.01); /* ขยายใหญ่ขึ้นนิดเดียว */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* ปุ่ม Facebook */
.btn-facebook {
    background-color: #1877F2;
    color: white !important;
    border: none;
    /* font-size: 0.8rem; */
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.btn-facebook:hover {
    background-color: #166fe5;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(24, 119, 242, 0.2);
}

.share-box.border-left {
    border-left: 1px solid #dee2e6 !important;
    height: 25px; /* กำหนดความสูงเส้นแบ่งให้พอดีกับข้อความ */
}



/* ปรับปรุง Video Container ให้รักษาอัตราส่วน 16:9 เสมอ */
.yt-container, .video-main-container .yt-container {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* อัตราส่วน 16:9 */
    height: 0;
}

.yt-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* รูปที่แทรกใน editor */

.yt-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}



/* ตกแต่งเงาเล็กน้อย */
.shadow-xs {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* เพิ่มเส้นแบ่งระหว่างคะแนนกับปุ่มแชร์ */
.vote-result {
    border-right: 1px solid #ddd;
}