body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  background: #f8f8f8;
  color: #000;
}


header {
  color: #fff;
  padding: 0;
  text-align: center;
}

h1 {
  margin-top: 10px;
  font-size: 0.5em;
  letter-spacing: 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px;
}

.details h2 {
  margin: 0;
  font-size: 0.2em;
}

.times {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.times span {
  background: transparent;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.9em;
  transition: color 0.3s, opacity 0.3s;
  cursor: default;
}

.header-grid {
  display: flex;
  height: 175px;
  align-items: center;
  width: 100%;
  /* padding: 0 10px; */
  /* gap: 10px; */
}

/* ฝั่งซ้าย fix ขนาดตามรูป */
.header-grid .left {
  flex: 0 0 auto;
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: left;
  width:42%;
  
}

.header-grid .left img {
  height: 175px;
  width: 100%;
  object-fit: fill;
}

/* ฝั่งขวา ขยายเต็มที่ */
.header-grid .right {
  flex: 1 1 auto;
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: left;
  overflow: hidden;
  width:100%;
}

.header-slider {
  width: 100%;
  height: 175px;
  overflow: hidden;
  position: relative;
}

.slide-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: calc(100%); /* 3 รูป */
  height: 100%;
}

.slide-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex-shrink: 0;
}

/* --- Responsive --- */

/* เมื่อหน้าจอเล็กกว่า 800px ให้ลดความสูงและเปลี่ยน layout เป็นคอลัมน์ */
@media (max-width: 800px) {
  .header-grid {
    flex-direction: column;
    height: auto;
  }

  .header-grid .left,
  .header-grid .right {
    flex: none;
    height: 175px;
    width: 100%;
    margin-bottom: 10px;
  }

  .header-grid .left img,
  .header-slider {
    height: 175px;
    max-height: 200px;
    width: 100%;
  }

  .slide-image {
    position: relative;
    top: auto;
    right:0%;
    transform: none;
    max-height: 200px;
    width: 100%;
    height: 113%;
  }
}

/* เมื่อหน้าจอเล็กกว่า 400px ลดความสูงรูปอีกที */
@media (max-width: 400px) {
  .header-grid .left img,
  .header-slider {
    max-height: 175px;
  }

  .slide-image {
    max-height: 175px;
  }
}


.times button {
  background-color: black;
  color: white;
  border: none;
  padding: 5px 10px;
  margin: 3px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.3s;
}

.times button.disabled {
  background-color: #999;
  color: #ccc;
  cursor: not-allowed;
}

.times button.active {
  background-color: #ff6600;
  color: white;
}



body {
  font-family: sans-serif;
  background: #f5f5f5;
}
#movieList {
  display: grid;
  grid-template-columns: repeat(5, 1fr);;
  gap: 0.25rem;
  padding: 1rem;
}

/* ทำให้ movie-card เป็น flex แนวนอน */
.movie-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-width: 800px;
  margin: 16px auto;
  gap: 16px;
  position: relative; /* เพื่อให้จัดตำแหน่ง absolute ด้านในได้ */
  padding-bottom: 100px;
}

/* รูปโปสเตอร์ */
.movie-card img {
  width: 120px;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

/* กล่อง info ฝั่งขวา */
.movie-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ส่วนปุ่ม showtimes: เอาไปวางข้างในฝั่งขวา */
.showtimes {
  position: absolute;
  left: 16px; /* กะให้พอดีกับความกว้างโปสเตอร์ + padding */
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: calc(100% - 160px); /* ปรับให้ไม่ล้นขวา */
}

/* ปุ่ม */
.time-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight:900;

  border: none;
  font-size: 16px;
  cursor: pointer;
}
.time-btn.past {
  background: #ccc;
  color: #a8a8a8;
}
.time-btn.next {
  background: orange;
  color: white;
}
.time-btn.future {
  background: black;
  color: white;
}


.time-btn.next {
  background-color: orange;
  
  color: white;
}
.showtimes {
  display: grid;
 grid-template-columns: repeat(4, 1fr);
   gap: 0.25rem;
  margin-top: 1rem;
}

.movie-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.movie-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* ชื่อหนัง */
.movie-title {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 4px;
}

/* รายละเอียดย่อย */
.movie-subinfo {
  font-size: 12px;
  color: #666;
}
#movieList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px; /* ช่องว่างระหว่างการ์ดทั้งแนวนอนและแนวตั้ง */
}
.header-slider {
  position: relative;
  width: 100%;
  height: 175px; /* ปรับตาม banner */
  overflow: hidden;
}

.slide-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.slide-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.slide-img.active {
  opacity: 1;
  z-index: 1;
}
