
/*
 * Fixes for CSS compatibility warnings from various vendor stylesheets.
 * This file should be loaded last to ensure its rules take precedence.
 */

/*
 * Addresses `text-size-adjust` warnings from bootstrap.min.css, core.css, style.css, and auth.css.
 * - `style.css` was using `text-size-adjust: none`, which is bad for accessibility.
 * - Other files were missing the standard `text-size-adjust` property.
 * - Firefox desktop does not support this property, but this rule is safe.
 *
 * This single rule consolidates and corrects the behavior for all browsers that support it.
 */
html, body {
  -webkit-text-size-adjust: 100%; /* Legacy WebKit browsers */
  text-size-adjust: 100%;        /* Modern engines incl. Chromium, Edge, Firefox */
}

/* Ensure enough space before footer on pages with long content */
.main-container .min-height-200px {
  padding-bottom: 2.75rem; /* creates space before the footer */
}
@media (min-width: 992px) {
  .main-container .min-height-200px {
    padding-bottom: 3.5rem;
  }
}

/* Make dropdown menus render above cards/grids and avoid being blocked */
.dropdown-menu {
  z-index: 1100 !important; /* higher than typical content/cards; below tooltips */
}

/* For dropdowns inside complex scrollable cards, enforce stacking & visibility */
.dropdown.keep-on-top .dropdown-menu {
  position: absolute;
  z-index: 1200 !important;
}

/* Search results layout spacing above footer */
.search-results-page,
.plants-page {
  padding-bottom: 2.5rem;
}

/* Fix profile dropdown and other menus that may get mispositioned by transforms */
.header .dropdown-menu.dropdown-menu-right,
.header .dropdown-menu.dropdown-menu-end {
  right: 0;
  left: auto;
}

/* Avoid parent overflow clipping dropdowns/popovers within cards */
.card, .card-box, .content-wrapper, .pd-ltr-20, .xs-pd-20-10 {
  overflow: visible;
}

/* Hide legacy WYSIHTML5 toolbar until the script finishes initializing */
.wysihtml5-toolbar--is-hidden {
  display: none;
}

/* Performance: Avoid animating background-position (paint-heavy).
   We layer a pseudo-element with the stripe background and animate transform instead. */
.progress .progress-bar.progress-bar-striped,
.progress .progress-bar.progress-bar-striped.progress-bar-animated {
  position: relative;
  overflow: hidden;
}

.progress .progress-bar.progress-bar-striped::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: inherit; /* uses the same stripe gradient from Bootstrap */
  background-size: inherit;
  background-position: 0 0;
  will-change: transform;
  transform: translateX(0);
}

/* Replace background-position keyframes with transform-based animation */
@keyframes progress-bar-stripes-transform {
  from { transform: translateX(1rem); }
  to   { transform: translateX(0); }
}

.progress .progress-bar.progress-bar-striped.progress-bar-animated::before {
  animation: progress-bar-stripes-transform 1s linear infinite;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .progress .progress-bar.progress-bar-striped.progress-bar-animated::before {
    animation: none;
  }
}

/* ------------------------------------------------------------
   SweetAlert2 animation performance overrides
   Avoid animating top/left/right/width/margin in keyframes.
   Use transform-based animations (compositor-friendly) instead.
   ------------------------------------------------------------ */

/* Success lines: draw using scaleX instead of width/position changes */
.swal2-success [class^='swal2-success-line'] {
  will-change: transform;
}
.swal2-success .swal2-success-line-tip {
  transform-origin: left center;
}
.swal2-success .swal2-success-line-long {
  transform-origin: right center;
}

@keyframes swal2-animate-success-line-tip {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}
@-webkit-keyframes swal2-animate-success-line-tip {
  0% { -webkit-transform: scaleX(0); }
  100% { -webkit-transform: scaleX(1); }
}

@keyframes swal2-animate-success-line-long {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}
@-webkit-keyframes swal2-animate-success-line-long {
  0% { -webkit-transform: scaleX(0); }
  100% { -webkit-transform: scaleX(1); }
}

/* Error X mark: replace margin-top animation with translateY */
.swal2-error { will-change: transform; }
@keyframes swal2-animate-error-x-mark {
  0%   { transform: translateY(1.625em) scale(0.4); opacity: 0; }
  80%  { transform: translateY(-0.375em) scale(1.15); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@-webkit-keyframes swal2-animate-error-x-mark {
  0%   { -webkit-transform: translateY(1.625em) scale(0.4); opacity: 0; }
  80%  { -webkit-transform: translateY(-0.375em) scale(1.15); }
  100% { -webkit-transform: translateY(0) scale(1); opacity: 1; }
}

/* General show/hide animations: ensure compositor use and respect reduced motion */
.swal2-show, .swal2-hide { will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) {
  .swal2-popup.swal2-show, .swal2-popup.swal2-hide,
  .swal2-animate-success-icon .swal2-success-line-tip,
  .swal2-animate-success-icon .swal2-success-line-long,
  .swal2-animate-error-icon {
    animation: none !important;
  }
}

