:root {
  --menu-bg: #fff;
  --primary-color: #4c51bf; /* Indigo */
  --primary-gradient: linear-gradient(45deg, #4c51bf, #667eea);
  --text-color-dark: #2d3748; /* Dark Slate */
  --text-color-light: #718096; /* Light Slate */
  --background-color: #f7fafc; /* Lighter Gray */
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

::-webkit-scrollbar,
::-webkit-scrollbar-track,
::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb:hover {
  display: none;
}

html,
body {
  height: auto;
  min-height: 100%;
}

body {
  font-family: "Poppins", "Segoe UI", "Roboto", -apple-system,
    BlinkMacSystemFont, Arial, sans-serif;
  color: var(--text-color-dark);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
}

.main {
  position: relative;
  width: 100%;
  min-height: 100vh;
  height: auto;
  background: #fff;
  margin: auto;
  display: flex;
  flex-direction: column;
}

p,
strong {
  font-size: 1vw;
  font-size: clamp(14px, 1vw, 20px);
  font-family: "Bad Script", "Segoe UI", "Roboto", Arial, sans-serif;
  margin-right: 0.5rem;
}

.back-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 10vh;
  width: 100%;
  z-index: 99;
}

#back-button {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  padding: 10px 16px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 16px;
  border-bottom-right-radius: 8px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.back-container:hover #back-button {
  opacity: 1;
  pointer-events: auto;
}

.back-icon {
  width: 16px;
  height: 16px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  display: none;
}

.dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  min-width: 400px;
  width: fit-content;
  height: fit-content;
  max-width: 480px;
  max-height: 95vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 50px rgba(44, 62, 80, 0.27);
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: none;
  flex-direction: column;
}

.flexbox {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.time-settings {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-settings-heading {
  margin: 0;
  font-size: 1.2vw;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
}

.menu-control {
  opacity: 0;
  max-height: 0;
  transition: opacity 0.5s ease, max-height 0.5s ease;
  pointer-events: none;
}

.menu-control.visible {
  opacity: 1;
  max-height: 500px;
  pointer-events: all;
}

.delay-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}

.delay-container > *:not(:last-child) {
  margin-right: 0.5vw;
}

.increment-btn {
  width: 2vw;
  height: 2vw;
  font-size: 1vw;
  border: 1px solid #ccc;
  border-radius: 50%;
  background-color: #f7f7f7;
  color: #333;
  cursor: pointer;
}

.increment-btn:hover {
  background-color: #e1eaff;
  border-color: #007bff;
  color: #007bff;
}

.increment-btn:active {
  background-color: #c7d7ff;
}

.time-input {
  padding: 6px;
  margin: 2px 0.5vw;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1vw;
  text-align: center;
}

.time-input:focus {
  border-color: #355ffc;
  outline: none;
}

.update-times-btn {
  padding: 12px 24px;
  background: var(--primary-gradient);
  margin-top: 24px;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.update-times-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px 0 rgba(76, 81, 191, 0.25);
}

.time-segment-display {
  margin-top: 18px;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-size: 15px;
  color: #333;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes popOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.5);
  }
}

.pop-in {
  opacity: 1;
  pointer-events: auto;
  display: block;
  animation: popIn 0.3s ease;
}

.pop-out {
  animation: popOut 0.3s ease;
}

.close-dialog {
  position: absolute;
  border-radius: 40rem;
  padding: 0 0.45vw;
  right: 16px;
  top: 16px;
  background: none;
  border: none;
  font-size: 1.5vw;
  color: #999;
  cursor: pointer;
}

.close-dialog:hover {
  outline: 1px solid #007bff;
  outline-offset: 2px;
}

.menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;

  background-color: var(--menu-bg);
  padding: 1rem;
  overflow-y: auto;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu.visible {
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#menu-selector {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100vh;
  background-color: var(--menu-bg);
}

#menu-selector .control {
  flex-shrink: 0;
  padding: 1rem;
  background-color: inherit;
  text-align: center;
  width: 100%;
  padding: 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid #ccc;
}

