/**
 * @file
 * Contains Code for utilikit.
 *
 * Filename: utilikit.engine.css
 * Website: https://www.flashwebcenter.com
 * Developer: Alaa Haddad https://www.alaahaddad.com.
 */

/* =============================================================================
   Mode-Specific Styling
   ========================================================================== */

/* Hide UtiliKit elements until processed - ONLY in inline mode */
body.utilikit-inline-mode .utilikit:not([data-utilikit-props]) {
  visibility: hidden;
}

/* Alternative rule for backwards compatibility */
body:not(.utilikit-static-mode, .utilikit-head-mode) .utilikit:not([data-utilikit-props]) {
  visibility: hidden;
}

/* Show elements once they have been processed */
.utilikit[data-utilikit-props] {
  visibility: visible;
}

/* Static mode - elements are always visible (CSS file handles styling) */
body.utilikit-static-mode .utilikit {
  visibility: visible;
}

/* Head mode - elements are always visible (CSS in head handles styling) */
body.utilikit-head-mode .utilikit {
  visibility: visible;
}
/* =============================================================================
   Developer Mode Features
   ========================================================================== */

/* Visual debugging - admin preview mode */
body.uk-admin .utilikit {
  outline: 2px dashed rgb(0, 123, 255, 0.7) !important;
  outline-offset: 2px;
}

/* Developer mode general styling */
body.uk-dev .utilikit {
  position: relative;
}

/* Add a small dev indicator in dev mode */
body.uk-dev .utilikit::before {
  position: absolute;
  z-index: 1000;
  top: -15px;
  left: -15px;
  content: "🛠️";
  pointer-events: none;
  opacity: 0.5;
  font-size: 10px;
}

/* =============================================================================
   Transition Effects
   ========================================================================== */

/* Smooth transitions when enabled */
body.uk-trans .utilikit {
  transition: all 0.3s ease-in-out;
}

/* Faster transitions for inline mode (real-time changes) */
body.utilikit-inline-mode.uk-trans .utilikit {
  transition: all 0.15s ease-out;
}

/* =============================================================================
   Performance Optimizations
   ========================================================================== */

/* Prevent layout thrashing during style application */
.utilikit {
  box-sizing: border-box;
  transition: visibility 0.1s ease-in-out;
}

/* Optimize for inline mode processing */
body.utilikit-inline-mode .utilikit {
  will-change: auto; /* Let browser optimize what changes */
}

/* Static mode doesn't need change optimization */
body.utilikit-static-mode .utilikit {
  will-change: auto;
}

/* Head mode doesn't need change optimization */
body.utilikit-head-mode .utilikit {
  will-change: auto;
}
/* =============================================================================
   Accessibility & Debug Features
   ========================================================================== */

/* High contrast mode for accessibility testing.
   `more` is the value Media Queries Level 5 defines. `high` was an early draft
   name that only old Safari ever shipped; every engine that honours this query
   today honours `more`. */
@media (prefers-contrast: more) {
  body.uk-admin .utilikit {
    outline-width: 3px;
    outline-color: #000;
  }
}

/* Reduce motion when user prefers it */
@media (prefers-reduced-motion: reduce) {
  body.uk-trans .utilikit {
    transition: none !important;
  }
}

/* Debug information tooltip */
body.uk-dev .utilikit[data-utilikit-props]:hover::after {
  position: absolute;
  z-index: 1001;
  bottom: 100%;
  left: 0;
  padding: 4px 8px;
  content: "Props: " attr(data-utilikit-props);
  white-space: nowrap;
  pointer-events: none;
  color: white;
  border-radius: 4px;
  background: rgb(0, 0, 0, 0.8);
  font-size: 11px;
}

/* =============================================================================
   Error States
   ========================================================================== */

/* Elements with processing errors */
.utilikit.uk-error {
  outline: 2px solid #dc3545 !important;
  background-color: rgb(220, 53, 69, 0.1) !important;
}

/* =============================================================================
   Loading States
   ========================================================================== */

/* Loading indicator for inline mode */
body.utilikit-inline-mode .utilikit:not([data-utilikit-props]) {
  position: relative;
}

body.utilikit-inline-mode .utilikit:not([data-utilikit-props])::before {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  content: "";
  animation: utilikit-loading 1.5s infinite;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgb(0, 123, 255, 0.1), transparent);
}

@keyframes utilikit-loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Remove loading animation once processed */
.utilikit[data-utilikit-props]::before {
  display: none;
}
