/* Responsive slideshow styles for Defining Dishes */

.responsive-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  /* padding: 0 15px; */
  padding: 0px;
  box-sizing: border-box;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slideshow-wrapper-with-title {
  max-width: 750px;
  margin: 0 auto 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slideshow-controls {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  background-color: transparent;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 10px 5px;
  z-index: 1001; /* Make sure it's on top */
  margin-top: 10px;
  width: 100% !important;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: nowrap;
  gap: 15px;
}

@media screen and (max-width: 430px) {
  .timeout-control {
    display: none !important;
  }
}

@media screen and (max-width: 400px) {
  .slideshow-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 280px;
  }
}

.navigation-control {
  display: flex;
  align-items: center;
  gap: 0px;
  justify-content: center;
  align-items: center;
  background-color: #e8f4f8;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #d1e7ed;
}

.timeout-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
  margin: 0 10px;
  background-color: #f8f0e8;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #ede4d1;
}

.timeout-control label,
.navigation-control label {
  font-size: 14px;
  font-weight: normal;
  white-space: nowrap;
  display: flex;
  align-items: center;
  height: 30px;
  line-height: 1;
  margin-bottom: 2px;
}

.speed-btn {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #333;
  transition: background-color 0.2s ease;
  outline: none;
}

.speed-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

.speed-btn:active {
  background: rgba(255, 255, 255, 1);
  transform: scale(0.95);
}

#timeout-display,
#timeout-display-2 {
  font-weight: bold;
  color: #333;
  min-width: 25px;
  text-align: center;
}

.slideshow-controls .cycle-prev,
.slideshow-controls .cycle-next,
.slideshow-controls #slideshow-toggle,
.slideshow-controls #slideshow-toggle-2 {
  position: static;
  transform: none;
  margin: 0 10px;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
}

.slideshow-group-title {
  background-color: #f2eee3;
  padding: 10px;
  margin-bottom: 0;
  /* border-top-left-radius: 8px;
  border-top-right-radius: 8px; */
}

.mobile-slideshow-wrapper {
  padding: 0;
  margin: 0;
  line-height: 0;
  font-size: 0;
  position: relative;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.theme-buffets-slideshow {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  height: auto;
  line-height: 0;
  font-size: 0;
  min-height: 200px;
  display: inline-block;
  text-align: center;
}

.slideshow-images-container {
  position: relative;
  display: inline-block;
  margin: 0 auto;
  max-width: 100%;
  min-height: 200px;
}

/* Default display for first image only */
.slideshow-images-container img {
  display: none;
}

.slideshow-images-container img:first-child {
  display: block;
}

/* Cycle2 specific styles */
.cycle-slide {
  display: none;
}

.cycle-slide.cycle-slide-active {
  display: block !important;
}

.theme-buffets-slideshow img,
.responsive-img {
  width: auto !important;
  height: auto !important;
  max-width: min(750px, 100vw) !important;
  max-height: 100% !important;
  object-fit: contain;
  margin: 0 !important;
  display: block;
}

/* Navigation arrows - making them more visible */
.cycle-prev,
.cycle-next {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: 30px;
  height: 30px;
  z-index: 1000 !important;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.5) !important;
  /* border-radius: 50%; */
  display: flex !important;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
  user-select: none;
  -webkit-user-select: none;
  color: #222 !important;
}

.nav-arrow {
  color: white;
  font-size: 24px;
  /* font-weight: bold; */
  line-height: 1;
  pointer-events: none;
}

.cycle-prev {
  margin-right: auto;
}

.cycle-next {
  margin-left: auto;
}

/* Desktop-specific adjustments */
@media screen and (min-width: 769px) {
  .homeArticle {
    /* height: 100vh;
    min-height: 100vh;
    max-height: 100vh; */
    /* display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; */
    box-sizing: border-box;
  }

  .theme-buffets-slideshow,
  .slideshow-images-container,
  .responsive-container {
    /* height: 100%;
    min-height: 0;
    max-height: 100%; */
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .theme-buffets-slideshow img,
  .responsive-img {
    width: auto !important;
    height: auto !important;
    max-width: 100vw !important;
    max-height: 100% !important;
    object-fit: contain;
    margin: 0 !important;
    display: block;
  }

  /* Position navigation buttons relative to the content */
  .cycle-prev {
    margin-right: auto;
    position: static !important;
  }

  .cycle-next {
    margin-left: auto;
    position: static !important;
  }

  /* Add space around the slideshow to ensure buttons are visible */
  .slideshow-images-container {
    margin: 0 auto;
    max-width: calc(100% - 120px);
  }

  #slideshow-toggle,
  #slideshow-toggle-2 {
    position: static !important;
    transform: none !important;
  }

  .slideshow-images-container-2 img {
    max-width: min(750px, 100vw) !important;
    max-height: 100% !important;
    object-fit: contain !important;
  }

  /* Ensure second slideshow thumbnails are properly sized */
  .slideshow-thumbnails-2 .thumbnail-img-2 {
    width: 100px;
    height: 45px;
    object-fit: cover;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
      opacity 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0.3;
  }

  .slideshow-thumbnails-2 .thumbnail-img-2.active {
    border: 3px solid #00c853;
    box-shadow: 0 0 12px 3px rgba(0, 200, 83, 0.6);
    opacity: 1;
  }

  .slideshow-thumbnails-2 .thumbnail-img-2:hover {
    border-color: #005a9e;
    opacity: 1;
  }
}

