/* ==========================================================================
   TWILIGHTRUN UN ENGINE — CSS FIDELITY LOCK 1.1.11
   Purpose: Force the supplied TwilightRun CSS stack to bind to the UN template
   with the same structural hooks used by the pre-conversion site.
   ========================================================================== */

/* Core wrapper parity */
html, body,
.body-wrapper,
.body-innerwrapper {
  width: 100% !important;
  min-height: 100% !important;
}

.body-wrapper,
.body-innerwrapper,
#sp-main-body,
#sp-component,
#sp-left,
#sp-right,
#sp-header,
#sp-footer,
#sp-bottom {
  position: relative !important;
}

/* The user-supplied sheets are keyed to SP/Helix-style module chrome. */
.sp-module,
.sp-module-content,
.mod-custom,
.mod-custom.custom {
  box-sizing: border-box !important;
}

/* Do not let UN helper classes erase Joomla/OSM/Custom module selectors. */
.unx-position > .sp-module,
.unx-position > .moduletable,
.unx-component > .sp-module,
#sp-left .sp-module,
#sp-right .sp-module {
  display: block !important;
}

/* Membership Pro / OSM parity, independent of exact body class output. */
body.com_osmembership #sp-component,
body[class*="com_osmembership"] #sp-component,
#sp-component .osm-container,
#sp-component .osm-page,
#sp-component .osm-plans,
#sp-component #os_form,
#sp-component #osm_login_form {
  font-family: 'Montserrat', sans-serif !important;
  color: var(--base-text, #e0e0e0) !important;
}

#sp-component .osm-container,
#sp-component #os_form,
#sp-component #osm_login_form {
  background: linear-gradient(145deg, rgba(40,42,48,.90), rgba(22,24,30,.88)) !important;
  border-left: 4px solid rgba(210,176,85,.65) !important;
  border-radius: 10px !important;
  color: #e0e0e0 !important;
  box-shadow: inset 0 0 20px rgba(0,0,0,.6), 0 0 20px rgba(210,176,85,.10) !important;
  overflow: visible !important;
}

#sp-component .osm-container *,
#sp-component .osm-page *,
#sp-component #os_form *,
#sp-component #osm_login_form * {
  box-sizing: border-box !important;
}

#sp-component .osm-plan,
#sp-component .osm-item-wrapper {
  background: rgba(20,22,28,0.96) !important;
  color: #e6e6e6 !important;
  border: 1px solid rgba(0,234,255,0.45) !important;
  border-radius: 12px !important;
  box-shadow: 0 0 0 2px rgba(0,234,255,0.15), 0 10px 26px rgba(0,0,0,0.7), inset 0 0 20px rgba(0,0,0,0.55) !important;
}

#sp-component .osm-plan-title,
#sp-component .osm-item-heading,
#sp-component .osm-heading {
  font-family: 'Orbitron', sans-serif !important;
  color: var(--accent-cyan, #00eaff) !important;
  text-transform: uppercase !important;
  text-shadow: 0 0 10px rgba(0,234,255,0.6) !important;
}

#sp-component .osm-signup-container a.btn-signup,
#sp-component .osm-signup-container .btn,
#sp-component .osm-container .btn,
#sp-component #os_form .btn {
  border-radius: 6px !important;
  font-family: 'Orbitron', sans-serif !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .6px !important;
}

/* Preserve the supplied menu structure instead of generic Joomla menu stacking. */
#sp-menu .sp-megamenu-wrapper,
#sp-menu .sp-megamenu-parent,
#sp-header #sp-menu .sp-megamenu-parent {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: center !important;
}

#sp-menu .sp-megamenu-parent > li,
#sp-menu .sp-megamenu-parent > .sp-menu-item {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

#sp-menu .sp-dropdown,
#sp-menu .sp-dropdown-inner {
  z-index: 10050 !important;
}

