/* ══════════════════════════════════════
   TOAST NOTIFICATION (top-right, horizontal)
══════════════════════════════════════ */
.toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: none;
  pointer-events: none;
}

.toast-wrap.show {
  display: block;
}

.toast-box {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 300px;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-box.closing {
  animation: toastSlideOut 0.3s cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

/* Close button — left side */
.toast-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f1f2f4;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.toast-close:hover {
  background: #e2e3e6;
  color: #111;
  transform: scale(1.08);
}

/* Middle text block */
.toast-text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.toast-text h3 {
  margin: 0 0 2px 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-text p {
  margin: 0;
  font-size: 0.82rem;
  color: #666;
  line-height: 1.4;
}

/* Icon — right side */
.toast-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  padding: 6px;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

/* Auto-dismiss progress bar */
.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  background: #3b82f6;
  transform-origin: left;
  animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Type accents (left border + progress bar color) */
.toast-box[data-type="success"] { border-left: 4px solid var(--ok); }
.toast-box[data-type="success"] .toast-progress-bar { background: var(--ok); }
.toast-box[data-type="success"] .toast-icon {
  background: rgba(34, 197, 94, .1);
}

.toast-box[data-type="error"] { border-left: 4px solid red; }
.toast-box[data-type="error"] .toast-progress-bar { background: red; }
.toast-box[data-type="error"] .toast-icon {
  background: rgba(239, 68, 68, .1);
}

.toast-box[data-type="warning"] { border-left: 4px solid red; }
.toast-box[data-type="warning"] .toast-progress-bar { background: red; }
.toast-box[data-type="warning"] .toast-icon {
  background: rgba(239, 68, 68, .1);
}

.toast-box[data-type="info"] { border-left: 4px solid #3b82f6; }
.toast-box[data-type="info"] .toast-progress-bar { background: #3b82f6; }
.toast-box[data-type="info"] .toast-icon {
  background: rgba(59, 130, 246, .1);
}

/* Mobile */
@media (max-width: 480px) {
  .toast-wrap {
    top: 12px;
    right: 12px;
    left: 12px;
  }
  .toast-box {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
}
