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

body {
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  overflow-x: hidden;
  font-size: clamp(14px, 1.2vw, 18px);
}

/* Header */
.header {
  background-color: #003366;
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
}

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

/* Footer */
.footer {
  background-color: #003366;
  color: white;
  text-align: center;
  padding: 10px;
  position: fixed;
  width: 500px;
  bottom: 0;
}

/* Map area */
.map-area {
  padding: 40px 20px;
  min-height: calc(100vh - 140px);
  text-align: center;
}

/* Floor label */
#floor-label {
  margin-bottom: 20px;
  font-size: 20px;
  color: #003366;
}

/* Floor Selector in Body */
.floor-selector-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  font-weight: bold;
  color: #003366;
  flex-wrap: wrap;
}

.floor-buttons {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #003366 #e6f0ff;
}

.floor-buttons::-webkit-scrollbar {
  height: 6px;
}

.floor-buttons::-webkit-scrollbar-track {
  background: #e6f0ff;
}

.floor-buttons::-webkit-scrollbar-thumb {
  background-color: #003366;
  border-radius: 4px;
}

.floor-buttons button {
  background-color: #ffffff;
  color: #003366;
  border: none;
  padding: 8px 14px;
  margin: 0 4px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  white-space: nowrap;
}

.floor-buttons button:hover {
  background-color: #cce0ff;
  transform: translateY(-2px);
}

.floor-buttons button.active {
  background-color: #003366;
  color: white;
  border: 2px solid white;
}

/* Floor Image */
.floor-image {
  max-width: 100%;
  height: auto;
  border: 2px solid #ccc;
  border-radius: 8px;
}

/* Drawer Toggle Button */
.drawer-toggle {
  position: fixed;
  top: 100px;
  left: 0;
  transform: translateX(0);
  z-index: 999;
  background-color: #003366;
  color: white;
  border: none;
  padding: 16px 24px; /* เพิ่มขนาด padding */
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: transform 0.3s ease-in-out;
  font-size: 18px; /* เพิ่มขนาดตัวอักษร */
  font-weight: bold;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
}

.drawer-hidden {
  transform: translateX(-100%);
}

/* Drawer */
.room-drawer {
  position: fixed;
  top: 0;
  left: -400px;
  width: 400px;
  height: 100%;
  background-color: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: left 0.3s ease-in-out;
  overflow-y: auto;
  padding: 20px;
  border-right: 3px solid #003366;
}

.room-drawer.open {
  left: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
}

.drawer-header button {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #003366;
}

.drawer-content h4 {
  margin-top: 15px;
  color: #003366;
}

.drawer-content ul {
  list-style-type: disc;
  margin-left: 20px;
  margin-bottom: 15px;
}

.floor-toggle {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px;
  background-color: #e6f0ff;
  border: none;
  font-weight: bold;
  color: #003366;
  margin-top: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.floor-toggle:hover {
  background-color: #cce0ff;
}

.room-list {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s ease;
  margin-left: 20px;
  margin-top: 5px;
}

.room-list.expanded {
  /* max-height ถูกจัดการใน JS */
}

/* Popup */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.popup-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  position: relative;
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
}

.popup-content h2 {
  margin-bottom: 25px;
  color: #003366;
  font-size: 28px;
}

.image-slider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.image-slider img {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  border-radius: 10px;
  border: 2px solid #ccc;
  object-fit: contain;
}


.image-slider button {
  background: #003366;
  color: white;
  border: none;
  padding: 8px 12px;
  font-size: 20px;
  border-radius: 4px;
  cursor: pointer;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 32px;
  cursor: pointer;
  color: #003366;
  font-weight: bold;
  background: none;
  border: none;
  padding: 5px;
}


.hidden {
  display: none !important;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .room-drawer {
    width: 85%;
    left: -85%;
  }

  .room-drawer.open {
    left: 0;
  }
}

@media (max-width: 768px) {
  .drawer-toggle {
    top: 70px;
    padding: 8px 12px;
  }

  .room-popup {
    width: 90%;
    max-width: none;
    max-height: 80vh;
    overflow-y: auto;
  }

  .popup-content {
    padding: 16px;
  }

  .popup-images img {
    max-height: 200px;
  }

  .floor-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .floor-buttons button {
    margin: 6px 4px;
  }

  .floor-selector-body {
    flex-direction: column;
    gap: 8px;
  }

  .header-left h1 {
    font-size: 18px;
  }

  .logo {
    height: 32px;
  }

  .map-area {
    padding: 20px 10px;
  }
}

@media (max-width: 480px) {
  .popup-content {
    width: 95%;
    padding: 12px;
  }

  .image-slider button {
    font-size: 16px;
    padding: 6px 10px;
  }

  .popup-content h2 {
    font-size: 18px;
  }

  .close-btn {
    font-size: 20px;
    top: 6px;
    right: 10px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }
}
