/********** Template CSS **********/

:root {

    /**--primary: #06A3DA;**/

    --primary: #f36f21;

    /**--secondary: #34AD54;**/

    --secondary: #f36f21;

    --light: #EEF9FF;

    --dark: #091E3E;

}

/* ใส่ใน <style> หรือ assest/style1.css */
body {
    /* ใช้ฟอนต์ Kanit/Sarabun เป็นหลัก */
    font-family: 'Kanit', 'Prompt', 'Sarabun', sans-serif; 
    background-color: #f8f9fa; /* สีพื้นหลังอ่อนๆ */
}

/* ------------------------------------------- */
/* สไตล์สำหรับ Card Post (Card & Grid) */
/* ------------------------------------------- */

/* ใช้ Class ของ Bootstrap Grid แทน style="display: flex; gap: 20px;" */
.latest-posts-cards .row {
    --bs-gutter-x: 1.5rem; /* ระยะห่างระหว่างคอลัมน์มาตรฐาน Bootstrap */
    --bs-gutter-y: 1.5rem; /* ระยะห่างระหว่างแถว */
}

.post-card {
    /* ลบ style="width: 300px; border: 1px solid #ccc; padding: 10px;" */
    border: none; /* ใช้เงาแทนขอบ */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* เงาที่ดูทันสมัย */
    border-radius: 12px;
    overflow: hidden; /* สำคัญสำหรับ Zoom Effect */
    transition: transform 0.3s ease;
    height: 100%; /* ให้ Card สูงเท่ากันในแต่ละแถว */
}

.post-card:hover {
    transform: translateY(-5px); /* เลื่อนขึ้นเล็กน้อยเมื่อ Hover */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------- */
/* 2. Zoom In Effect */
/* ------------------------------------------- */

.post-card a img {
    transition: transform 0.5s ease;
    /* ปรับให้รูปภาพคลุมพื้นที่ Card */
    object-fit: cover; 
    height: 200px; /* กำหนดความสูงรูปภาพให้คงที่ */
}

.post-card:hover a img {
    transform: scale(1.08); /* Zoom in 8% */
}

.post-card-img-wrapper {
    overflow: hidden; /* ตัดรูปภาพส่วนเกินที่ Zoom */
    border-radius: 12px 12px 0 0;
}

/* ------------------------------------------- */
/* สไตล์สำหรับเนื้อหาใน Card */
/* ------------------------------------------- */

.card-body-content {
    padding: 15px;
}

.card-body-content h3 {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.card-body-content a {
    text-decoration: none;
    color: #007bff; /* สีหลักที่ดูทันสมัย */
    transition: color 0.3s;
}

.card-body-content a:hover {
    color: #0056b3;
}

.post-date {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ------------------------------------------- */
/* สไตล์ส่วนหัว/ไตเติล */
/* ------------------------------------------- */
h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    color: #343a40;
    border-left: 5px solid #007bff; /* ตกแต่งด้วยเส้นสีหลัก */
    padding-left: 15px;
}




/*** Spinner ***/

.spinner {

    width: 40px;

    height: 40px;

    background: var(--primary);

    margin: 100px auto;

    -webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;

    animation: sk-rotateplane 1.2s infinite ease-in-out;

}



@-webkit-keyframes sk-rotateplane {

    0% {

        -webkit-transform: perspective(120px)

    }

    50% {

        -webkit-transform: perspective(120px) rotateY(180deg)

    }

    100% {

        -webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)

    }

}



@keyframes sk-rotateplane {

    0% {

        transform: perspective(120px) rotateX(0deg) rotateY(0deg);

        -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)

    }

    50% {

        transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);

        -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)

    }

    100% {

        transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);

        -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);

    }

}



#spinner {

    opacity: 0;

    visibility: hidden;

    transition: opacity .5s ease-out, visibility 0s linear .5s;

    z-index: 99999;

}



#spinner.show {

    transition: opacity .5s ease-out, visibility 0s linear 0s;

    visibility: visible;

    opacity: 1;

}





/*** Heading ***/

h1,

h2,

.fw-bold {

    font-weight: 800 !important;

}



h3,

h4,

.fw-semi-bold {

    font-weight: 700 !important;

}



h5,

h6,

.fw-medium {

    font-weight: 600 !important;

}





/*** Button ***/

.btn {

    font-family: 'prompt', sans-serif;

    font-weight: 600;

    transition: .5s;

}



.btn-primary,

.btn-secondary {

    color: #FFFFFF;

    box-shadow: inset 0 0 0 50px transparent;

}



.btn-primary:hover {

    box-shadow: inset 0 0 0 0 var(--primary);

}



.btn-secondary:hover {

    box-shadow: inset 0 0 0 0 var(--secondary);

}



