:root {
  --menu-scroll-offset: 140px;
  --menu-mobile-category-top: 0px;
}

#cart-position-wrapper,
#cart-preview-wrapper {
  position: fixed;
  left: calc(50% + 750px / 2 + ((100vw - 750px) / 4));
  transform: translateX(-50%);
  z-index: 999;
}

#cart-position-wrapper {
  transition: top 0.1s ease;
}

#cart-preview-wrapper {
  transition: top 0.1s ease;
}

.floating-cart-button {
  background-color: #ed1c24;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: bold;
  display: inline-block;
  margin-bottom: 0.5rem;
}

#cart-preview {
  display: none;
  background: white;
  border: 2px solid #ccc;
  border-radius: 8px;
  padding: 1rem;
  width: 240px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  box-sizing: border-box;
}

#sidebar-wrapper {
  position: fixed;
  top: 125px;
  left: 0;
  z-index: 999;
  transition: top 0.1s ease;
}

.category-sidebar {
  scroll-behavior: smooth;
  width: 230px;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-y: auto;
  transition: max-height 0.1s ease;
}


.category-sidebar button {
  padding: 0.8rem 0.5rem;
  font-size: 1.2rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background-color: #d79a00;
  color: white;
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: background-color 0.2s, color 0.2s;
}

.category-sidebar button:hover,
.category-sidebar button:active {
  background-color: white;
  color: #d79a00;
  border-color: #d79a00;
}
.category-sidebar button.active-category {
  background-color: white;
  color: #d79a00;
  border-color: #d79a00;
}

.menu-category-title,
.menu-category-container h2,
.menu-category-container h3,
.beverages-title,
.beverage-category .category-title {
  scroll-margin-top: var(--menu-scroll-offset, 140px);
}


.menu-wrapper {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 1rem;
}

.menu-category {
  margin-top: 2rem;
  text-transform: uppercase;
}

.category-note {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #555;
}

.menu-item-form {
  border: 1px solid #ddd;
  padding: 0.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.menu-item-card {
  flex: 0 0 calc(50% - 0.5rem);
}

.menu-item-image {
  width: 70px;
  height: 70px;
  object-fit: cover;
}

.menu-item-info {
  flex: 1;
}

.menu-item-name-price {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
}

.menu-item-description {
  font-size: 0.9rem;
  color: #555;
}


.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none !important;   /* force prevent clicks when hidden */
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto !important;  /* force re-enable clicks when active */
  transition: opacity 0.2s ease;
}


.modal-inner {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  max-width: 475px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  position: relative;
}

#bagel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
}


@keyframes flash-border {
  0%   { box-shadow: 0 0 0 0 red; }
  50%  { box-shadow: 0 0 6px 4px red; }
  100% { box-shadow: 0 0 0 0 red; }
}

.glow-flash {
  animation: flash-border 0.6s ease-in-out 0s 2; /* 2 slower pulses */
  border-radius: 4px;
}

.modifier-footer {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 1rem;
  border-top: 1px solid #ddd;
}


.add-to-cart-btn {
  width: 100%;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 1rem;
  background-color: #ed1c24;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  touch-action: manipulation;
}

.add-to-cart-btn:hover {
  background-color: #c4181f;
}


.modal-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 10001;
}

.modal-close-btn:hover {
  color: #000;
}

/* Egg Sandwich Toggle Switch Styles */
.egg-sandwich-toggle {
  position: relative;
  width: 80px;
  height: 40px;
  background: #ccc;
  border-radius: 20px;
  cursor: pointer;
  margin: 0 auto;
  transition: background 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.egg-sandwich-toggle.active {
  background: #28a745;
}

.egg-sandwich-toggle .slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.egg-sandwich-toggle.active .slider {
  transform: translateX(40px);
}

.egg-sandwich-toggle .text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: bold;
  color: #666;
  pointer-events: none;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.egg-sandwich-toggle.active .text {
  color: white;
}

.egg-sandwich-modifier-container {
  display: none;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #f9f9f9;
  animation: slideDown 0.3s ease;
}

.egg-sandwich-modifier-container.show {
  display: block;
}

.egg-sandwich-modifier-container label {
  text-align: left !important;
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.egg-sandwich-modifier-container input[type="radio"] {
  margin-right: 0.5rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.egg-sandwich-toggle-group {
  text-align: center;
  margin-bottom: 1rem;
}

.egg-sandwich-toggle-label {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #333;
}

.egg-sandwich-toggle-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background: #f8f9fa;
}

.egg-sandwich-validation {
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
  margin-top: 0.5rem;
}

/* Glow flash animation for validation errors */
.glow-flash {
  animation: glowFlash 1.2s ease;
}

@keyframes glowFlash {
  0%, 100% {
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.8);
  }
}

/* Modifier container wrapper */
.modifier-fields-wrapper {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem 0.5rem 0.5rem 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Ensure proper spacing for modifier elements inside the wrapper */
.modifier-fields-wrapper > div {
  margin-bottom: 1rem;
}

.modifier-fields-wrapper > div:last-child {
  margin-bottom: 0;
}

/* Adjust existing modifier styles to work better within the wrapper */
.modifier-fields-wrapper .egg-sandwich-toggle-container {
  background: white;
  border: 1px solid #e9ecef;
  margin: 0;
}

.modifier-fields-wrapper .egg-sandwich-modifier-container {
  background: white;
  border: 1px solid #e9ecef;
}

/* Ensure proper spacing for form elements */
.modifier-fields-wrapper label {
  margin-bottom: 0.5rem;
  display: block;
}

.modifier-fields-wrapper select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: white;
}

.modifier-fields-wrapper input[type="checkbox"],
.modifier-fields-wrapper input[type="radio"] {
  margin-right: 0.5rem;
}

.addons-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-height: 8rem;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #fff;
  scrollbar-width: thin;
}

.addons-grid::-webkit-scrollbar {
  width: 6px;
}

.addons-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.addon-option {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  gap: 0.35rem;
  cursor: pointer;
}

.addon-option input {
  margin-right: 0.35rem;
}

.addons-scroll-hint {
  font-size: 0.75rem;
  color: #6c757d;
  font-style: italic;
  margin-top: 0.35rem;
  text-align: right;
}

.flavor-upcharge-note {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #b76b32;
  text-align: center;
  font-weight: 500;
}

.flavor-item .flavor-price-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}
