/* ================================================
   GLOBAL STYLES
   ================================================ */
:root {
  --primary-color: #3d388e;
  --primary-dark: #2c2785;
  --secondary-color: #49439f;
  --accent-color: #F68E13;
  --text-color: #333;
  --text-light: #666;
  --bg-light: #f8f9fa;
  --border-color: #dee2e6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Kanit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-color);
}



/* ================================================
   HEADER & NAVIGATION
   ================================================ */
#sp-header {
  background-color: #01023A;
  border: none;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1050;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#sp-header.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
  background-color: #01023A !important;
}

body.sticky-active {
  /* No layout shift */
}

#sp-header .logo-image {
  max-height: 50px;
  width: auto;
}

.navbar-nav .nav-link {
  color: white !important;
  font-weight: 500;
  margin-left: 1rem;
  transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
  color: var(--accent-color) !important;
}

.dropdown-menu {
  background-color: #2c2785;
  border: none;
}

.dropdown-item {
  color: white;
  transition: all 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item.active {
  background-color: var(--accent-color);
  color: white;
}

.navbar-toggler {
  color: white;
  /* border-color: white; */
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.5);
}

.navbar-toggler i {
  color: white;
  font-size: 1.5rem;
}

/* ================================================
   HERO SECTION (sp-page-title)
   ================================================ */
#sp-page-title {
  background-image: url("../images/webtemplate/cover1.jpg");
  background-size: cover;
  background-position: center center;
  color: #FFFFFF;
  padding: 100px 0;
  position: relative;
  overflow: hidden;
  min-height: 450px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#sp-page-title::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

#sp-page-title h1 {
  font-size: 48px;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: fadeInDown 1s ease-out;
  text-align: center;
  color: #ecf0f1;
  margin: 0;
  position: relative;
  z-index: 2;
}

#sp-page-title h2 {
  font-size: 2.5rem;
  font-weight: 600;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 1s ease-out 0.2s both;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* ================================================
   SECTION SPACING (sp-p1 and sp-main-body)
   ================================================ */
#sp-p1 {
  padding: 100px 0 0 0;
}

#sp-p2 {
  padding: 100px 0 0 0;
}

#sp-main-body {
  padding: 100px 0 120px 0;
}

/* ================================================
   SERVICES SECTION - FLIP CARDS
   ================================================ */
.flip-card-container {
  perspective: 1000px;
  height: 300px;
  cursor: pointer;
}

.flip-card {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card-container:hover .flip-card {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
  color: white;
  font-weight: bold;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
}

.flip-front {
  background-color: black;
  color: white;
}

.flip-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.flip-back h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 15px;
  color: white;
}

.flip-back a {
  color: white;
  border: 1px solid white;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.flip-back a:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background-color: rgba(255, 255, 255, 0.1);
}

/* ================================================
   GALLERY SECTION
   ================================================ */
#sp-main-body h4 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #3D388E;
  margin-bottom: 20px;
  border-bottom: 3px solid #49439f;
  padding-bottom: 10px;
}

#sp-main-body img {
  border-radius: 8px;
  transition: transform 0.3s, box-shadow 0.3s;
}

#sp-main-body img:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* ================================================
   CONTACT SECTION (sp-bottom)
   ================================================ */
#sp-bottom {
  background-color: #49439F;
  /* color: #FFFFFF; */
  padding: 80px 0 20px 0;
  position: relative;
  overflow: hidden;
}

#sp-bottom::before {
  content: '';
  position: absolute;
  /* top: 0; */
  left: -10px;
  right: -10px;
  bottom: 0;
  background-color: #FFFFFF;
  transform: skewY(5deg);
  /* transform-origin: top left; */
  z-index: -1;
  height: 160px;
}

#sp-bottom .container {
  position: relative;
  z-index: 1;
}

#sp-bottom h2 {
  color: #49439F !important;
}

#sp-bottom a {
  color: #FFFFFF;
  transition: color 0.3s ease;
}

#sp-bottom a:hover {
  color: var(--accent-color);
}