.btn-square {

    width: 36px;

    height: 36px;

}



.btn-sm-square {

    width: 30px;

    height: 30px;

}



.btn-lg-square {

    width: 48px;

    height: 48px;

}



.btn-square,

.btn-sm-square,

.btn-lg-square {

    padding-left: 0;

    padding-right: 0;

    text-align: center;

}





/*** Navbar ***/

.navbar-dark .navbar-nav .nav-link {

    font-family: 'sarabun', sans-serif;

    position: relative;

    margin-left: 25px;

    padding: 35px 0;

    color: #FFFFFF;

    font-size: 17px;

    font-weight: 300;

    outline: none;

    transition: .5s;

}



.sticky-top.navbar-dark .navbar-nav .nav-link {

    padding: 20px 0;

    color: var(--dark);

}



.navbar-dark .navbar-nav .nav-link:hover,

.navbar-dark .navbar-nav .nav-link.active {

    color: var(--primary);

}



.navbar-dark .navbar-brand h1 {

    color: #FFFFFF;

}



.navbar-dark .navbar-toggler {

    color: var(--primary) !important;

    border-color: var(--primary) !important;

}



@media (max-width: 991.98px) {

    .sticky-top.navbar-dark {

        position: relative;

        background: #FFFFFF;

    }



    .navbar-dark .navbar-nav .nav-link,

    .navbar-dark .navbar-nav .nav-link.show,

    .sticky-top.navbar-dark .navbar-nav .nav-link {

        padding: 10px 0;

        color: var(--dark);

    }



    .navbar-dark .navbar-brand h1 {

        color: var(--primary);

    }

}



@media (min-width: 992px) {

    .navbar-dark {

        position: absolute;

        width: 100%;

        top: 0;

        left: 0;

        border-bottom: 1px solid rgba(256, 256, 256, .1);

        z-index: 999;

    }

    

    .sticky-top.navbar-dark {

        position: fixed;

        background: #FFFFFF;

    }



    .navbar-dark .navbar-nav .nav-link::before {

        position: absolute;

        content: "";

        width: 0;

        height: 2px;

        bottom: -1px;

        left: 50%;

        background: var(--primary);

        transition: .5s;

    }



    .navbar-dark .navbar-nav .nav-link:hover::before,

    .navbar-dark .navbar-nav .nav-link.active::before {

        width: 100%;

        left: 0;

    }



    .navbar-dark .navbar-nav .nav-link.nav-contact::before {

        display: none;

    }



    .sticky-top.navbar-dark .navbar-brand h1 {

        color: var(--primary);

    }

}





/*** Carousel ***/






/*** Section Title ***/

.section-title::before {

    position: absolute;

    content: "";

    width: 150px;

    height: 5px;

    left: 0;

    bottom: 0;

    background: var(--primary);

    border-radius: 2px;

}



.section-title.text-center::before {

    left: 50%;

    margin-left: -75px;

}



.section-title.section-title-sm::before {

    width: 90px;

    height: 3px;

}



.section-title::after {

    position: absolute;

    content: "";

    width: 6px;

    height: 5px;

    bottom: 0px;

    background: #FFFFFF;

    -webkit-animation: section-title-run 5s infinite linear;

    animation: section-title-run 5s infinite linear;

}



.section-title.section-title-sm::after {

    width: 4px;

    height: 3px;

}



.section-title.text-center::after {

    -webkit-animation: section-title-run-center 5s infinite linear;

    animation: section-title-run-center 5s infinite linear;

}



.section-title.section-title-sm::after {

    -webkit-animation: section-title-run-sm 5s infinite linear;

    animation: section-title-run-sm 5s infinite linear;

}



@-webkit-keyframes section-title-run {

    0% {left: 0; } 50% { left : 145px; } 100% { left: 0; }

}



@-webkit-keyframes section-title-run-center {

    0% { left: 50%; margin-left: -75px; } 50% { left : 50%; margin-left: 45px; } 100% { left: 50%; margin-left: -75px; }

}



@-webkit-keyframes section-title-run-sm {

    0% {left: 0; } 50% { left : 85px; } 100% { left: 0; }

}





/*** Service ***/

.service-item {

    position: relative;

    height: 300px;

    padding: 0 30px;

    transition: .5s;

}



.service-item .service-icon {

    margin-bottom: 30px;

    width: 60px;

    height: 60px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: var(--primary);

    border-radius: 2px;

    transform: rotate(-45deg);

}



.service-item .service-icon i {

    transform: rotate(45deg);

}



.service-item a.btn {

    position: absolute;

    width: 60px;

    bottom: -48px;

    left: 50%;

    margin-left: -30px;

    opacity: 0;

}



.service-item:hover a.btn {

    bottom: -24px;

    opacity: 1;

}





