/* MenuPage.module.css */

/* Product Link Transitions */
/*
.productLink {
  display: block;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: translateY(0);
  opacity: 1;
  position: relative;
  overflow: hidden;
/* }

.productLink::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--link-glow),
    transparent
  );
  transition: left 0.5s ease;
  z-index: 1;
  pointer-events: none;
}

.productLink:hover::before {
  left: 100%;
}

.productLink:hover {
  transform: translateY(-8px);
  filter: brightness(1.05);
}

.productLink:active {
  transform: translateY(-4px);
  transition: all 0.1s ease;
} */

/* Enhanced card hover effects */
/* .productLink:hover .ant-card {
  box-shadow: 0 12px 32px var(--link-shadow);
  transform: scale(1.02);
  border-color: var(--link-border);
}

.productLink .ant-card {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, box-shadow;
  border: 1px solid transparent;
} */

/* Theme-aware glow effect */
/* .productLink:hover .ant-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  box-shadow: 0 0 20px var(--link-shadow-glow);
  opacity: 0;
  animation: glowPulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
} */

/* Dark theme adjustments for product links */
/* @media (prefers-color-scheme: dark) {
  .productLink {
    --link-glow: rgba(255, 198, 0, 0.15);
    --link-glow-hover: rgba(255, 198, 0, 0.25);
    --link-border: rgba(255, 198, 0, 0.4);
    --link-shadow: rgba(255, 198, 0, 0.25);
    --link-shadow-glow: rgba(255, 198, 0, 0.4);
  }
} */

.container {
  display: flex;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky;
  top: 0;
  background: var(--ant-bg-container);
  z-index: 10;
  border-bottom: 1px solid var(--ant-color-border);
  overflow: auto;
  transition: all 0.3s ease;
}

.categoriesContainer {
  display: flex;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 10;
  overflow: hidden;
  text-align: center;
  height: 8rem;
  overflow-x: auto;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: position, transform, opacity, filter;
  transform-origin: top center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 1rem 1rem;
  user-select: none;
}

.categoriesContainer::-webkit-scrollbar {
  display: none;
}

/* Desktop drag cursor */
@media (min-width: 1025px) {
  .categoriesContainer {
    cursor: grab;
  }

  .categoriesContainer:active {
    cursor: grabbing;
  }
}

/* Mobile/Tablet - use default cursor */
@media (max-width: 1024px) {
  .categoriesContainer {
    cursor: default;
  }
}

/* Smooth scrolling for drag interactions */
.categoriesContainer.dragging {
  scroll-behavior: auto;
}

.categoriesContainer.dragging * {
  pointer-events: none;
}

/* Enhanced responsive categories container */
@media (min-width: 769px) and (max-width: 1024px) {
  .categoriesContainer {
    height: 160px;
    padding: 16px;
    gap: 16px;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
  }

  .categoriesSticky {
    padding: 12px 16px !important;
    height: 70px !important;
  }
}

@media (min-width: 1025px) {
  .categoriesContainer {
    height: 180px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 16px;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    cursor: grab;
  }

  .categoriesContainer:active {
    cursor: grabbing;
  }

  .categoriesSticky {
    padding: 16px 24px !important;
    height: 70px !important;
    max-width: 100vw !important;
    margin: 0 !important;
  }
}

.container::-webkit-scrollbar {
  display: none;
}

.categoryMenuItemImage {
  width: 104px !important;
  min-width: 90px !important;
  height: 78px;
  object-fit: cover;
  border-radius: 0.375rem;
  transition: transform 0.3s ease;
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    gap: 4px;
  }

  .categoryTab {
    padding: 0px 6px;
    font-size: 14px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    gap: 12px;
  }

  .categoryTab {
    padding: 0px 14px;
    font-size: 15px;
  }
}

