/* ===============================
   Reset / Base Styles
================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Kanit', sans-serif;
}

body {
  color: #333;
  line-height: 1.6;
  background-color: #fff;
}

/* ===============================
   สีหลัก (แดง) และ สีรอง (ขาว, ดำ, เทา)
================================== */
:root {
  --primary-red: #d32f2f;
  --primary-white: #ffffff;
  --secondary-dark: #222222;
  --gray-light: #f5f5f5;
  --gray-dark: #666666;
  --black: #000000;
}

/* ===============================
   Container
================================== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===============================
   Header / Navbar
================================== */
.navbar {
  background-color: var(--primary-red);
  padding: 10px 0;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand .logo {
  height: 40px;
  margin-right: 10px;
}

.brand-name {
  font-size: 1.5rem;
  color: var(--primary-white);
  font-weight: 600;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 20px;
}

.nav-menu a {
  color: var(--primary-white);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-menu a:hover {
  color: var(--gray-light);
}

.hamburger {
  display: none;
  cursor: pointer;
  flex-direction: column;
}

.hamburger .bar {
  width: 25px;
  height: 3px;
  background-color: var(--primary-white);
  margin: 4px 0;
  transition: 0.3s;
}

/* ===============================
   Hero Section
================================== */
.hero-section {
  background-color: var(--gray-light);
  padding: 60px 0;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.hero-text {
  flex: 1 1 400px;
}

.hero-text h1 {
  font-size: 2.5rem;
  color: var(--primary-red);
  margin-bottom: 20px;
}

.hero-text h1 span {
  color: var(--secondary-dark);
}

.hero-text p {
  font-size: 1rem;
  color: var(--gray-dark);
  margin-bottom: 20px;
}

.btn-primary {
  display: inline-block;
  background-color: var(--primary-red);
  color: var(--primary-white);
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s;
}

.btn-primary:hover {
  background-color: #900018;
}

.hero-image {
  flex: 1 1 400px;
  text-align: center;
}

.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ===============================
   About Section
================================== */
.about-section {
  padding: 80px 0;
}

.about-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
}

.about-text {
  flex: 1 1 400px;
}

.about-text h2 {
  font-size: 2rem;
  color: var(--primary-red);
  margin-bottom: 15px;
}

.about-text p {
  color: var(--gray-dark);
  margin-bottom: 10px;
}

.about-image {
  flex: 1 1 400px;
  text-align: center;
}

.about-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.about-imageslide img {
  width: 100%;
  max-width: 500px;
  height: auto;
  transition: opacity 0.5s ease-in-out;
}
.fade {
  opacity: 0;
}

/* ===============================
   Services Section
================================== */
.services-section {
  background-color: var(--gray-light);
  padding: 80px 0;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  color: var(--primary-red);
  margin-bottom: 40px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 30px;
}

.service-item {
  background-color: var(--primary-white);
  border: 1px solid #ddd;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.3s;
  overflow: hidden;
}

.service-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.service-item h3 {
  font-size: 1.2rem;
  color: var(--primary-red);
  margin: 15px 0 10px;
}

.service-item p {
  font-size: 0.95rem;
  color: var(--gray-dark);
  padding: 0 10px 15px;
}

.service-item:hover {
  transform: translateY(-5px);
}

/* ===============================
   Projects Section
================================== */
.projects-section {
  padding: 80px 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.project-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.project-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: transform 0.3s;
}

.project-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  color: var(--primary-white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.project-item:hover img {
  transform: scale(1.1);
}

.project-item:hover .project-overlay {
  opacity: 1;
}

.project-overlay h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.project-overlay p {
  font-size: 0.9rem;
  text-align: center;
  padding: 0 10px;
}

/* ===============================
   Contact Section
================================== */
.contact-section {
  background-color: var(--gray-light);
  padding: 80px 0;
}

.contact-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.contact-info {
  flex: 1 1 400px;
  margin-bottom: 30px;
}

.contact-info h3 {
  font-size: 1.5rem;
  color: var(--primary-red);
  margin-bottom: 15px;
}

.contact-info p {
  color: var(--gray-dark);
  margin-bottom: 8px;
}

.social-icons {
  margin-top: 15px;
}

.social-link {
  display: inline-block;
  margin-right: 10px;
  color: var(--primary-red);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.social-link:hover {
  color: var(--secondary-dark);
}

.contact-form {
  flex: 1 1 400px;
  background-color: var(--primary-white);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.contact-form .form-group {
  margin-bottom: 15px;
}

.contact-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--gray-dark);
  font-weight: 500;
}

.contact-form input[type='text'],
.contact-form input[type='email'],
.contact-form input[type='tel'],
.contact-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

.contact-form textarea {
  resize: vertical;
}

.btn-secondary {
  display: inline-block;
  background-color: var(--secondary-dark);
  color: var(--primary-white);
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-secondary:hover {
  background-color: var(--black);
}

/* ===============================
   Footer
================================== */
.footer {
  background-color: var(--secondary-dark);
  color: var(--primary-white);
  padding: 20px 0;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-left p {
  font-size: 0.9rem;
}

.footer-right .footer-menu {
  list-style: none;
  display: flex;
}

.footer-right .footer-menu li + li {
  margin-left: 15px;
}

.footer-right .footer-menu a {
  color: var(--primary-white);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.footer-right .footer-menu a:hover {
  color: var(--gray-light);
}

/* ✅ รูปภาพทั้งหมดให้ responsive */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===============================
   Media Queries (Responsive)
================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  /* ✅ Flex section แนวตั้ง */
  .hero-content,
  .about-content,
  .contact-content,
  .content-section {
    flex-direction: column;
    text-align: center;
  }

    .hero-slider {
    height: auto;
    padding: 60px 1rem;
  }

  .hero-slider .slide-text {
    padding: 15px;
  }

  .hero-slider h1 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

    .vision-hero {
    height: 40vh;
  }

  .vision-title {
    font-size: 1.5rem;
  }

  .vision-subtitle {
    font-size: 1rem;
  }

  .content-section {
  padding: 2rem 1rem;
  }

  .content-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
  }

  .content-section p {
    font-size: 1rem;
    line-height: 1.7;
    text-align: justify; /* ✅ จัดเรียงแบบหนังสือ */
    padding: 0 1rem;      /* ✅ มีระยะขอบ */
    word-break: break-word;
  }

  /* ✅ ข้อความและรูปในเนื้อหาทั่วไป */
  .about-text,
  .about-imageslide,
  .contact-info,
  .contact-form,
  .content-section {
    flex: 1 1 100%;
    padding: 0;
  }

  .about-imageslide img,
  .content-section img,
  .hero-image img,
  .project-item img {
    max-width: 100%;
    height: auto;
  }

  /* ✅ Grid แนวเดียว */
  .services-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  /* ✅ Footer */
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-right .footer-menu {
    flex-direction: column;
    gap: 10px;
    align-items: center;
  }

  /* ✅ Navbar */
  .navbar .container {
    flex-direction: row;
    justify-content: space-between;
  }

  .nav-menu {
    position: absolute;
    top: 60px;
    left: -100%;
    width: 100%;
    height: 100vh;
    background-color: var(--primary-red);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease;
    z-index: 1000;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-menu li {
    margin: 20px 0;
  }

  .hamburger {
    display: flex;
  }

  canvas#financeChart {
    width: 100% !important;
    height: auto !important;
  }
}



/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.6);
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  position: relative;
  text-align: center;
}

.modal-content img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
}

.close-btn {
  color: #aaa;
  font-size: 30px;
  font-weight: bold;
  position: absolute;
  top: 10px;
  right: 20px;
  cursor: pointer;
}

/* เอฟเฟกต์ fade-in */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s ease forwards;
}

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