/*** Testimonial ***/

.testimonial-carousel .owl-dots {

    margin-top: 15px;

    display: flex;

    align-items: flex-end;

    justify-content: center;

}



.testimonial-carousel .owl-dot {

    position: relative;

    display: inline-block;

    margin: 0 5px;

    width: 15px;

    height: 15px;

    background: #DDDDDD;

    border-radius: 2px;

    transition: .5s;

}



.testimonial-carousel .owl-dot.active {

    width: 30px;

    background: var(--primary);

}



.testimonial-carousel .owl-item.center {

    position: relative;

    z-index: 1;

}



.testimonial-carousel .owl-item .testimonial-item {

    transition: .5s;

}



.testimonial-carousel .owl-item.center .testimonial-item {

    background: #FFFFFF !important;

    box-shadow: 0 0 30px #DDDDDD;

}





/*** Team ***/

.team-item {

    transition: .5s;

}



.team-social {

    position: absolute;

    width: 100%;

    height: 100%;

    top: 0;

    left: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    transition: .5s;

}



.team-social a.btn {

    position: relative;

    margin: 0 3px;

    margin-top: 100px;

    opacity: 0;

}



.team-item:hover {

    box-shadow: 0 0 30px #DDDDDD;

}



.team-item:hover .team-social {

    background: rgba(9, 30, 62, .7);

}



.team-item:hover .team-social a.btn:first-child {

    opacity: 1;

    margin-top: 0;

    transition: .3s 0s;

}



.team-item:hover .team-social a.btn:nth-child(2) {

    opacity: 1;

    margin-top: 0;

    transition: .3s .05s;

}



.team-item:hover .team-social a.btn:nth-child(3) {

    opacity: 1;

    margin-top: 0;

    transition: .3s .1s;

}



.team-item:hover .team-social a.btn:nth-child(4) {

    opacity: 1;

    margin-top: 0;

    transition: .3s .15s;

}



.team-item .team-img img,

.blog-item .blog-img img  {

    transition: .5s;

}



.team-item:hover .team-img img,

.blog-item:hover .blog-img img {

    transform: scale(1.15);

}





/*** Miscellaneous ***/

@media (min-width: 991.98px) {

    .facts {

        position: relative;

        margin-top: -75px;

        z-index: 1;

    }

}



.back-to-top {

    position: fixed;

    display: none;

    right: 45px;

    bottom: 45px;

    z-index: 99;

}



.icon-to-wrap {

    position: fixed;

    display: none;

    right: 45px;

    bottom: 100px;

    z-index: 99;

}



.bg-header {

    background: linear-gradient(rgba(9, 30, 62, .7), rgba(9, 30, 62, .7)), url(../../../backend/web/carousel/carousel-1.jpg) center center no-repeat;

    background-size: cover;

}



.link-animated a {

    transition: .5s;

}



.link-animated a:hover {

    padding-left: 10px;

}



@media (min-width: 767.98px) {

    .footer-about {

        margin-bottom: -75px;

    }

}

.blog-title {
  font-size: clamp(0.8rem, 1.2rem - 0.01 * var(--character-count), 1.2rem);
  line-height: 1.3;
  max-height: 4.9rem; /* 3 บรรทัด */
  overflow: hidden;
}

/* เพิ่ม CSS นี้เพื่อปรับขนาด h6 เป็นพิเศษ */
h6.blog-title {
  font-size: clamp(0.75rem, 1.1rem - 0.01 * var(--character-count), 1.1rem); /* ลดขนาดฟอนต์จาก 0.8rem เป็น 0.75rem และจาก 1.2rem เป็น 1.1rem */
  font-weight: 500; /* ทำให้ตัวอักษรดูชัดเจนแม้จะมีขนาดเล็กลง */
}


/* สำหรับแท็บเล็ต (ขนาดกลาง) */
@media (min-width: 768px) and (max-width: 991px) {
  /* ปรับให้แสดง 2 คอลัมน์บนแท็บเล็ต */
  .col-lg-3 {
    width: 50%;
    float: left;
  }
  
  /* ลดพื้นที่ว่างรอบๆ */
  .row.g-5 {
    margin-right: -10px;
    margin-left: -10px;
  }
  
  .col-lg-3 {
    padding-right: 10px;
    padding-left: 10px;
  }
  
  /* ทำให้รูปภาพและบล็อกมีขนาดพอดีกัน */
  .blog-item {
    width: 100%;
    margin-bottom: 20px;
  }
  
  .blog-img {
    width: 100%;
  }
  
  .blog-img img {
    width: 100% !important;
    height: 200px !important;
  }
  
  /* ลดพื้นที่ว่างของคอนเทนเนอร์ */
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .container {
    width: 100%;
    max-width: 100%;
  }
}