:global(.darkApp) .categoryTab {
  color: rgba(255, 255, 255, 0.75) !important;
  background-color: rgba(42, 42, 42, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

:global(.darkApp) .categoryTab:hover {
  color: var(--primary) !important;
  background-color: rgba(54, 54, 54, 0.9) !important;
  border-color: rgba(255, 198, 0, 0.3) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

:global(.darkApp) .categoryTab.active {
  color: var(--primary) !important;
  background-color: rgba(255, 198, 0, 0.1) !important;
  border-bottom-color: var(--primary) !important;
  box-shadow: 0 2px 8px rgba(255, 198, 0, 0.2);
}

/* Active category card styles */
.activeCategoryCard {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.activeCategoryCard::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--ant-color-primary), transparent);
  border-radius: 8px;
  opacity: 0.1;
  z-index: -1;
  animation: activePulse 2s ease-in-out infinite;
  white-space: nowrap;
}

.activeCategoryCard:hover {
  border-color: var(--ant-color-primary) !important;
}

/* Dark theme active category card styles */
:global(.darkApp) .activeCategoryCard {
  box-shadow: 0 4px 12px rgba(255, 198, 0, 0.3) !important;
  background-color: rgba(255, 198, 0, 0.05) !important;
}

:global(.darkApp) .activeCategoryCard::before {
  background: linear-gradient(45deg, var(--primary), transparent);
  animation: darkActivePulse 2s ease-in-out infinite;
}

@keyframes darkActivePulse {
  0%,
  100% {
    opacity: 0.05;
  }
  50% {
    opacity: 0.15;
  }
}

:global(.darkApp) .activeCategoryCard:hover {
  border-color: var(--primary) !important;
  box-shadow: 0 6px 16px rgba(255, 198, 0, 0.4) !important;
  background-color: rgba(255, 198, 0, 0.08) !important;
}

/* Smooth transitions for category cards */
.categoryCard {
  transition: all 0.3s ease;
  transform: scale(1);
}

.categoryCard:hover {
  transform: scale(1.02);
  transition: all 0.2s ease;
}

/* Enhanced smooth scrolling for category container */
.categoriesContainer {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Staggered animation for category cards when becoming sticky */
.categoriesSticky .ant-card {
  animation: cardEntrance 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: calc(var(--card-index, 0) * 0.05s);
}

/* Smooth animation for category cards when returning to normal */
.categoriesContainer:not(.categoriesSticky) .ant-card {
  animation: cardReturn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: calc(var(--card-index, 0) * 0.03s);
}

/* Smooth entrance for category images */
.categoriesSticky .popularMenuItemImage {
  animation: imageEntrance 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: calc(var(--card-index, 0) * 0.05s + 0.1s);
}

/* Smooth return animation for category images */
.categoriesContainer:not(.categoriesSticky) .popularMenuItemImage {
  animation: imageReturn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: calc(var(--card-index, 0) * 0.03s + 0.05s);
}

@keyframes imageEntrance {
  0% {
    transform: scale(0.9) rotate(-2deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes imageReturn {
  0% {
    transform: scale(0.95) rotate(-1deg);
    opacity: 0.85;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Sticky categories when scrolled past */
.categoriesSticky {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  z-index: 1000 !important;
  border-bottom: 1px solid var(--ant-color-border) !important;
  box-shadow:
    var(--tw-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),
    var(--tw-ring-shadow, 0 0 rgba(0, 0, 0, 0)), var(--tw-shadow) !important;
  background: #fff !important;
  animation: slideDown 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  transform-origin: top center !important;
}

/* Subtle glow effect for sticky state */
.categoriesSticky::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(24, 144, 255, 0.3),
    transparent
  );
  animation: glowPulse 2s ease-in-out infinite;
}

/* Fade out glow effect when returning to normal */
.categoriesContainer:not(.categoriesSticky)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(24, 144, 255, 0.1),
    transparent
  );
  animation: glowFadeOut 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scaleX(0.8);
  }
  50% {
    opacity: 0.6;
    transform: scaleX(1);
  }
}

@keyframes glowFadeOut {
  0% {
    opacity: 0.1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
    transform: scaleX(0.8);
  }
}

@keyframes slideDown {
  0% {
    transform: translateY(-100%) scale(0.95);
    opacity: 0;
    filter: blur(10px);
  }
  50% {
    transform: translateY(-20%) scale(0.98);
    opacity: 0.7;
    filter: blur(5px);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

/* Smooth exit animation when returning to normal */
.categoriesContainer:not(.categoriesSticky) {
  animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  transform-origin: top center !important;
}

@keyframes slideUp {
  0% {
    transform: translateY(-10px) scale(0.98);
    opacity: 0.9;
    filter: blur(2px);
  }
  50% {
    transform: translateY(-5px) scale(0.99);
    opacity: 0.95;
    filter: blur(1px);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

/* Dark theme sticky categories */
:global(.darkApp) .categoriesSticky {
  background: rgba(10, 10, 10, 0.95) !important;
  border-bottom-color: #363636 !important;
  box-shadow:
    0 4px 25px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(25px) saturate(1.2) !important;
  border-image: linear-gradient(
      90deg,
      transparent,
      rgba(255, 198, 0, 0.2),
      transparent
    )
    1 !important;
}

/* Dark theme glow effect */
:global(.darkApp) .categoriesSticky::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 198, 0, 0.4),
    transparent
  );
  animation: darkGlowPulse 2s ease-in-out infinite;
}

/* Dark theme glow fade out when returning to normal */
:global(.darkApp) .categoriesContainer:not(.categoriesSticky)::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 198, 0, 0.2),
    transparent
  );
  animation: darkGlowFadeOut 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Updating category indicator */
.updatingCategory {
  animation: categoryUpdate 0.6s ease-in-out;
}

@keyframes updatingCategory {
  0% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(24, 144, 255, 0.4);
  }
  100% {
    transform: scale(1.05);
  }
}

