:root {
  --primary-color: #0e273c;
  --accent-color: #33b2d7;
  --bg-light: #f5f8fa;
  --text-color: #333;
  --white: #fff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: 'Montserrat', sans-serif;
  background: var(--white);
  color: var(--text-color);
  line-height: 1.6;
  height: auto;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.lang-th {
  font-family: 'Noto Serif Thai', serif;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Enhanced Hero Section with Carousel */
.hero {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--white);
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
}

.carousel-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.carousel-slides {
  display: flex;
  width: 400%; /* 4 slides */
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
  width: 25%; /* 4 slides */
  height: 100%;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Video slide styling - Enhanced for full screen coverage */
.video-slide {
  background: none !important;
  overflow: hidden;
}

/* Desktop Video */
.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 1;
}

/* Video sources for different screen sizes */
.hero-video-desktop {
  display: block;
}

.hero-video-mobile {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 1;
}

.carousel-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Lighter overlay for video slides */
.video-slide::before {
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  color: var(--white);
  max-width: 100%;
  padding: 0 20px;
  animation: fadeInUp 1s ease-out;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 500;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero p {
  font-size: 1.4rem;
  font-weight: 300;
  margin-bottom: 40px;
  opacity: 0.95;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.cta-button {
  display: inline-block;
  padding: 15px 40px;
  background: linear-gradient(45deg, var(--accent-color), #45c7e8);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 500;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(51, 178, 215, 0.3);
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(51, 178, 215, 0.4);
}

/* Navigation arrows */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.2);
  color: white;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 15;
  font-size: 24px;
  opacity: 0.8;
}

.nav-arrow:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-50%) scale(1.1);
  opacity: 1;
}

.nav-arrow.left {
  left: 30px;
}

.nav-arrow.right {
  right: 30px;
}

/* Carousel Indicators */
.carousel-indicators {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 15;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.indicator.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: scale(1);
}

.indicator:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.1);
}

/* Progress Bar */
.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.1s linear;
  z-index: 15;
}

/* Main Content - Fixed Container with proper spacing */
.container {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 40px; /* เพิ่ม padding เพื่อไม่ให้เนื้อหาติดขอบ */
  height: auto;
}

.section-padding {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 60px;
  position: relative;
  border-bottom: none;
  text-decoration: none;
  margin-top: 0;
}

.section-title::after {
  display: none;
}

/* About Section */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.about-text h3 {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 20px;
  font-weight: 500;
}

.about-text p {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 20px;
  color: #555;
}

.about-image {
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.about-image img {
  width: 400px;
  height: 300px;
  object-fit: cover;
}

/* Products Section - แก้ปัญหากรอบสีขาว โดยคงดีไซน์เดิม */
.products-section {
  background: var(--bg-light); /* เปลี่ยนพื้นหลังเป็นสีอ่อนเพื่อให้การ์ดสีขาวเด่นชัด */
  padding: 80px 0 !important;
  display: flex;
  justify-content: center;
  align-items: center;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px; /* เพิ่มช่องว่างระหว่างการ์ด */
  justify-content: center;
  justify-items: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 0 20px; /* เพิ่ม padding ป้องกันติดขอบ */
}

/* ปรับปรุง Product Card - คงรูปแบบสี่เหลี่ยมเดิม */
.product-card {
  background: white;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0,0,0,0.12); /* เพิ่มเงาให้เด่นชัด */
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 480px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border: 0px solid #e8eef2; /* เพิ่มกรอบสีอ่อนเพื่อให้เห็นขอบชัด */
}

.product-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}

