/* =========================
   RESET
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #f6f6f6;
  color: #333;
}


/* =========================
   HEADER
========================= */
.header-top {
  background: #8B0000;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 80px;
  position: relative;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 30px;
}

.logo {
  height: 100px;
  width: auto;
  transform: translateY(10px);
}

.header-title {
  font-family: 'Inria Serif', serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.header-right {
  position: absolute;
  top: 15px;
  right: 40px;
  font-size: 14px;
  text-align: right;
}

/* =========================
   NAVIGATION
========================= */
nav {
  background: linear-gradient(90deg, #5c0000, #8B0000, #5c0000);
  padding: 22px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav ul {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  gap: 90px;
  flex-wrap: wrap;
}
nav ul li a {
    text-decoration: none; 
    color: white;          
}
nav ul li {
  color: white;
  cursor: pointer;
  position: relative;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 1px;
  transition: 0.3s ease;
  
}

nav ul li:hover {
  color: #ffe5e5;
}

nav ul li::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 0%;
  height: 2px;
  background: #ffffff;
  transition: 0.3s;
}

nav ul li:hover::after {
  width: 100%;
}

.dropdown-content {
    background-color: #ffffff;    
    min-width: 250px;            
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2); 
    border-radius: 8px;        
}


.dropdown-content a {
    color: #333333 !important;   
    padding: 12px 16px;
    text-decoration: none;        
    display: block;
    text-align: left;            
    font-size: 14px;             
    transition: 0.3s;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;    
    color: #990000 !important;   
}

.dropdown-content {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px 0;
  min-width: 260px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
}

.dropdown-content div {
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 600;          
  color: #111111;           
  letter-spacing: 0.3px;     
  transition: all 0.25s ease;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.dropdown-content div:hover {
  background: #f3f3f3;
  border-left: 4px solid #8B0000;
  color: #000000;            
  padding-left: 28px;
}

.dropdown:hover .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}


/* =========================
   PROGRAM SECTION
========================= */
.program-section {
  padding: 90px 60px;
  background: #e9e9e9;
}

.program-container {
  max-width: 1400px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 35px;
}

/* สำคัญมาก: ทำให้การ์ดยืดเต็ม */
.card-link {
  text-decoration: none;
  color: inherit;
  display: flex;  
}

.program-card {
  background: #f3f3f3;
  padding: 60px 35px;
  border: 2px solid #8B0000;
  border-radius: 14px;

  display: flex;            
  flex-direction: column;    
  justify-content: space-between; 

  width: 100%;
  height: 100%;   
  text-align: center;
  cursor: pointer;

  transition: all 0.35s cubic-bezier(.34, 1.56, .64, 1);
}

/* Hover */
.program-card:hover {
  background: #ffffff;
  transform: translateY(-12px);
  box-shadow: 0 20px 45px rgba(139, 0, 0, 0.25);
}

.program-card:active {
  transform: scale(0.97);
}

/* ICON */
.program-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 30px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.program-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.program-card:hover .program-icon img {
  transform: scale(1.08);
}

/* TITLE */
.program-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.6;
  text-transform: uppercase;
}

/* TEXT */
.program-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.8;
}
/* =========================
   WHY IOT SECTION
========================= */
.why-iot-section {
  padding: 100px 80px;
  background: linear-gradient(135deg, #ffffff, #f1f1f1);
}

.why-iot-container {
  max-width: 1400px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  align-items: center;
}

.why-iot-text h2 {
  font-size: 42px;
  color: #f37000;
  margin-bottom: 30px;
  font-weight: 700;
}

.why-iot-text p {
  font-size: 16px;
  line-height: 1.9;
  color: #444;
  margin-bottom: 25px;
}

.why-btn {
  display: inline-block;
  background: #f37000;
  color: white;
  padding: 16px 28px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: 0.3s ease;
}

.why-btn:hover {
  background: #d95f00;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(243, 112, 0, 0.4);
}

/* SLIDER */
.why-iot-slider {
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.slider-track {
  display: flex;
  width: 300%;
  animation: slideMove 12s infinite ease-in-out;
}

.slider-track img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  flex: 1 0 100%;
}

@keyframes slideMove {
  0% { transform: translateX(0); }
  30% { transform: translateX(0); }
  35% { transform: translateX(-100%); }
  65% { transform: translateX(-100%); }
  70% { transform: translateX(-200%); }
  95% { transform: translateX(-200%); }
  100% { transform: translateX(0); }
}

/* =====================================
   RESPONSIVE SYSTEM (ADD AT BOTTOM)
===================================== */

/* -------------------------
   TABLET (≤1024px)
------------------------- */
@media (max-width: 1024px) {

  /* PROGRAM GRID */
  .program-container {
    grid-template-columns: repeat(2, 1fr);
  }

  /* WHY IOT LAYOUT */
  .why-iot-container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .why-iot-text h2 {
    font-size: 34px;
  }

  .slider-track img {
    height: 350px;
  }

  nav ul {
    gap: 40px;
  }
}


/* -------------------------
   MOBILE (≤768px)
------------------------- */
@media (max-width: 768px) {

  /* HEADER */
  .header-top {
    padding: 25px 20px;
    flex-direction: column;
    text-align: center;
  }

  .header-left {
    flex-direction: column;
    gap: 15px;
  }

  .logo {
    height: 70px;
    transform: none;
  }

  .header-title {
    font-size: 16px;
  }

  .header-right {
    position: static;
    margin-top: 10px;
    text-align: center;
  }

  /* NAVIGATION */
  nav {
    padding: 15px 0;
  }

  nav ul {
    flex-direction: column;
    gap: 20px;
  }

  nav ul li {
    font-size: 16px;
  }

  /* PROGRAM SECTION */
  .program-section {
    padding: 60px 20px;
  }

  .program-container {
    grid-template-columns: 1fr;
  }

  .program-card {
    padding: 40px 25px;
  }

  /* WHY IOT */
  .why-iot-section {
    padding: 70px 20px;
  }

  .why-iot-text h2 {
    font-size: 28px;
  }

  .why-iot-text p {
    font-size: 15px;
  }

  .slider-track img {
    height: 260px;
  }

}


/* -------------------------
   SMALL MOBILE (≤480px)
------------------------- */
@media (max-width: 480px) {

  .header-title {
    font-size: 14px;
  }

  nav ul li {
    font-size: 14px;
  }

  .program-card h3 {
    font-size: 14px;
  }

  .program-card p {
    font-size: 13px;
  }

  .why-iot-text h2 {
    font-size: 22px;
  }

  .slider-track img {
    height: 200px;
  }

}
