/* ==========================================================================
   vxa — Netflix-style alerts for styles/default (engine: theme/js/alerts.js)
   Toasts (top-right stack), confirm/prompt modals and the loading panel that
   replace SweetAlert2 behind the window.vodlix API. Consumes only existing
   customizer variables (--vod-*) with hardcoded fallbacks; hairlines use an
   rgba fallback before color-mix. vodlix.css is untouched and loads first.
   z-index: modal 2100 / toasts 2200 — above Bootstrap modals (1050/1055),
   the header (1030/1040) and the IMA controls fix (1200).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
#vxa-toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.vxa-toast {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-color: color-mix(in srgb, var(--vod-white-color, #fff) 12%, transparent);
  background:
    linear-gradient(var(--vod-card-bg, #181818), var(--vod-card-bg, #181818)),
    #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.vxa-toast--in {
  opacity: 1;
  transform: translateX(0);
}
.vxa-toast--out {
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.vxa-toast__icon .mdi {
  font-size: 20px;
  line-height: 1.2;
}
.vxa-toast__body {
  min-width: 0;
}
.vxa-toast__title {
  color: var(--vod-white-color, #fff);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.vxa-toast__text {
  margin-top: 2px;
  color: var(--vod-grey-text, #9e9e9e);
  font-size: 12.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vxa-toast__close {
  padding: 0;
  margin: -2px -4px 0 0;
  background: none;
  border: 0;
  color: var(--vod-grey-text, #9e9e9e);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease;
}
.vxa-toast__close:hover {
  color: var(--vod-white-color, #fff);
}
.vxa-toast__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.35);
  background-color: color-mix(in srgb, var(--vod-white-color, #fff) 35%, transparent);
}

/* variant tints — toast icon, modal glyph + progress bar */
.vxa--success .vxa-toast__icon .mdi,
.vxa-modal__glyph.vxa--success .mdi {
  color: var(--vod-success, #46d369);
}
.vxa--success .vxa-toast__bar {
  background-color: var(--vod-success, #46d369);
}
.vxa--error .vxa-toast__icon .mdi,
.vxa-modal__glyph.vxa--error .mdi {
  color: var(--vod-danger, #e50914);
}
.vxa--error .vxa-toast__bar {
  background-color: var(--vod-danger, #e50914);
}
.vxa--warning .vxa-toast__icon .mdi,
.vxa-modal__glyph.vxa--warning .mdi {
  color: #f5a623;
}
.vxa--warning .vxa-toast__bar {
  background-color: #f5a623;
}
.vxa--info .vxa-toast__icon .mdi,
.vxa-modal__glyph.vxa--info .mdi {
  color: var(--vod-info, #54b9c5);
}
.vxa--info .vxa-toast__bar {
  background-color: var(--vod-info, #54b9c5);
}
.vxa--question .vxa-toast__icon .mdi,
.vxa-modal__glyph.vxa--question .mdi {
  color: var(--vod-grey-text, #9e9e9e);
}
.vxa--question .vxa-toast__bar {
  background-color: color-mix(in srgb, var(--vod-white-color, #fff) 45%, transparent);
}

/* --------------------------------------------------------------------------
   Modal / prompt / loading
   -------------------------------------------------------------------------- */
/* scroll lock: hide overflow but reserve the scrollbar's width (--vxa-sbw,
   measured by the engine) on the body AND the fixed header, so nothing
   shifts when the scrollbar disappears. Logical padding: the scrollbar sits
   left in RTL. */
.vxa-lock,
.vxa-lock body {
  overflow: hidden;
}
.vxa-lock body {
  padding-inline-end: var(--vxa-sbw, 0px);
}
.vxa-lock .vxh {
  padding-inline-end: var(--vxa-sbw, 0px);
}
.vxa-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.vxa-overlay--in {
  opacity: 1;
}
.vxa-overlay--out {
  opacity: 0;
}
/* shadcn alert-dialog shape: left-aligned head + muted description, actions
   pinned bottom-right, calm border + shadow. */
.vxa-modal {
  width: 100%;
  max-width: 440px;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-color: color-mix(in srgb, var(--vod-white-color, #fff) 10%, transparent);
  background:
    linear-gradient(var(--vod-card-bg, #181818), var(--vod-card-bg, #181818)),
    #000;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), 0 14px 40px rgba(0, 0, 0, 0.55);
  outline: none;
  text-align: start;
  transform: scale(0.97);
  transition: transform 0.15s ease;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.vxa-overlay--in .vxa-modal {
  transform: scale(1);
}
/* loading keeps the old centered layout */
.vxa-modal--center {
  text-align: center;
}
/* head: small inline status glyph + title on one line */
.vxa-modal__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}
.vxa-modal__glyph {
  display: inline-flex;
  flex: 0 0 auto;
}
.vxa-modal__glyph .mdi {
  font-size: 19px;
  line-height: 1;
}
.vxa-modal__title {
  margin: 0;
  color: var(--vod-white-color, #fff);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}
.vxa-modal--center .vxa-modal__title {
  margin: 0 0 8px;
}
.vxa-modal__text {
  margin: 0;
  color: var(--vod-grey-text, #9e9e9e);
  font-size: 13.5px;
  line-height: 1.55;
}
.vxa-modal__error {
  margin-top: 10px;
  color: var(--vod-danger, #e50914);
  font-size: 12.5px;
}
.vxa-modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.vxa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.vxa-btn:hover,
.vxa-btn:focus {
  text-decoration: none;
}
.vxa-btn--primary {
  background-color: var(--vod-primary, #dd2c00);
  border: 1px solid var(--vod-primary, #dd2c00);
  color: var(--vod-btn-primary-text, #fff);
}
.vxa-btn--primary:hover,
.vxa-btn--primary:focus {
  filter: brightness(1.08);
  color: var(--vod-btn-primary-text, #fff);
}
/* shadcn "Cancel" is an outline button: transparent fill, hairline border */
.vxa-btn--ghost {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-color: color-mix(in srgb, var(--vod-white-color, #fff) 18%, transparent);
  color: var(--vod-white-color, #fff);
}
.vxa-btn--ghost:hover,
.vxa-btn--ghost:focus {
  background-color: rgba(255, 255, 255, 0.08);
  background-color: color-mix(in srgb, var(--vod-white-color, #fff) 8%, transparent);
  color: var(--vod-white-color, #fff);
}

/* --------------------------------------------------------------------------
   Prompt inputs
   -------------------------------------------------------------------------- */
.vxa-modal__input {
  margin-top: 14px;
  text-align: start;
}
.vxa-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.08);
  background-color: color-mix(in srgb, var(--vod-white-color, #fff) 8%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-color: color-mix(in srgb, var(--vod-white-color, #fff) 16%, transparent);
  color: var(--vod-white-color, #fff);
  font-size: 14px;
  outline: none;
}
.vxa-input::placeholder {
  color: var(--vod-placeholder-color, var(--vod-grey-text, #9e9e9e));
}
.vxa-input:focus {
  border-color: color-mix(in srgb, var(--vod-primary, #dd2c00) 70%, transparent);
}
.vxa-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--vod-white-color, #fff);
  font-size: 14px;
  transition: background-color 0.15s ease;
}
.vxa-radio:hover {
  background-color: rgba(255, 255, 255, 0.08);
  background-color: color-mix(in srgb, var(--vod-white-color, #fff) 8%, transparent);
}
.vxa-radio input[type="radio"] {
  accent-color: var(--vod-primary, #dd2c00);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Loading spinner
   -------------------------------------------------------------------------- */
.vxa-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-color: color-mix(in srgb, var(--vod-white-color, #fff) 15%, transparent);
  border-top-color: var(--vod-primary, #dd2c00);
  animation: vxa-spin 0.9s linear infinite;
}
@keyframes vxa-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  #vxa-toasts {
    top: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
  .vxa-modal {
    max-width: 92vw;
    padding: 22px 18px 18px;
  }
  .vxa-modal__actions .vxa-btn {
    flex: 1 1 auto;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .vxa-toast,
  .vxa-toast--in,
  .vxa-toast--out,
  .vxa-overlay,
  .vxa-modal {
    transition: none;
    transform: none;
  }
  .vxa-spinner {
    animation-duration: 1.8s;
  }
}

/* --------------------------------------------------------------------------
   RTL
   -------------------------------------------------------------------------- */
body.rtl #vxa-toasts {
  right: auto;
  left: 16px;
}
body.rtl .vxa-toast {
  transform: translateX(-16px);
}
body.rtl .vxa-toast--in {
  transform: translateX(0);
}
body.rtl .vxa-toast--out {
  transform: translateX(-16px);
}
@media (max-width: 767.98px) {
  body.rtl #vxa-toasts {
    left: 8px;
  }
}