.product-image {
  position: relative;
  height: 280px;
  overflow: hidden;
  width: 100%;
  flex-shrink: 0;
  margin-top: 12px;
  background: white; /* เพิ่มพื้นหลังสีขาว */
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 0px;
  right: 14px;
  background: var(#ee2819ff);
  color: white;
  padding: 8px 8px;
  font-size: 0.8rem;
  font-weight: 500;
}

.product-info {
  padding: 20px;
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: white; /* ให้แน่ใจว่าเป็นสีขาว */
}

.product-info h4 {
  font-size: 1.2rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  font-weight: 500;
}

.product-info p {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 10px;
  flex-grow: 1;
}

.product-button {
  background: #164f72;
  color: white;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 250px;
  margin-bottom: 10px;
  margin-top: 20px;
  height: 50px;
  text-align: center;
}

.product-button:hover {
  background: linear-gradient(45deg, #164f72, #164f72);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(51, 178, 215, 0.3);
}

/* Testimonials Section */
.testimonials-section {
  background: var(--white);
  color: var(--primary-color);
  padding: 15px 0 40px 0 !important;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
}

.testimonial-card {
  background: white;
  padding: 40px 30px;
  border-radius: 15px;
  border: 1px solid #ddd;
  transition: all 0.3s ease;
  color: var(--primary-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 400px;
}

.testimonial-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

.stars {
  color: #ffd700;
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.testimonial-text {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 25px;
  font-style: italic;
  flex-grow: 1;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: auto;
}

.author-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}

.author-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.author-info h5 {
  font-weight: 500;
  margin: 0;
}

.author-info span {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 4px;
}

/* Footer */
footer {
  background: var(--primary-color);
  color: white;
  text-align: center;
  padding: 100px 20px;
  font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Language Toggle */
.lang-th { 
  display: none; 
}

/* Responsive Design - แสดง 2 products ในหน้าจอเล็ก */

/* Large Desktop - above 1200px */
@media (min-width: 1201px) {
  .container {
    padding: 0 50px; /* เพิ่ม padding */
  }
  
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1400px;
    gap: 40px;
  }
  
  .hero h1 {
    font-size: 4.5rem;
  }
  
  .hero p {
    font-size: 1.5rem;
  }
}

/* Desktop - 992px to 1200px */
@media (min-width: 992px) and (max-width: 1200px) {
  .container {
    padding: 0 40px;
  }
  
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1200px;
    gap: 30px;
  }
  
  .product-card {
    max-width: 280px;
  }
  
  .hero h1 {
    font-size: 4rem;
  }
  
  .hero p {
    font-size: 1.4rem;
  }
}

/* Tablet - 769px to 991px */
@media (min-width: 769px) and (max-width: 991px) {
  .container {
    padding: 0 35px;
  }
  
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 800px;
    gap: 30px;
  }
  
  .product-card {
    height: auto;
    min-height: 320px;
    max-width: 100%;
    margin: 0 auto 15px auto;
  }

  .product-image {
    height: 220px;
    margin-top: 10px;
  }

  .product-info {
    padding: 15px;
  }

  .product-button {
    width: 100%;
    height: 45px;
    font-size: 0.9rem;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .about-image img {
    width: 100%;
    height: 350px;
  }
  
  .hero h1 {
    font-size: 3.5rem;
  }
  
  .hero p {
    font-size: 1.3rem;
  }
  
  .nav-arrow {
    width: 60px;
    height: 60px;
    font-size: 20px;
  }
}

/* Small Tablet and Large Mobile - 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
  /* Switch to mobile video */
  .hero-video-desktop {
    display: none;
  }
  
  .hero-video-mobile {
    display: block;
  }
  
  .container {
    padding: 0 50px;
    height: 150px;
  }
  
  .carousel-container {
    height: 35vh;
  }

  .carousel-slide {
    height: 30vh;
  }

  .hero-video,
  .hero-video-mobile {
    height: 30vh;
  }

  .hero {
    min-height: 50vh;
  }

  .hero h1 { 
    font-size: 2.8rem;
    line-height: 1.2;
    margin-bottom: 15px;
  }
  
  .hero p { 
    font-size: 1.2rem;
    margin-bottom: 30px;
    line-height: 1.4;
  }

  .cta-button {
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 25px;
  }

  .section-padding {
    padding: 50px 0;
  }

  .section-title {
    font-size: 2.2rem;
    margin-bottom: 40px;
  }

  .nav-arrow {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }

  .nav-arrow.left {
    left: 15px;
  }

  .nav-arrow.right {
    right: 15px;
  }

  /* แสดง 2 products ในหน้าจอขนาดนี้ */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 100%;
    gap: 20px;
    padding: 0 15px;
  }

  .product-card {
    height: auto;
    min-height: 320px;
    max-width: 100%;
    margin: 0 auto 15px auto;
  }

  .product-image {
    height: 120px;
    margin-top: 10px;
  }

  .product-info {
    padding: 15px;
  }

  .product-button {
    width: 100%;
    height: 45px;
    font-size: 0.9rem;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .about-image img {
    width: 100%;
    height: 250px;
  }
}

/* Mobile - 321px to 480px - แสดง 2 products */
@media (min-width: 321px) and (max-width: 480px) {
  .hero-video-desktop {
    display: none;
  }
  
  .hero-video-mobile {
    display: block;
  }
  
  .container {
    padding: 0px 10px;
    margin-top: -35px;
  }
  
  .carousel-container {
    height: 50vh;
  }

  .carousel-slide {
    height:30vh;
  }

  .hero-video,
  .hero-video-mobile {
    height: 20vh;
  }

  .hero {
    min-height: 30vh;
  }

  .hero h1 { 
    font-size: 2.8rem;
    line-height: 1.2;
    margin-bottom: 15px;
  }
  
  .hero p { 
    font-size: 1.2rem;
    margin-bottom: 30px;
    line-height: 1.4;
  }

  .cta-button {
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 25px;
  }

  .section-padding {
    padding: 50px 0;
  }

  .section-title {
    font-size: 2.2rem;
    margin-bottom: 40px;
  }

  .nav-arrow {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }

  .nav-arrow.left {
    left: 15px;
  }

  .nav-arrow.right {
    right: 15px;
  }

  /* แสดง 2 products ในหน้าจอ Mobile */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 100%;
    gap: 15px;
    padding: 0 10px;
  }

  .product-card {
    height: auto;
    min-height: 300px;
    max-width: 100%;
    margin: 10 auto 15px auto;
  }

  .product-image {
    height: 170px;
    margin-top: 10px;
  }

  .product-info {
    padding: 12px;
  }

  .product-info h4 {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .product-info p {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  .product-button {
    width: 100%;
    height: 40px;
    font-size: 0.8rem;
    margin-top: 10px;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .about-image img {
    width: 100%;
    height: 250px;
  }
}

/* Very Small Mobile - 240px to 320px - แสดง 2 products */
@media (min-width: 240px) and (max-width: 320px) {
  .hero-video-desktop {
    display: none;
  }
  
  .hero-video-mobile {
    display: block;
  }
  
  .container {
    padding: 0 20px;
  }
  
  .hero {
    min-height: 70vh;
  }

  .hero h1 { 
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 15px;
  }
  
  .hero p { 
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.4;
  }

  .cta-button {
    padding: 10px 25px;
    font-size: 0.9rem;
    border-radius: 25px;
  }

  .section-padding {
    padding: 40px 0;
  }

  .section-title {
    font-size: 2rem;
    margin-bottom: 30px;
  }

  .nav-arrow {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }

  .nav-arrow.left {
    left: 10px;
  }

  .nav-arrow.right {
    right: 10px;
  }

  /* แสดง 2 products ในหน้าจอเล็กมาก */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 100%;
    gap: 10px;
    padding: 0 8px;
  }
  
  .product-card {
    max-width: 100%;
    min-height: 280px;
    height: auto;
    margin: 0 auto 10px auto;
  }
  
  .product-image {
    height: 100px;
    margin-top: 8px;
  }
  
  .product-info {
    padding: 10px;
  }
  
  .product-info h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }
  
  .product-info p {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }
  
  .product-button {
    width: 100%;
    height: 35px;
    font-size: 0.75rem;
    margin-top: 8px;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .about-image img {
    width: 100%;
    height: 200px;
  }
}

/* Extra Small Mobile - below 240px - แสดง 2 products */
@media (max-width: 239px) {
  .hero-video-desktop {
    display: none;
  }
  
  .hero-video-mobile {
    display: block;
  }
  
  .container {
    padding: 0 15px;
  }
  
  .hero {
    min-height: 50vh;
  }

  .hero h1 { 
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 10px;
  }
  
  .hero p { 
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.3;
  }

  .cta-button {
    padding: 8px 20px;
    font-size: 0.85rem;
    border-radius: 20px;
  }

  .section-padding {
    padding: 30px 0;
  }

  .section-title {
    font-size: 1.8rem;
    margin-bottom: 25px;
  }

  .nav-arrow {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .nav-arrow.left {
    left: 8px;
  }

  .nav-arrow.right {
    right: 8px;
  }

  /* แสดง 2 products ในหน้าจอเล็กสุด */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 100%;
    gap: 8px;
    padding: 0 5px;
  }
  
  .product-card {
    max-width: 100%;
    min-height: 250px;
    height: auto;
    margin: 0 auto 8px auto;
  }
  
  .product-image {
    height: 80px;
    margin-top: 6px;
  }
  
  .product-info {
    padding: 8px;
  }
  
  .product-info h4 {
    font-size: 0.85rem;
    margin-bottom: 4px;
  }
  
  .product-info p {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }
  
  .product-button {
    width: 100%;
    height: 30px;
    font-size: 0.7rem;
    margin-top: 6px;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .about-image img {
    width: 100%;
    height: 180px;
  }
}

/* Touch improvements for mobile devices */
@media (max-width: 768px) {
  .nav-arrow,
  .indicator,
  .cta-button,
  .product-button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  html {
    scroll-behavior: smooth;
  }

  input, select, textarea {
    font-size: 16px;
  }

  .product-card:active {
      transform: translateY(-2px) scale(0.98);
      box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  }
}