/* app.css — BW Marketplace Notifications (source, non-minified)
   Notes:
   - Astra-friendly: neutral resets, small footprint.
   - Uses CSS variables; includes dark-mode via prefers-color-scheme.
   - Class hooks match Frontend.php markup. */

/* ---------- Theme tokens ---------- */
:root {
  --bwpmn-bg: #ffffff;
  --bwpmn-card: #f9fafb;
  --bwpmn-text: #0f172a;
  --bwpmn-muted: #64748b;
  --bwpmn-border: #e5e7eb;
  --bwpmn-shadow: 0 10px 25px rgba(2, 6, 23, 0.15);

  --bwpmn-primary: #2563eb;
  /* blue */
  --bwpmn-badge: #ef4444;
  /* red */
  --bwpmn-success: #16a34a;
  /* green */
  --bwpmn-error: #dc2626;
  /* red */
  --bwpmn-warning: #d97706;
  /* amber */
  --bwpmn-info: #0ea5e9;
  /* sky */

  --bwpmn-radius: 12px;
  --bwpmn-radius-sm: 10px;
  --bwpmn-gap: 10px;
  --bwpmn-z: 9999;
  --bwpmn-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* @media (prefers-color-scheme: dark) {
  :root {
    --bwpmn-bg: #0b1220;
    --bwpmn-card: #0f172a;
    --bwpmn-text: #e2e8f0;
    --bwpmn-muted: #94a3b8;
    --bwpmn-border: #1f2937;
    --bwpmn-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  }
} */

/* ---------- Base ---------- */
.bwpmn-wrap,
.bwpmn-guest {
  font-family: var(--bwpmn-font);
}

/* ---------- Guest CTA ---------- */
.bwpmn-guest {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.bwpmn-auth-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bwpmn-btn {
  appearance: none;
  border: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  color: var(--bwpmn-text);
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;
  border-radius: 8px;
  text-decoration: none;
  transition: transform .08s ease, background-color .15s ease, border-color .15s ease;
}

.bwpmn-btn:hover {
  transform: translateY(-1px);
}

.bwpmn-btn:active {
  transform: translateY(0);
}

.bwpmn-btn.outline {
  background: transparent;
}

/* ---------- Bell & Badge ---------- */
.bwpmn-wrap {
  position: relative;
  display: inline-block;
  /* fits in Astra header */
}

.bwpmn-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  color: var(--bwpmn-text);
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

.bwpmn-bell-btn:hover {
  background: var(--bwpmn-card);
}

.bwpmn-bell-btn:active {
  transform: translateY(1px);
}

.bwpmn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bwpmn-badge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

/* ---------- Dropdown ---------- */
.bwpmn-dd {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, 92vw);
  background: var(--bwpmn-bg);
  border: 1px solid var(--bwpmn-border);
  border-radius: var(--bwpmn-radius);
  box-shadow: var(--bwpmn-shadow);
  z-index: var(--bwpmn-z);
  overflow: hidden;
}

.bwpmn-dd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bwpmn-card);
  border-bottom: 1px solid var(--bwpmn-border);
}

.bwpmn-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--bwpmn-text);
}

.bwpmn-markall {
  appearance: none;
  border: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  color: var(--bwpmn-text);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color .15s ease, transform .08s ease;
}

.bwpmn-markall:hover {
  background: var(--bwpmn-card);
}

.bwpmn-markall:active {
  transform: translateY(1px);
}

.bwpmn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 370px;
  overflow: auto;
  overscroll-behavior: contain;
}

.bwpmn-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  transition: background-color .15s ease;
}

.bwpmn-item:last-child {
  border-bottom: 0;
}

.bwpmn-item.unread {
  background: color-mix(in srgb, var(--bwpmn-primary) 9%, var(--bwpmn-bg));
}

.bwpmn-item:hover {
  background: color-mix(in srgb, var(--bwpmn-card) 60%, var(--bwpmn-bg));
}

/* Bold title for unread items */
.bwpmn-item.unread .bwpmn-item-message {
  font-weight: 700;
}


/* content (left cell) */
.bwpmn-item-content {
  min-width: 0;
}

.bwpmn-item-message {
  color: var(--bwpmn-text);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bwpmn-item-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--bwpmn-muted);
}

/* action (right cell) */
.bwpmn-item-action {
  display: flex;
  align-items: start;
  gap: 6px;
}

.bwpmn-item-link {
  appearance: none;
  border: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  color: var(--bwpmn-primary);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, transform .08s ease;
}

.bwpmn-item-link:hover {
  background: var(--bwpmn-card);
}

.bwpmn-item-link:active {
  transform: translateY(1px);
}

/* load more */
.bwpmn-loadmore {
  width: 100%;
  appearance: none;
  border: 0;
  border-top: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  color: var(--bwpmn-primary);
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease;
  border-bottom-left-radius: var(--bwpmn-radius);
  border-bottom-right-radius: var(--bwpmn-radius);
}

.bwpmn-loadmore:hover {
  background: var(--bwpmn-card);
}

/* ---------- Animations ---------- */
@keyframes bwpmn-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes bwpmn-slide-in {
  from {
    transform: translateY(-6px);
  }

  to {
    transform: translateY(0);
  }
}