/* Mobile-specific adjustments */
@media screen and (max-width: 768px) {
  body {
    -webkit-overflow-scrolling: touch;
  }

  .homeArticle {
    /* height: 100vh;
    min-height: 100vh;
    max-height: 100vh; */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }

  .theme-buffets-slideshow,
  .slideshow-images-container,
  .responsive-container {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .theme-buffets-slideshow img,
  .responsive-img {
    width: auto !important;
    height: auto !important;
    max-width: 100vw !important;
    max-height: 100% !important;
    object-fit: contain;
    margin: 0 !important;
    display: block;
  }

  .cycle-prev,
  .cycle-next {
    width: 30px;
    height: 30px;
    opacity: 0.8;
    background-color: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
    position: static;
    z-index: 1000;
  }

  .cycle-prev {
    margin-right: auto;
    position: static !important;
  }

  .cycle-next {
    margin-left: auto;
    position: static !important;
  }

  .cycle-prev:active,
  .cycle-next:active {
    background-color: rgba(0, 0, 0, 1);
    transform: scale(0.95);
  }

  .nav-arrow {
    font-size: 24px;
  }

  .responsive-container {
    padding: 0;
    margin: 0;
  }

  .mobile-slideshow-wrapper {
    font-size: 0;
  }

  #theme-buffets-content {
    margin: 0;
    padding: 0;
  }

  .homeArticle {
    padding: 0;
    margin: 0;
  }

  section.responsive-container {
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 0;
  }

  #slideshow-toggle,
  #slideshow-toggle-2 {
    position: static !important;
    transform: none !important;
  }

  .timeout-control {
    font-size: 10px;
    margin: 0 5px;
  }

  .speed-btn {
    width: 18px;
    height: 18px;
    font-size: 8px;
  }
}

/* Lighter backgrounds for navigation and pause/play buttons */
.cycle-prev:active,
.cycle-next:active {
  background-color: rgba(255, 255, 255, 0.9) !important;
}

#slideshow-toggle,
#slideshow-toggle-2 {
  background: rgba(255, 255, 255, 0.3) !important;
  border: none;
  /* border-radius: 50%; */
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: normal;
  outline: none;
  z-index: 1100;
}

#slideshow-toggle:active,
#slideshow-toggle-2:active {
  background: rgba(255, 255, 255, 0.9) !important;
}

#slideshow-toggle-icon,
#slideshow-toggle-icon-2,
.cycle-prev .nav-arrow,
.cycle-next .nav-arrow {
  color: #222 !important;
}

/* Thumbnails sidebar for desktop */
@media screen and (min-width: 900px) {
  .slideshow-wrapper-with-title {
    max-width: 875px;
  }

  /* .slideshow-group-title {
    border: 5px solid #e4bf8e;
    border-bottom: none;
    box-sizing: border-box;
  } */
  .responsive-container {
    max-width: 1200px;
  }

  .theme-buffets-slideshow-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    border: 5px solid #e4bf8e;
    border-top: none;
    background-color: #e4bf8e;
    /* border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px; */
  }
  .slideshow-images-container {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .slideshow-thumbnails {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    margin-left: 5px;
    gap: 8px;
    overflow-y: hidden;
    padding: 5px;
    background-color: #e4bf8e;
  }
  .slideshow-thumbnails .thumbnail-img {
    width: 100px;
    height: 45px;
    object-fit: cover;
    /* border: 2px solid transparent; */
    /* border-radius: 4px; */
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
      opacity 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0.3;
  }
  .slideshow-thumbnails .thumbnail-img.active {
    border: 3px solid #00c853;
    box-shadow: 0 0 12px 3px rgba(0, 200, 83, 0.6);
    opacity: 1;
  }
  .slideshow-thumbnails .thumbnail-img:hover {
    border-color: #005a9e;
    opacity: 1;
  }
  .cycle-prev,
  .cycle-next {
    z-index: 1001;
  }
  #slideshow-toggle,
  #slideshow-toggle-2 {
    z-index: 1100;
  }

  /* New styles for thumbnail item wrapper and overlay text */
  .thumbnail-item-wrapper {
    position: relative; /* Context for absolute positioning the overlay text */
    width: 100px; /* Match the thumbnail image width */
    height: 45px; /* Match the thumbnail image height */
    display: block; /* Ensures it behaves as a block-level element in the flex column */
  }

  .thumbnail-overlay-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-size: 16px; /* Adjusted for small thumbnail size */
    font-weight: bold;
    text-shadow: none;
    background-color: rgba(
      0,
      0,
      0,
      0.35
    ); /* Semi-transparent background for readability */
    padding: 2px;
    box-sizing: border-box;
    pointer-events: none; /* Allow clicks to pass through to the underlying image */
    overflow: hidden; /* Prevent text from spilling out */
    text-overflow: ellipsis; /* Show ... if text is too long */
    white-space: nowrap; /* Keep text on a single line */
    /* If thumbnails had rounded corners, add border-radius here too */
  }

  .slideshow-thumbnails .thumbnail-img.active + .thumbnail-overlay-text {
    /* Optional: Style overlay differently if thumbnail is active, e.g., different background */
    /* background-color: rgba(0, 120, 215, 0.7); */
  }

  .slideshow-images-container.slideshow-images-container-2 {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .slideshow-thumbnails.slideshow-thumbnails-2 {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    margin-left: 5px;
    gap: 8px;
    overflow-y: hidden;
    padding: 5px;
    background-color: #e4bf8e;
  }
}