/* Chart */
  #financeChart {
  width: 100% !important;
  height: auto !important;
  }

  .finance-chart-section {
    padding: 4rem 1rem;
    background-color: #fdfdfd;
    text-align: center;
  }
  .finance-chart-section h2 {
    color: #b00020;
    font-size: 2rem;
    margin-bottom: 2rem;
  }
  canvas {
    max-width: 100%;
    margin: auto;
  }

/* Slide Head */
.hero-image img {
  width: 100%;
  max-width: 500px;
  height: auto;
  transition: opacity 0.5s ease-in-out;
}
.fade {
  opacity: 0;
}

.contact-map {
  margin-top: 40px;
  text-align: center;
  font-family: 'Kanit', sans-serif;
}

.contact-map h3 {
  font-size: 1.5rem;
  color: var(--primary-red);
  margin-bottom: 15px;
}

.map-responsive {
  position: relative;
  overflow: hidden;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Dropdown Base */
.nav-menu .dropdown {
  position: relative;
}

.nav-menu .dropdown-menu {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px; /* <-- เพิ่มตรงนี้ให้ขอบโค้งมน */
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
  padding: 0;
  list-style: none;
}

.nav-menu .dropdown-menu li a {
  display: block;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
}

.nav-menu .dropdown-menu li a:hover {
  background-color: #f5f5f5;
}

/* Active Dropdown */
.nav-menu .dropdown.active .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* เมนูย่อยใน dropdown */
.nav-menu .dropdown-menu .dropdown-sub {
  position: relative;
}

.nav-menu .dropdown-menu .dropdown-sub .dropdown-menu {
  top: 0;
  left: 100%;
  margin-left: 1px;
  position: absolute;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.5s ease;
  min-width: 200px;
  background: white;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.nav-menu .dropdown-menu .dropdown-sub.active > .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* เมนูย่อยซ้อนที่ซ่อนปกติ */
.nav-menu .dropdown-menu .dropdown-sub .dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s ease;
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 1px;
  background: white;
  min-width: 200px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  z-index: 1000;
}

/* เมื่อ hover ที่ .dropdown-sub ให้แสดงเมนูย่อย */
.nav-menu .dropdown-menu .dropdown-sub:hover > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* (ถ้าต้องการ) เมนูหลักแบบ dropdown ที่ซ่อนปกติ */
.nav-menu .dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s ease;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 220px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  z-index: 1000;
}