/* Header right controls must remain a single Visualin-style tool strip. */
#menu-right,
#menu-right .header-modules,
#menu-right .sp-header-user-cart-group,
#menu-right .sp-module,
#menu-right .sp-module-content {
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
}

#menu-right .sp-module-content { width: auto !important; }

/* Recover icons even if another stylesheet hides img/svg inside links. */
#menu-right svg,
#menu-right img,
.tru-menu-cart svg,
.tru-menu-cart img,
.sp-user-icon svg,
.sp-user-icon img {
  display: inline-block !important;
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Keep section modules styled by the original files. */
#sp-feature .sp-module,
#sp-hero .sp-module,
#sp-slide .sp-module,
#sp-search .sp-module,
#sp-mb1 .sp-module,
#sp-mb2 .sp-module,
#sp-mb3 .sp-module,
#sp-mb4 .sp-module,
#sp-mb5 .sp-module,
#sp-mb6 .sp-module,
#sp-mb7 .sp-module,
#sp-mb8 .sp-module {
  width: 100% !important;
  max-width: none !important;
}

/* Prevent empty module chrome from creating visible white/unstyled gaps. */
.sp-module-content:empty,
.mod-custom:empty,
.sp-module:empty {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}


/* 1.1.12 header refinement: remove login/cart boxes and restore status dot behavior */
html body.un-template-twilightrun #menu-right .sp-sign-in,
html body.un-template-twilightrun #menu-right .sp-profile-trigger,
html body.un-template-twilightrun #menu-right .sp-cart-link,
html body.un-template-twilightrun #menu-right .tru-menu-cart,
html body.un-template-twilightrun #menu-right .tru-menu-cart .sp-module-content,
html body.un-template-twilightrun #menu-right .sp-user-module,
html body.un-template-twilightrun #menu-right .un-native-user-module,
html body.un-template-twilightrun #menu-right .un-native-cart-module {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html body.un-template-twilightrun #menu-right .sp-sign-in,
html body.un-template-twilightrun #menu-right .sp-profile-trigger,
html body.un-template-twilightrun #menu-right .sp-cart-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0 2px !important;
  min-height: auto !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

html body.un-template-twilightrun #menu-right .sp-sign-in:hover,
html body.un-template-twilightrun #menu-right .sp-profile-trigger:hover,
html body.un-template-twilightrun #menu-right .sp-cart-link:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

html body.un-template-twilightrun #menu-right .sp-sign-in .sp-user-icon { order: 1 !important; }
html body.un-template-twilightrun #menu-right .sp-sign-in .signin-text { order: 2 !important; }
html body.un-template-twilightrun #menu-right .sp-sign-in .arrow-icon { order: 2 !important; }
html body.un-template-twilightrun #menu-right .sp-sign-in .sp-login-status-dot {
  order: 3 !important;
  margin-left: 4px !important;
  margin-right: 0 !important;
  width: 7px !important;
  height: 7px !important;
  border-radius: 999px !important;
  display: inline-block !important;
  flex: 0 0 auto !important;
}
html body.un-template-twilightrun #menu-right .sp-login-status-dot-off {
  background: #ef4444 !important;
  box-shadow: 0 0 7px rgba(239,68,68,.75) !important;
}
html body.un-template-twilightrun #menu-right .sp-login-status-dot-on {
  background: #22c55e !important;
  box-shadow: 0 0 7px rgba(34,197,94,.75) !important;
}

html body.un-template-twilightrun #menu-right .tru-menu-cart,
html body.un-template-twilightrun #menu-right .sp-user-module {
  padding: 0 !important;
  margin: 0 !important;
}

html body.un-template-twilightrun #menu-right .sp-cart-link-icon-only {
  padding: 0 2px !important;
  border: 0 !important;
  background: transparent !important;
}

html body.un-template-twilightrun #menu-right .tru-menu-cart-badge {
  top: -5px !important;
  right: -5px !important;
}
