/* ============================================================
   JBB — Toast + Bottom Sheet
   Location: assets/css/toast.css
   ============================================================ */

/* ============ TOASTS ============ */
#jbbToastHost {
  position: fixed;
  top: 88px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 40px);
}

@media (max-width: 640px) {
  #jbbToastHost {
    top: auto;
    bottom: 20px;
    right: 12px;
    left: 12px;
    max-width: none;
    width: auto;
  }
}

.jbb-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--c-surface);
  color: var(--c-ink);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--c-ink-3);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  line-height: 1.5;
  transform: translateY(-8px);
  opacity: 0;
  transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1), opacity .22s ease;
  position: relative;
  overflow: hidden;
}

.jbb-toast.jbb-toast-in {
  transform: translateY(0);
  opacity: 1;
}

.jbb-toast.jbb-toast-out {
  transform: translateY(-6px);
  opacity: 0;
}

/* Icon */
.jbb-toast .jbb-toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-top: 1px;
}

/* Body */
.jbb-toast .jbb-toast-body {
  flex: 1;
  min-width: 0;
}

.jbb-toast .jbb-toast-title {
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: 2px;
}

.jbb-toast .jbb-toast-message {
  color: var(--c-ink-3);
  word-wrap: break-word;
}

/* Action button */
.jbb-toast .jbb-toast-action {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-brand);
  background: none;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* Close button */
.jbb-toast .jbb-toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-ink-4);
  font-size: 12px;
  border-radius: 4px;
}

.jbb-toast .jbb-toast-close:hover {
  background: var(--c-line-2);
  color: var(--c-ink);
}

/* Progress bar (auto-dismiss) */
.jbb-toast .jbb-toast-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.25;
  width: 100%;
  transform-origin: left;
  animation: jbb-toast-progress linear forwards;
}

@keyframes jbb-toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Variants */
.jbb-toast-success { border-left-color: var(--c-success); color: var(--c-success); }
.jbb-toast-success .jbb-toast-title { color: var(--c-success); }

.jbb-toast-error   { border-left-color: var(--c-danger); color: var(--c-danger); }
.jbb-toast-error   .jbb-toast-title { color: var(--c-danger); }

.jbb-toast-warning { border-left-color: var(--c-warning); color: var(--c-warning); }
.jbb-toast-warning .jbb-toast-title { color: var(--c-warning); }

.jbb-toast-info    { border-left-color: var(--c-info); color: var(--c-info); }
.jbb-toast-info    .jbb-toast-title { color: var(--c-info); }

/* Body text should not inherit accent colour */
.jbb-toast .jbb-toast-message { color: var(--c-ink-3); }

/* ============ BOTTOM SHEET ============ */
.jbb-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 16, 0.45);
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.jbb-sheet-backdrop.jbb-sheet-in {
  opacity: 1;
}

.jbb-sheet {
  background: var(--c-surface);
  width: 100%;
  max-width: 540px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.jbb-sheet-backdrop.jbb-sheet-in .jbb-sheet {
  transform: translateY(0);
}

/* Handle bar */
.jbb-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--c-line);
  border-radius: 999px;
  margin: 0 auto 20px;
}

/* Icon */
.jbb-sheet-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-brand-soft);
  color: var(--c-brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 22px;
}

.jbb-sheet-icon.jbb-sheet-icon-danger {
  background: #FEE2E2;
  color: var(--c-danger);
}

.jbb-sheet-icon.jbb-sheet-icon-warning {
  background: #FEF3C7;
  color: var(--c-warning);
}

.jbb-sheet-icon.jbb-sheet-icon-success {
  background: #DCFCE7;
  color: var(--c-success);
}

.jbb-sheet-icon.jbb-sheet-icon-info {
  background: #DBEAFE;
  color: var(--c-info);
}

/* Title / body */
.jbb-sheet-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  color: var(--c-ink);
  margin-bottom: 8px;
}

.jbb-sheet-body {
  font-size: 13px;
  color: var(--c-ink-3);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Actions */
.jbb-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jbb-sheet-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, opacity .2s ease;
}

.jbb-sheet-btn-primary {
  background: var(--c-ink);
  color: #fff;
}
.jbb-sheet-btn-primary:hover { background: #333; }

.jbb-sheet-btn-secondary {
  background: var(--c-brand);
  color: #fff;
}
.jbb-sheet-btn-secondary:hover { background: #a86a49; }

.jbb-sheet-btn-ghost {
  background: transparent;
  color: var(--c-ink);
  border: 1px solid var(--c-line);
}
.jbb-sheet-btn-ghost:hover { background: var(--c-line-2); }

.jbb-sheet-btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.jbb-sheet-btn-danger:hover { background: #991b1b; }

/* Compact bottom sheet for mobile filter panel */
.jbb-sheet.jbb-sheet-tall {
  max-height: 92vh;
}