/* ============================================
   FLASH MESSAGES (common-models :: message-flash.css)
   Общий стиль всплывающих уведомлений для enPlans и erespondentN — см.
   js/message-flash.js в этом же пакете. Подключается обоими приложениями
   вместо собственной копии.

   Уведомления накладываются друг на друга стопкой (как группа уведомлений
   на iOS), а не растут отдельным списком вниз/вверх — самое новое сверху
   и полностью видимо, более старые чуть выглядывают из-под него (меньше,
   прозрачнее). Наведение на стопку разворачивает её в обычный список
   (см. .stack-expanded ниже и updateMessagesDisplay в message-flash.js).
   ============================================ */
#flash-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 10050;
  box-sizing: border-box;
  width: 360px;
  max-width: calc(100vw - 48px);
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#flash-container.stack-expanded {
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Прокрутка остаётся рабочей, сама полоса скролла — скрыта (чтобы при
     наведении на стопку не появлялась визуально). */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* старый Edge/IE */
}

#flash-container::-webkit-scrollbar {
  display: none;                /* Chrome/Safari/новый Edge */
  width: 0;
  height: 0;
}

.custom-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 40px 14px 16px;
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.45;
  color: #1f2937;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid rgb(189, 189, 189);
  cursor: pointer;
  overflow: hidden;
  /* Позиция/масштаб/прозрачность в стопке считает updateMessagesDisplay
     в message-flash.js и проставляет как inline style — transition здесь
     просто анимирует переход между вызовами того расчёта. */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  transform-origin: bottom center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, box-shadow 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

/* Тень — только у самой передней карточки (.expanded проставляет
   updateMessagesDisplay() индексу 0, самому новому сообщению); у тех, что
   выглядывают из-под неё в стопке, тени нет — иначе они накладываются
   друг на друга и грязнят вид. */
.custom-alert.expanded {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Развёрнутое состояние (наведение на стопку) — просто возвращаемся к
   обычному flex-списку, браузер сам раскладывает карточки по высоте,
   никакой JS-арифметики для этого не нужно. */
#flash-container.stack-expanded {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 10px;
}
#flash-container.stack-expanded .custom-alert {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  flex-shrink: 0;
}

/* status indicator dot */
.custom-alert::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: #9ca3af;
}

.custom-alert.alert-success::before {
  background: #22a565;
}

.custom-alert.alert-danger::before {
  background: #dc2626;
}

.custom-alert.removing {
  opacity: 0;
  transform: translateX(40px) scale(0.9);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
}

.custom-alert img.alert-icon {
  display: none;
}

.p_message_cont {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.p_message_cont p {
  margin: 0;
  word-break: break-word;
}

.alert-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  position: absolute;
  right: 10px;
  top: 8px;
  font-weight: 500;
  color: #9ca3af;
  transition: color 0.2s ease;
}

.alert-close:hover {
  color: #dc2626;
}

.expand-hint {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 6px;
  cursor: pointer;
  font-style: italic;
}

@media (max-width: 768px) {
  #flash-container {
    top: auto;
    bottom: 90px;
    left: 16px;
    right: 16px;
    transform: none;
    width: auto;
    max-width: none;
    gap: 8px;
    max-height: 55vh;
  }

  .custom-alert {
    width: auto;
    padding: 12px 34px 12px 14px;
  }
}

/* Тёмная тема — срабатывает только там, где приложение вообще ставит
   data-theme="dark" на :root (сейчас это enPlans; у erespondentN такого
   переключателя нет, и это правило там просто никогда не применяется). */
:root[data-theme="dark"] .custom-alert {
  color: #eef1f5;
  background: #1b2027;
  border: 2px solid #2b313b;
}
:root[data-theme="dark"] .alert-close:hover {
  color: #e87272;
}