/* Hide thumbnails on mobile and adjust layout */
@media screen and (max-width: 899px) {
  .slideshow-thumbnails {
    display: none !important;
  }

  .theme-buffets-slideshow-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 auto !important;
  }

  .slideshow-images-container,
  .slideshow-images-container-2 {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
}

/* Additional styles for second slideshow to ensure proper image handling */
.slideshow-images-container-2 img {
  width: auto !important;
  height: auto !important;
  /* max-width: 100vw !important; */
  max-height: 100% !important;
  object-fit: contain;
  margin: 0 !important;
  display: block;
}

/* Mobile adjustments for second slideshow */
@media screen and (max-width: 768px) {
  .slideshow-images-container-2 img {
    max-width: min(750px, 100vw) !important;
    max-height: 100% !important;
    object-fit: contain !important;
  }
}

/* Desktop adjustments for second slideshow */
@media screen and (min-width: 769px) {
  /* .slideshow-images-container-2 img {
    max-width: 100% !important;
  }

  
  /* .slideshow-thumbnails-2 .thumbnail-img-2 {
    max-width: 150px;
    max-height: 100px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.3s;
    padding: 0;
    border-radius: 4px;
  } 

  .slideshow-thumbnails-2 .thumbnail-img-2.active {
    border-color: #007aff;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.5);
  }

  .slideshow-thumbnails-2 .thumbnail-img-2:hover {
    border-color: #007aff;
  } */
}

/* Force slideshow controls below images - override jQuery Mobile and other frameworks */
.slideshow-controls,
.theme-buffets-slideshow-row .slideshow-controls,
div[data-role="page"] .slideshow-controls,
#theme-buffets .slideshow-controls {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0;
  padding: 0 !important;
  width: auto !important;
  max-width: 200px !important;
  box-sizing: border-box !important;
  gap: 20px !important;
  margin-top: 5px !important;
}

.theme-buffets-slideshow-row .slideshow-controls .cycle-prev,
.theme-buffets-slideshow-row .slideshow-controls .cycle-next,
div[data-role="page"]
  .theme-buffets-slideshow-row
  .slideshow-controls
  .cycle-prev,
div[data-role="page"]
  .theme-buffets-slideshow-row
  .slideshow-controls
  .cycle-next,
#theme-buffets .theme-buffets-slideshow-row .slideshow-controls .cycle-prev,
#theme-buffets .theme-buffets-slideshow-row .slideshow-controls .cycle-next {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: flex !important;
  width: 30px !important;
  height: 30px !important;
}

.theme-buffets-slideshow-row .slideshow-controls #slideshow-toggle,
.theme-buffets-slideshow-row .slideshow-controls #slideshow-toggle-2,
div[data-role="page"]
  .theme-buffets-slideshow-row
  .slideshow-controls
  #slideshow-toggle,
div[data-role="page"]
  .theme-buffets-slideshow-row
  .slideshow-controls
  #slideshow-toggle-2,
#theme-buffets
  .theme-buffets-slideshow-row
  .slideshow-controls
  #slideshow-toggle,
#theme-buffets
  .theme-buffets-slideshow-row
  .slideshow-controls
  #slideshow-toggle-2 {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: flex !important;
  width: 30px !important;
  height: 30px !important;
}