/* ---------- Responsive tweaks ---------- */


/* ---------- Utility (optional) ---------- */
.bwpmn-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


.bwpmn-item.incoming {
  animation: bwpmnFlash 1.2s ease-out;
}

@keyframes bwpmnFlash {
  0% {
    background-color: rgba(52, 152, 219, .25);
  }

  100% {
    background-color: transparent;
  }
}


.bwpmn-dd.bwpmn-floating {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate3d(0, 0, 0);
  /* مقدار اولیه؛ بلافاصله با JS آپدیت می‌شود */
  max-height: 70vh;
  overflow: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bwpmn-dd.bwpmn-floating * {
  -webkit-text-size-adjust: 100%;
}




.bwpmn-item-link {
  color: #1d4ed8;
}


.bwpmn-dd {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 600px) {
  [data-bwpmn] .bwpmn-dd {
    width: calc(100vw - 24px);
    max-width: none;
    right: 12px;
    left: 12px;
    border-radius: 12px;
  }

  .bwpmn-item {
    padding: 14px 12px;
  }

  .bwpmn-item-message {
    font-size: 14px;
  }

  .bwpmn-item-link {
    font-size: 14px;
    padding: 8px 10px;
  }
}



/* === BWPMN Toasts (single source of truth) === */
.bwpmn-toasts {
  position: fixed;
  inset: 16px 16px auto auto;
  /* top right */
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2147483647;
  pointer-events: none;
  box-sizing: border-box;
  max-width: min(380px, calc(100vw - 32px));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.admin-bar .bwpmn-toasts {
  top: calc(32px + 12px);
}

@media (max-width: 782px) {
  body.admin-bar .bwpmn-toasts {
    top: calc(46px + 12px);
  }
}

@media (max-width: 600px) {
  .bwpmn-toasts {
    inset: auto 12px calc(env(safe-area-inset-bottom, 0) + 12px) 12px;
    /* bottom right/left */
    max-width: none;
    width: auto;
  }
}

.bwpmn-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-row-gap: 6px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .25);
  border-left: 4px solid #3b82f6;
  /* info */
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.bwpmn-toast.success {
  border-left-color: #10b981;
}

.bwpmn-toast.error {
  border-left-color: #ef4444;
}

.bwpmn-toast.info {
  border-left-color: #3b82f6;
}

.bwpmn-toast .bwpmn-toast-msg {
  font-size: 14px;
  line-height: 1.4;
}

.bwpmn-toast .bwpmn-toast-meta {
  grid-column: 1 / -1;
  font-size: 12px;
  opacity: .85;
}

.bwpmn-toast .bwpmn-toast-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  opacity: .75;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding-left: 6px;
}

.bwpmn-toast .bwpmn-toast-close:hover {
  opacity: 1;
}

/* Force bottom placement when JS detects off-screen */
.bwpmn-toasts.bwpmn-bottom {
  top: auto !important;
  right: 12px !important;
  left: 12px !important;
  bottom: calc(env(safe-area-inset-bottom, 0) + 12px) !important;
  max-width: none;
  width: auto;
}


@media (min-width: 768px) {
  .bwpmn-toasts {
    max-width: 460px;
  }

  .bwpmn-toast {
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(2, 6, 23, .25);
    overflow: hidden;
  }

  .bwpmn-toast .bwpmn-toast-msg {
    font-size: 16px;
    line-height: 1.5;
  }

  .bwpmn-toast .bwpmn-toast-meta {
    font-size: 13px;
    opacity: .9;
  }

  .bwpmn-toast .bwpmn-toast-close {
    font-size: 18px;
  }
}

@media (min-width: 1280px) {
  .bwpmn-toasts {
    max-width: 520px;
  }
}


/* Bell icon hardening */
.bwpmn-bell {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 0;
}

.bwpmn-bell svg {
  display: block;
  width: 20px;
  height: 20px;
}

.bwpmn-bell path {
  fill: currentColor;
}

.bwpmn-bell-btn {
  color: var(--bwpmn-text);
}

@media (max-width:480px) {

  .bwpmn-bell,
  .bwpmn-bell svg {
    width: 18px;
    height: 18px;
  }
}


@media (max-width: 480px) {
  .bwpmn-bell-btn {
    width: 36px;
    height: 36px;
  }



  .bwpmn-dd {
    width: min(94vw, 380px);
  }

  .bwpmn-item-message {
    -webkit-line-clamp: 4;
  }
}

.bwpmn-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  line-height: 0;
}

.bwpmn-bell .fa-bell {
  font-size: 20px;
}

@media (max-width:480px) {

  .bwpmn-bell,
  .bwpmn-bell .fa-bell {
    width: 18px;
    height: 18px;
    font-size: 18px;
  }
}

/* actions layout (right side of header) */
.bwpmn-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Close (X) button */
.bwpmn-close {
  appearance: none;
  border: 1px solid var(--bwpmn-border);
  background: var(--bwpmn-bg);
  color: var(--bwpmn-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, transform .08s ease, color .15s ease;
}

.bwpmn-close:hover {
  background: var(--bwpmn-card);
  color: var(--bwpmn-text);
}

.bwpmn-close:active {
  transform: translateY(1px);
}

@media (max-width:480px) {
  .bwpmn-close {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}