/* Improve preloader visibility */
.preloader {
  opacity: 1;
  transition: opacity 0.3s ease-out;
  z-index: 9999;
}

.preloader.fade-out {
  opacity: 0;
}

/* Scroll to Top Button - Bottom Center (Slack-style) */
.scroll-to-top-center {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #48e3cd;
  color: #1a1a1a;
  border: none;
  border-radius: 24px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(72, 227, 205, 0.3);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  min-height: 48px; /* Touch target requirement */
  min-width: 48px;
}

.scroll-to-top-center.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.scroll-to-top-center:hover {
  background: #3dd4c0;
  color: #111;
  box-shadow: 0 6px 16px rgba(72, 227, 205, 0.4);
  transform: translateX(-50%) translateY(-2px);
}

.scroll-to-top-center:active {
  transform: translateX(-50%) translateY(0);
  box-shadow: 0 2px 8px rgba(72, 227, 205, 0.3);
}

.scroll-to-top-center .material-symbols-outlined {
  font-size: 20px;
}

.scroll-top-text {
  white-space: nowrap;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .scroll-to-top-center {
    bottom: 20px;
    padding: 10px 20px;
    font-size: 13px;
  }

  .scroll-to-top-center .material-symbols-outlined {
    font-size: 18px;
  }
}

/* Ensure chat toggle button meets touch target requirement */
#genius-chat-toggle {
  min-width: 48px !important;
  min-height: 48px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide old scroll to top button if it exists */
.scroll__top {
  display: none !important;
}

/* Mobile menu top margin */
.tgmobile__menu-box {
  margin-top: 12px;
}

/* Hide mobile nav toggler on desktop, show on mobile/tablet */
.mobile-nav-toggler {
  display: none !important;
  position: relative;
  align-items: center;
  justify-content: center;
}

@media (max-width: 991px) {
  .mobile-nav-toggler {
    display: flex !important;
  }
}

/* Mobile menu toggle button - transforms between hamburger and close */
.mobile-nav-toggler .mobile-menu-toggle-btn {
  background: none;
  border: none;
  padding: 8px;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  position: relative;
  color: var(--tg-theme-primary);
}

.mobile-nav-toggler .mobile-menu-toggle-btn .material-symbols-outlined {
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  transition: all 0.3s ease;
}

/* Show menu icon by default, hide close icon */
.mobile-nav-toggler .mobile-menu-toggle-btn .menu-icon {
  display: block;
  opacity: 1;
}

.mobile-nav-toggler .mobile-menu-toggle-btn .close-icon {
  display: none;
  opacity: 0;
  position: absolute;
}

/* When menu is open, hide menu icon and show close icon */
body.mobile-menu-visible .mobile-nav-toggler .mobile-menu-toggle-btn .menu-icon {
  display: none;
  opacity: 0;
}

body.mobile-menu-visible .mobile-nav-toggler .mobile-menu-toggle-btn .close-icon {
  display: block;
  opacity: 1;
  position: static;
}

/* Prevent layout shift from images without dimensions */
img {
  max-width: 100%;
  height: auto;
}

/* Reserve space for hero image to prevent CLS */
.hero-banner-wrap img[src*="main-image-new"] {
  aspect-ratio: 546 / 558;
  width: 100%;
  height: auto;
}

/* Reserve space for feature images */
.features-item-wrap img {
  aspect-ratio: 600 / 400;
  width: 100%;
  height: auto;
}

/* Note: Font-display swap should be added to source font files in main.css
   This is a workaround to reduce font-loading CLS */
