/* ============================================================
   LIBRETIME UI — Notify Component
   Toasts + Modal
   ============================================================ */

/* ── Toast container ──────────────────────────────────────── */
.lt-toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 2.5rem);
}

/* ── Individual toast ─────────────────────────────────────── */
.lt-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.85rem 0.9rem;
  border-radius: var(--lt-radius);
  background: var(--lt-surface-2);
  border: 1px solid var(--lt-border);
  box-shadow: var(--lt-shadow-lg);
  pointer-events: all;
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  cursor: default;
}

/* enter animation */
@keyframes lt-toast-in {
  from { opacity: 0; transform: translateX(calc(100% + 1.5rem)); }
  to   { opacity: 1; transform: translateX(0); }
}

/* exit animation  (class toggled by JS) */
@keyframes lt-toast-out {
  from { opacity: 1; transform: translateX(0);     max-height: 120px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(calc(100% + 1.5rem)); max-height: 0; margin-bottom: -0.6rem; }
}

.lt-toast          { animation: lt-toast-in  350ms var(--lt-ease-spring) both; }
.lt-toast.is-hiding { animation: lt-toast-out 300ms var(--lt-ease) both; }

/* ── Type border colours (no thick left strip) ────────────── */
.lt-toast-success { border-color: var(--lt-success-border); }
.lt-toast-error,
.lt-toast-danger  { border-color: var(--lt-danger-border); }
.lt-toast-warning { border-color: rgba(212,162,87,0.35); }
.lt-toast-info    { border-color: rgba(77,143,209,0.3); }

/* ── Toast icon ───────────────────────────────────────────── */
.lt-toast-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
}

.lt-toast-success .lt-toast-icon { color: var(--lt-success);  background: var(--lt-success-dim); }
.lt-toast-error   .lt-toast-icon,
.lt-toast-danger  .lt-toast-icon { color: var(--lt-danger);   background: var(--lt-danger-dim); }
.lt-toast-warning .lt-toast-icon { color: var(--lt-warning);  background: var(--lt-warning-dim); }
.lt-toast-info    .lt-toast-icon { color: var(--lt-accent);   background: var(--lt-accent-dim); }

/* ── Toast body ───────────────────────────────────────────── */
.lt-toast-body { flex: 1; min-width: 0; }

.lt-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--lt-text);
  line-height: 1.3;
  margin-bottom: 2px;
}

.lt-toast-msg {
  font-size: 12px;
  color: var(--lt-text-muted);
  line-height: 1.5;
}

/* ── Close button ─────────────────────────────────────────── */
.lt-toast-close {
  width: 20px;
  height: 20px;
  min-width: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--lt-text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
  transition: color var(--lt-duration-fast), background var(--lt-duration-fast);
  flex-shrink: 0;
  margin-top: 1px;
}
.lt-toast-close:hover { color: var(--lt-text); background: var(--lt-surface-3); }

/* ── Progress bar ─────────────────────────────────────────── */
.lt-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  transform-origin: left;
}

.lt-toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: lt-progress-shrink linear forwards;
}

@keyframes lt-progress-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.lt-toast-success .lt-toast-progress-bar { background: var(--lt-success); }
.lt-toast-error   .lt-toast-progress-bar,
.lt-toast-danger  .lt-toast-progress-bar { background: var(--lt-danger); }
.lt-toast-warning .lt-toast-progress-bar { background: var(--lt-warning); }
.lt-toast-info    .lt-toast-progress-bar { background: var(--lt-accent); }


/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */

/* ── Backdrop ─────────────────────────────────────────────── */
.lt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99980;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

@keyframes lt-overlay-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes lt-overlay-out { from { opacity: 1; } to { opacity: 0; } }

.lt-modal-overlay          { animation: lt-overlay-in  220ms var(--lt-ease) both; }
.lt-modal-overlay.is-hiding { animation: lt-overlay-out 200ms var(--lt-ease) both; }

/* ── Panel ────────────────────────────────────────────────── */
.lt-modal-panel {
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: var(--lt-radius-lg);
  box-shadow: var(--lt-shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 3rem);
  overflow: hidden;
  width: 100%;
}

/* Sizes */
.lt-modal-sm { max-width: 380px; }
.lt-modal-md { max-width: 540px; }
.lt-modal-lg { max-width: 720px; }
.lt-modal-xl { max-width: 960px; }

@keyframes lt-modal-in  {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
@keyframes lt-modal-out {
  from { opacity: 1; transform: scale(1)    translateY(0); }
  to   { opacity: 0; transform: scale(0.96) translateY(8px); }
}

.lt-modal-panel           { animation: lt-modal-in  280ms var(--lt-ease-spring) both; }
.lt-modal-overlay.is-hiding .lt-modal-panel { animation: lt-modal-out 200ms var(--lt-ease) both; }

/* ── Header ───────────────────────────────────────────────── */
.lt-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--lt-border);
  flex-shrink: 0;
}

.lt-modal-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--lt-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--lt-accent-dim);
  color: var(--lt-accent);
}

.lt-modal-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--lt-text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.lt-modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--lt-radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lt-text-faint);
  transition: color var(--lt-duration), background var(--lt-duration);
  flex-shrink: 0;
}
.lt-modal-close:hover { color: var(--lt-text); background: var(--lt-surface-3); }

/* ── Body (scrollable) ────────────────────────────────────── */
.lt-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
}

/* Light scrollbar inside modal */
.lt-modal-body::-webkit-scrollbar { width: 5px; }
.lt-modal-body::-webkit-scrollbar-track { background: transparent; }
.lt-modal-body::-webkit-scrollbar-thumb { background: var(--lt-surface-3); border-radius: 99px; }

/* ── Footer ───────────────────────────────────────────────── */
.lt-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--lt-border);
  flex-shrink: 0;
  background: var(--lt-surface-2);
}

.lt-modal-footer-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Confirm variant (danger modal) ──────────────────────── */
.lt-modal-confirm .lt-modal-icon {
  background: var(--lt-danger-dim);
  color: var(--lt-danger);
}

.lt-modal-confirm .lt-modal-title {
  color: var(--lt-danger);
}

/* ── Alert strip inside modal body ───────────────────────── */
.lt-modal-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: var(--lt-radius);
  margin-bottom: 1rem;
  font-size: 13px;
  line-height: 1.5;
}

.lt-modal-alert.success { background: var(--lt-success-dim); color: var(--lt-success); border: 1px solid var(--lt-success-border); }
.lt-modal-alert.error,
.lt-modal-alert.danger  { background: var(--lt-danger-dim);  color: var(--lt-danger);  border: 1px solid var(--lt-danger-border); }
.lt-modal-alert.warning { background: var(--lt-warning-dim); color: var(--lt-warning); border: 1px solid rgba(212,162,87,0.35); }
.lt-modal-alert.info    { background: var(--lt-accent-dim);  color: var(--lt-accent);  border: 1px solid rgba(77,143,209,0.3); }

/* ── Divider inside modal body ────────────────────────────── */
.lt-modal-divider {
  border: none;
  border-top: 1px solid var(--lt-border);
  margin: 1.25rem 0;
}

/* ── Light theme adjustments ──────────────────────────────── */
[data-theme="light"] .lt-modal-overlay { background: rgba(0,0,0,0.4); }
[data-theme="light"] .lt-toast-container .lt-toast { background: var(--lt-surface); }