#sp-bottom h4 {
  margin-bottom: 15px;
  color: white;
}

#sp-bottom h5 {
  font-size: 18px;
  margin-bottom: 15px;
  color: white;
}

#sp-bottom p {
  line-height: 1.8;
  margin-bottom: 10px;
  color: white;
}

#sp-bottom strong {
  font-weight: 600;
}

/* ================================================
   FOOTER (sp-footer)
   ================================================ */
#sp-footer {
  background-color: #01023A;
  color: #FFFFFF;
  padding: 50px 0 30px 0;
  position: relative;
  overflow: hidden;
  margin-bottom: -10px;
}

#sp-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #FFFFFF;
  transform: skewY(2deg);
  transform-origin: top right;
  z-index: -1;
}

#sp-footer .container {
  position: relative;
  z-index: 1;
}

#sp-footer a {
  color: #FFFFFF;
  transition: color 0.3s ease;
}

#sp-footer a:hover {
  color: var(--accent-color);
}

#sp-footer p {
  color: #FFFFFF;
}

#sp-footer .text-muted {
  color: #FFFFFF !important;
}

#sp-footer .department-name {
  color: var(--accent-color);
  /* font-weight: 600; */
}

/* ================================================
   BUTTONS
   ================================================ */
.btn-light {
  background-color: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid white;
  transition: all 0.3s ease;
}

.btn-light:hover {
  background-color: white;
  border-color: white;
  color: var(--accent-color);
}

.btn-outline-light {
  color: white;
  border: 1px solid white;
  transition: all 0.3s ease;
}

.btn-outline-light:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background-color: transparent;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */
@media (max-width: 992px) {
  #sp-page-title {
    height: auto;
    padding: 60px 0;
  }

  #sp-page-title h1 {
    font-size: 32px;
  }

  #sp-page-title h2 {
    font-size: 22px;
  }

  .flip-card-container {
    height: 250px;
  }

  #sp-bottom {
    padding: 60px 0 15px 0;
    padding-bottom: 50px;
  }

  #sp-footer {
    padding: 50px 0 30px 0;
    margin-bottom: -10px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  #sp-page-title h1 {
    font-size: 24px;
  }

  #sp-page-title h2 {
    font-size: 18px;
  }

  #sp-main-body h2 {
    font-size: 24px;
  }

  #sp-main-body h4 {
    font-size: 16px;
  }

  .flip-card-container {
    height: 200px;
  }

  .flip-back h3 {
    font-size: 18px;
  }

  #sp-bottom {
    padding: 40px 0 10px 0;
    padding-bottom: 40px;
  }

  #sp-footer {
    padding: 40px 0 10px 0;
    padding-top: 40px;
  }

  #sp-bottom h5,
  #sp-footer h5 {
    font-size: 16px;
  }
}

/* ================================================
   ANIMATIONS
   ================================================ */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ================================================
   UTILITIES
   ================================================ */
.container-lg {
  max-width: 1140px;
}

/* Remove loader */
.sp-pre-loader {
  display: none !important;
}


/* ================================================
   Text Loop
   ================================================ */

.text-loop {
  position: relative;
  display: inline-block;
  height: 1.5em; /* ความสูงตามขนาดฟอนต์ */
}

.text-loop span {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  opacity: 0;
  animation: loopText 6s infinite; /* เล่นวนลูปละ 6 วินาที */
}

/* กำหนดเวลาเริ่มของแต่ละข้อความ ห่างกันข้อความละ 2 วินาที */
.text-loop span:nth-child(1) { animation-delay: 0s; }
.text-loop span:nth-child(2) { animation-delay: 2s; }
.text-loop span:nth-child(3) { animation-delay: 4s; }

@keyframes loopText {
  0% { opacity: 0; transform: translateY(10px); }
  5% { opacity: 1; transform: translateY(0); }       /* แสดงผล */
  30% { opacity: 1; transform: translateY(0); }      /* ค้างไว้จนครบ 2 วิ */
  33.33% { opacity: 0; transform: translateY(-10px); } /* จางหายไป */
  100% { opacity: 0; }
}