/* Dark theme updating category indicator */
:global(.darkApp) .updatingCategory {
  animation: darkCategoryUpdate 0.6s ease-in-out;
}

@keyframes darkCategoryUpdate {
  0% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(255, 198, 0, 0.4);
  }
  100% {
    transform: scale(1.05);
  }
}

/* Enhanced dark theme for container backgrounds */
:global(.darkApp) .container,
:global(.darkApp) .categoriesContainer {
  background-color: #0a0a0a !important;
  border-bottom-color: #363636 !important;
}

:global(.darkApp) .itemDescriptionIcons path {
  fill: #ffffff;
}

/* Enhanced dark theme animations */
:global(.darkApp) .categoryTab {
  animation: fadeInUp 0.3s ease-out;
}

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

/* Smooth transitions for all elements */
.categoryTab * {
  transition: all 0.3s ease;
}

/* Enhanced responsive category cards */
@media (min-width: 769px) and (max-width: 1024px) {
  .categoryCard {
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  }

  .categoryCard:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
  }
}

@media (min-width: 1025px) {
  .categoryCard {
    border-radius: 16px !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1) !important;
  }

  .categoryCard:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
  }
}

/* Enhanced responsive focus states */
.menuItem:focus,
.categoryCard:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .menuItem:focus,
  .categoryCard:focus {
    outline-offset: 4px;
  }
}

/* Enhanced responsive print styles */
@media print {
  .menuItem,
  .categoryCard {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .categoriesContainer {
    display: none !important;
  }
}

/* Mobile-specific sticky categories */
@media (max-width: 768px) {
  .categoriesSticky {
    padding: 16px !important;
    height: 70px !important;
    transition: all 0.3s ease !important;
  }
}

/* Smooth placeholder transition */
.categoriesSticky + div {
  transition: height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Enhanced smooth transitions for all sticky-related elements */
.categoriesContainer,
.categoriesContainer *,
.categoriesSticky,
.categoriesSticky * {
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
