/* ============================================================
   Sekai — modals.css
   Модалки Astra: чистые, стеклянные, с плавным появлением.
============================================================ */

/* ============================================================
   BACKDROP
============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 6, 7, 0.55);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop.modal-bottom {
  align-items: flex-end;
  padding-bottom: 32px;
}

/* ============================================================
   МОДАЛКА
============================================================ */
.modal {
  background: rgba(28, 28, 32, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line-hover);
  border-radius: var(--r-xl);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.96) translateY(10px);
  opacity: 0;
  transition: transform var(--t-slow), opacity var(--t-slow);
}

.modal-backdrop.visible .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.20),
    transparent);
  pointer-events: none;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-sm { max-width: 400px; }

/* Ручка снизу */
.modal-handle {
  display: none;
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  margin: 12px auto 0;
  flex-shrink: 0;
}

.modal-backdrop.modal-bottom .modal-handle { display: block; }

/* ============================================================
   HEAD
============================================================ */
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--glass-line);
  flex-shrink: 0;
}

.modal-head-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--glass-line-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
}

.modal-head-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
}

.modal-head-info { flex: 1; min-width: 0; }

.modal-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--text);
  line-height: 1.25;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 5px;
  line-height: 1.5;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--glass-line);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255, 100, 100, 0.10);
  border-color: rgba(255, 100, 100, 0.25);
  color: rgba(255, 150, 150, 0.95);
}

.modal-close:active { transform: scale(0.92); }

.modal-close svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}

/* ============================================================
   BODY
============================================================ */
.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

/* ============================================================
   FOOT
============================================================ */
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 28px 24px;
  border-top: 1px solid var(--glass-line);
  flex-shrink: 0;
}

.modal-foot .btn { flex: 1; }

/* ============================================================
   TOASTS
============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  pointer-events: auto;
  background: rgba(28, 28, 32, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line-hover);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: toastIn 260ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0.7;
}

.toast.toast-error::before { background: rgba(255, 140, 140, 0.9); }
.toast.toast-warn::before { background: rgba(255, 200, 120, 0.9); }
.toast.toast-ok::before { background: rgba(140, 220, 160, 0.9); }

.toast.fade-out {
  animation: toastOut 220ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--glass-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-2);
}

.toast-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 8px;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.toast-msg {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
  word-break: break-word;
}

.toast-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
  margin-top: -2px;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
}

.toast-close svg { width: 11px; height: 11px; stroke-width: 2; }

/* ============================================================
   CONFIRM
============================================================ */
.confirm {
  max-width: 400px;
  padding: 28px 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent-soft);
  border: 1px solid var(--glass-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  margin-bottom: 10px;
}

.confirm-icon.danger {
  background: rgba(255, 100, 100, 0.10);
  border-color: rgba(255, 100, 100, 0.22);
  color: rgba(255, 140, 140, 0.95);
}

.confirm-icon svg { width: 24px; height: 24px; }

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.confirm-message {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin-bottom: 8px;
}

.confirm-foot {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
}

.confirm-foot .btn { flex: 1; }

/* ============================================================
   DROPDOWN
============================================================ */
.dropdown {
  position: absolute;
  z-index: 2000;
  min-width: 260px;
  max-width: 360px;
  padding: 8px;
  background: rgba(14, 20, 42, 0.55);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-line-hover);
  border-radius: var(--r-md);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 50px -16px rgba(110, 130, 255, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.dropdown.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: left;
  width: 100%;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.dropdown-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.dropdown-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
  opacity: 0.75;
  flex-shrink: 0;
}

.dropdown-sep {
  height: 1px;
  background: var(--glass-line);
  margin: 6px 8px;
}

/* ============================================================
   SUCCESS MODAL
============================================================ */
.modal-success {
  text-align: center;
  padding: 36px 28px 28px;
}

.modal-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  margin: 0 auto 20px;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.12);
  animation: successPop 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-success-icon svg {
  width: 32px;
  height: 32px;
  stroke-width: 2;
}

.modal-success-title {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.4px;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-success-sub {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}