/* =============================================================
   modals.css — модалки и тосты.
   Источники UI Kit: модалки "Personal info" — padding 40px, gap 28px,
   radius 12px, glow shadow rgba(178,151,15,0.4).
   ============================================================= */

/* ----- Overlay (backdrop) ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.56);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-20);
  animation: modal-overlay-in .2s ease;
}

.modal-overlay.is-open {
  display: flex;
}

@keyframes modal-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ----- Dialog ----- */
.modal {
  background: var(--color-white);
  border-radius: var(--radius-lg);   /* 12px */
  padding: var(--space-40);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-28);
  box-shadow: var(--shadow-glow-soft);
  animation: modal-in .25s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal--sm { max-width: 380px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 920px; }

/* ----- Header ----- */
.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-16);
}

.modal__title {
  font-size: var(--fs-24);
  font-weight: var(--fw-semibold);
  color: var(--color-ink);
  margin: 0;
  line-height: 1.25;
}

.modal__close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-circle);
  color: var(--color-ink);
  transition: background-color .15s ease;
}

.modal__close:hover {
  background: var(--color-grey-200);
}

.modal__close svg,
.modal__close img {
  width: 19px;
  height: 19px;
}

/* ----- Body ----- */
.modal__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
}

/* ----- Footer ----- */
.modal__footer {
  display: flex;
  gap: var(--space-12);
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal__footer--between {
  justify-content: space-between;
}

.modal__footer--center {
  justify-content: center;
}

/* ----- Тосты ----- */
.toast-container {
  position: fixed;
  bottom: var(--space-24);
  right: var(--space-24);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  z-index: 1100;
  pointer-events: none;
}

.toast {
  background: var(--color-ink);
  color: var(--color-white);
  padding: var(--space-12) var(--space-20);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  animation: toast-in .25s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast--success {
  background: var(--color-success);
  color: var(--color-white);
}

.toast--error {
  background: var(--color-error);
  color: var(--color-white);
}

.toast--warning {
  background: var(--color-primary);
  color: var(--color-ink);
}

.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast__message {
  font-size: var(--fs-14);
  line-height: 1.4;
  flex: 1;
}

.toast__close {
  background: transparent;
  border: none;
  color: inherit;
  opacity: .7;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.toast__close:hover { opacity: 1; }

/* ----- Messages framework Django (.messages в base.html) ----- */
.messages {
  list-style: none;
  margin: var(--space-20) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.messages li {
  padding: var(--space-12) var(--space-20);
  border-radius: var(--radius-md);
  font-size: var(--fs-14);
  background: var(--color-grey-200);
  color: var(--color-ink);
}

.messages li.success { background: var(--color-success); color: var(--color-white); }
.messages li.error,
.messages li.danger  { background: var(--color-error);   color: var(--color-white); }
.messages li.warning { background: var(--color-primary); color: var(--color-ink); }
.messages li.info    { background: var(--color-grey-200); color: var(--color-ink); }
