/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* =========================================================================
   Makerique Boutique — storefront alerts / toasts  (#alert)
   OpenCart injects add-to-cart / stock feedback into the header's `#alert`
   div. By default that div is in normal flow at the very top of the page, so
   the alert pushes the whole page down (invisible when scrolled) and, when the
   slide-out cart drawer is enabled, the green "added to cart" box overlaps the
   drawer — duplicate, overlapping feedback. Float `#alert` as a bottom-centre
   toast stack instead: above content, out of the header/drawer, self-clearing.
   Markup is core (`.alert.alert-dismissible`); this is styling only.
   ========================================================================= */

#alert {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1080;                 /* above content + sticky header, toast layer */
  width: min(420px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column-reverse; /* newest alert (prepended) sits at the bottom */
  gap: .5rem;
  pointer-events: none;          /* let clicks through the gaps between toasts */
}
/* An empty #alert must not sit invisibly over the page swallowing clicks. */
#alert:empty { display: none; }

#alert .alert {
  pointer-events: auto;
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .8rem 1rem;
  border: 1px solid var(--mr-border, #E7DFD5);
  border-left-width: 4px;
  border-radius: var(--mr-radius, 12px);
  box-shadow: var(--mr-shadow-hover, 0 12px 30px rgba(0, 0, 0, .16));
  background: var(--mr-surface, #fff);
  color: var(--mr-text, #2B2723);
  font-family: var(--mr-font-body, sans-serif);
  font-size: .95rem;
  line-height: 1.4;
  animation: mr-toast-in var(--mr-transition, .22s ease);
}
#alert .alert > i { margin-top: .1rem; font-size: 1.05rem; }
#alert .alert .btn-close {
  margin-left: auto;
  flex: 0 0 auto;
  padding: .35rem;
  font-size: .7rem;
}

#alert .alert-success {
  border-left-color: var(--mr-success, #3E7C58);
  --bs-alert-color: var(--mr-text, #2B2723);
}
#alert .alert-success > i { color: var(--mr-success, #3E7C58); }

#alert .alert-danger {
  border-left-color: var(--mr-error, #B4483C);
}
#alert .alert-danger > i { color: var(--mr-error, #B4483C); }

#alert .alert-warning {
  border-left-color: var(--mr-warning, #C9922E);
}
#alert .alert-warning > i { color: var(--mr-warning, #C9922E); }

/* Fade-out applied by the auto-dismiss script before removal. */
#alert .alert.mr-toast-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
}

@keyframes mr-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  #alert .alert { animation: none; }
  #alert .alert.mr-toast-out { transition: none; }
}