/* สำหรับมือถือ (ขนาดเล็ก) */
@media (max-width: 767px) {
  /* แสดง 1 คอลัมน์บนมือถือ */
  .col-lg-3 {
    width: 100%;
    padding-right: 0;
    padding-left: 0;
  }
  
  .blog-item {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
  }
  
  .blog-img {
    width: 100%;
  }
  
  .blog-img img {
    width: 100% !important;
    height: auto !important;
  }
  
  /* ลดพื้นที่ว่างของคอนเทนเนอร์ */
  .row.g-5 {
    margin-right: 0;
    margin-left: 0;
  }
}


/* ใช้กับทุกขนาดหน้าจอเมื่อมีรายการเยอะ */
.dropdown-menu {
  max-height: 70vh; /* จำกัดความสูงสูงสุด */
  overflow-y: auto; /* เพิ่ม scrollbar */
  -webkit-overflow-scrolling: touch;
}

/* ปรับขนาดและตำแหน่งเมนู dropdown สำหรับเมนูทางขวา */
@media (min-width: 992px) {
  .dropdown-menu-right,
  .dropdown-menu-end,
  .navbar-nav .nav-item:last-child .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    min-width: 200px; /* กำหนดความกว้างขั้นต่ำ */
    max-width: 300px; /* กำหนดความกว้างสูงสุด */
    /* ป้องกันไม่ให้เมนูเกินขอบด้านขวาของหน้าจอ */
    margin-right: 10px !important;
  }
}

/* ปรับขนาดโลโก้ในหน้าจอมือถือ */
@media (max-width: 767px) {
  /* สำหรับโลโก้ที่เป็นรูปภาพ */
  .navbar-brand img {
    max-width: 150px !important; /* ปรับขนาดให้เล็กลง */
    height: auto !important;
  }
  
  /* สำหรับโลโก้ที่เป็นข้อความ */
  .navbar-brand h1, 
  .navbar-brand span {
    font-size: 18px !important; /* ลดขนาดข้อความ */
  }
  
  /* จัดวางโลโก้และปุ่มเมนูให้อยู่ในแนวเดียวกัน */
  .navbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 15px !important;
  }
  
  /* ปรับตำแหน่งปุ่มเมนูแฮมเบอร์เกอร์ */
  .navbar-toggler {
    position: relative !important;
    top: 0 !important;
    margin-top: 0 !important;
    margin-right: 0 !important;
  }
}

/* จัดการข้อความยาวในหน้าจอมือถือ */
@media (max-width: 767px) {
  /* สำหรับรายการในเมนู */
  .navbar-nav .nav-link,
  .dropdown-item {
    white-space: normal !important; /* ให้ข้อความขึ้นบรรทัดใหม่ได้ */
    overflow-wrap: break-word !important; /* ตัดคำยาวให้ขึ้นบรรทัดใหม่ได้ */
    word-wrap: break-word !important;
    word-break: break-word !important; /* สำหรับคำยาวที่ไม่มีช่องว่าง */
    hyphens: auto !important; /* เพิ่มเครื่องหมายยัติภังค์สำหรับการแบ่งคำ */
    max-width: 90vw !important; /* จำกัดความกว้างสูงสุดไม่เกิน 90% ของหน้าจอ */
    padding-right: 15px !important; /* เพิ่มระยะห่างด้านขวาเพื่อให้มีพื้นที่สำหรับแสดงเนื้อหา */
    line-height: 1.5 !important; /* เพิ่มระยะห่างระหว่างบรรทัด */
    padding: 8px 15px !important; /* เพิ่มพื้นที่รอบข้อความ */
  }
  
  /* สำหรับหัวข้อหรือข้อความในหน้าเนื้อหา */
  h1, h2, h3, h4, h5, h6, p, .text-truncate, .card-title, .blog-title {
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }
  
  /* สำหรับรายการที่ต้องการตัดข้อความด้วย ... เมื่อยาวเกินไป */
  .truncate-text {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    display: block !important;
  }

  /* ปรับขนาดตาราง */
  table {
    table-layout: fixed !important;
    width: 100% !important;
  }
  
  table td, table th {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
}

/* สำหรับหน้าจอขนาดใหญ่ (ไม่ใช่มือถือ) ให้แสดงข้อความในบรรทัดเดียว */
@media (min-width: 768px) {
  .dropdown-menu {
    max-width: 500px !important; /* กำหนดความกว้างสูงสุดของเมนู dropdown */
  }

  .dropdown-item {
    white-space: nowrap !important; /* ให้ข้อความอยู่ในบรรทัดเดียว */
    overflow-wrap: break-word !important; /* ตัดคำยาวให้ขึ้นบรรทัดใหม่ได้ */
    word-wrap: break-word !important;
  }
}