#menu-selector.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.slide img {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
}

.slide.video {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.slide iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.swiper {
  position: relative;
}

.tns-nav {
  position: absolute;
  width: fit-content !important;
  left: 50% !important;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 0.25rem 1rem;
  border-radius: 1rem;
  z-index: 0;
}

.tns-nav > button {
  width: 0.7rem;
  height: 0.7rem;
  margin: 0.15rem;
  border-radius: 1rem;
  background: #ffffff7b;
  border: none;
  outline: none;
}

.tns-nav-active {
  background: #fff !important;
}

.title {
  font-weight: 600;
  font-size: 2.2vw;
  font-size: clamp(1.4rem, 2.2vw, 2.5rem);
  margin: 0;
  color: var(--text-color-dark);
}

.menu-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
}

/* Tablet: 2 columns */
@media (min-width: 640px) {
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
  .menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1800px) {
  .menu-grid {
    max-width: 95vw;
  }

  .menu-selector-btn {
    min-height: 100px;
    padding: 1rem;
  }
}

.menu-selector-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  border-radius: 16px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (min-width: 1800px) {
  .menu-selector-btn {
    min-height: 180px;
    padding: 1rem;
  }
}

.menu-selector-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
}

.menu-selector-btn:hover .menu-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

.menu-selector-btn.full-width {
  grid-column: 1 / -1;
}

.menu-title {
  font-size: 1.5vw;
  font-size: clamp(1rem, 1.2vw, 1.8rem);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.menu-subtitle {
  font-size: 1vw;
  font-size: clamp(0.75rem, 0.8vw, 1.4rem);
  color: var(--text-color-light);
  transition: color 0.2s ease;
}

.toggle-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  border-radius: 0.5em;
  padding: 0.125em;
}

.toggle-checkbox {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.toggle-container {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 1rem;
  width: 3em;
  height: 1.5em;
  background-color: #ccc;
  transition: background-color 0.4s linear;
}

.toggle-checkbox:checked + .toggle-container {
  background-color: #4c51bf;
}

.toggle-button {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  left: 0.0625em;
  border-radius: 1rem;
  width: 1.375em;
  height: 1.375em;
  transition: left 0.3s ease;
}

.toggle-checkbox:checked + .toggle-container > .toggle-button {
  left: 1.5625em;
}

.toggle-button-circle {
  width: 1.25em;
  height: 1.25em;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.meal-label {
  font-weight: 600;
}

.menu-bg-selector {
  padding: 0.2rem 0.75rem;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  width: 150px;
  text-align: center;
  transition: all 0.25s ease-in-out;
}

.menu-bg-selector:focus {
  border-color: #007bff;
  box-shadow: 0 0 6px rgba(0, 123, 255, 0.4);
}

.menu-bg-selector::placeholder {
  color: #aaa;
  font-style: italic;
}

.player-container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.video-box {
  width: 100%;
  max-height: 100%;
}

.video-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-box .plyr,
.video-box .plyr__video-wrapper {
  width: 100%;
  height: 100%;
}

.video-box .mejs__container,
.video-box .mejs__mediaelement {
  width: 100% !important;
  height: 100% !important;
}

.video-box .mejs__mediaelement video,
.video-box .mejs__mediaelement object {
  width: 100%;
  height: 100%;
}

@supports not (display: grid) {
  .menu-grid {
    display: flex;
    flex-wrap: wrap;
    margin: -0.625rem;
  }

  .menu-selector-btn {
    flex: 0 1 100%;
    margin: 0.625rem;
  }

  /* Tablet: 2 columns */
  @media (min-width: 640px) {
    .menu-selector-btn {
      flex-basis: calc(50% - 1.25rem);
    }
  }

  /* Desktop and 4K: 4 columns */
  @media (min-width: 1024px) {
    .menu-selector-btn {
      flex-basis: calc(25% - 1.25rem);
    }
  }

  .menu-selector-btn.full-width {
    flex-basis: calc(100% - 1.25rem);
  }
}