/* เมื่อ hover ที่ dropdown หลัก ให้แสดงเมนู */
.nav-menu .dropdown:hover > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.hero-slider {
  width: 100%;
  height: 100vh;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: slideFade 24s infinite;
}

.slide-text {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  padding: 0 1.5rem;
  text-align: center;
  color: white;
  background: none; /* ❌ เอาพื้นหลังออก */
}

.slide-text h1 {
  font-size: clamp(1.5rem, 6vw, 3rem);
  font-weight: bold;
  line-height: 1.4;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
  word-break: break-word;
}

.slide-text p {
  font-size: clamp(1rem, 4vw, 1.5rem);
  margin-top: 0.5rem;
  font-weight: 300;
  line-height: 1.4;
  color: white;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}


/* Slide background animation (manual keyframe images) */
@keyframes slideFade {
  0% { background-image: url('../images/slide1.jpg'); }
  10% { background-image: url('../images/slide2.jpg'); }
  30% { background-image: url('../images/slide3.jpg'); }
  50% { background-image: url('../images/slide4.jpg'); }
  70% { background-image: url('../images/slide5.jpg'); }
  90% { background-image: url('../images/slide6.jpg'); }
  100% { background-image: url('../images/slide7.jpg'); }
}

/* CSS สำหรับการเฟดภาพเข้าออก */
#slideImage {
  width: 100%;
  height: 100vh;
  object-fit: cover;
  transition: opacity 1s ease-in-out; /* ✅ ให้ภาพเปลี่ยนแบบนุ่ม */
  opacity: 1;
}

#slideImage.fade {
  opacity: 0; /* ✅ เมื่อมีคลาส fade จะค่อยๆ หาย */
}

/* กรอบรูป */

.org-structure-box {
  max-width: 350px;
  margin: 2rem auto;
  padding: 1rem;
  background: #fff;
  border: 3px solid #b00020;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.org-structure-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.org-structure-box img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

.org-structure-box figcaption {
  font-family: 'Kanit', sans-serif;
  font-size: 1rem;
  color: #333;
  font-weight: 400;
}

@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-slide-up {
  opacity: 0;
  animation: fadeSlideUp 1s ease-out forwards;
}

/* Vision */

.vision-hero {
  position: relative;
  width: 100%;
  height: 60vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ✅ เปลี่ยนเฉพาะภาพตามแต่ละหน้า */
.page-vision {
  background-image: url('../images/vision1.jpg');
}

.page-structure {
  background-image: url('../images/structure1.jpg');
}


.vision-content {
  padding: 2rem 1rem;
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.1rem;
}

