/* Overlay */
.dxp-notif__overlay {
  background: rgba(15, 23, 42, 0.45);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 220ms ease;
  z-index: 9998;
}

/* Panel */
.dxp-notif__panel {
  background: #ffffff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  height: 100vh;
  max-width: 451px;
  min-height: 0;
  min-width: 420px;
  outline: none;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform 240ms ease, box-shadow 240ms ease;
  width: clamp(420px, 34vw, 451px);
  z-index: 9999;
}

html.dxp-notif--open .dxp-notif__panel {
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(0);
}

@media print {
  .dxp-notif__panel {
    display: none !important;
  }
}

/* Open state */
.dxp-notif--open .dxp-notif__overlay {
  opacity: 1;
  pointer-events: auto;
}

.dxp-notif--open .dxp-notif__panel {
  transform: translateX(0);
}

/* Header & Footer */
.dxp-notif__header,
.dxp-notif__footer {
  flex: 0 0 auto;
}

.dxp-notif__header {
  border-bottom: 1px solid #e4eaf0;
  gap: 16px;
  height: 80px;
  padding-top: 24px;
}

.dxp-notif__nav {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 0 24px 24px;
}

.dxp-notif__title {
  color: #394859;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 1px;
  line-height: 30px;
  margin: 0;
}

.dxp-notif__actions {
  align-items: center;
  display: flex;
  gap: 16px;
}

.dxp-notif__link {
  color: #1b6ebf;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.15px;
  line-height: 22px;
  text-decoration: none;
}

.dxp-notif__footer {
  align-items: center;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
}

.dxp-notif__footer a {
  color: #1b6ebf;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.15px;
  line-height: 22px;
  text-decoration: none;
}

/* Content */
.dxp-notif__content {
  flex: 1 1 auto;
  gap: 16px;
  min-height: 0;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 0 24px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.dxp-notif__content::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.dxp-notif__content::-webkit-scrollbar-track {
  background: transparent;
}

.dxp-notif__content::-webkit-scrollbar-thumb {
  background: transparent;
}

.dxp-notif__content:hover,
.dxp-notif__content:focus-within {
  scrollbar-width: thin;
}

.dxp-notif__content:hover::-webkit-scrollbar,
.dxp-notif__content:focus-within::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.dxp-notif__content:hover::-webkit-scrollbar-track,
.dxp-notif__content:focus-within::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.dxp-notif__content:hover::-webkit-scrollbar-thumb,
.dxp-notif__content:focus-within::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
}

.dxp-notif__empty {
  color: #64748b;
  font-size: 14px;
  padding: 24px 8px;
}

/* Skeleton */
.dxp-notif__skeleton {
  display: grid;
  gap: 16px;
  padding: 8px 0;
}

.dxp-notif__sk-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

.dxp-notif__sk-line {
  animation: dxp-notif-pulse 1.2s ease-in-out infinite;
  background: #e5e7eb;
  border-radius: 6px;
  height: 12px;
  margin: 8px 0;
}

.dxp-notif__sk-line--w60 {
  width: 60%;
}

.dxp-notif__sk-line--w80 {
  width: 80%;
}

.dxp-notif__sk-line--w40 {
  width: 40%;
}

@keyframes dxp-notif-pulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

/* List container spacing inside the panel */
.dxp-notif__list {
  padding-left: 16px;
  padding-right: 16px;
}

/* Disabled state */
a.is-disabled[aria-disabled='true'] {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
  text-decoration: none;
}

/* ──────────────────────────────────────────────────────────── */

/* Notification card                                            */

/* ──────────────────────────────────────────────────────────── */

.dxp-notif__list .notif-card {
  background: #ffffff;
  border-bottom: 1px solid #e4eaf0;
  display: grid;
  grid-template-columns: 1fr;
  padding: 8px 0;
  row-gap: 8px;
}

.dxp-notif__list
  .views-view-responsive-grid
  > .views-view-responsive-grid__item:last-child
  .notif-card {
  border-bottom: 0;
}

.notif-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px 0;
  padding: 4px 0;
}

.notif-card__meta {
  align-items: baseline;
  color: #394859;
  display: flex;
  font-size: 14px;
  font-weight: 400;
  gap: 10px;
  gap: 8px 0;
  justify-content: space-between;
  letter-spacing: 0.15px;
  line-height: 100%;
  padding-left: 0;
}

.notif-card__header {
  align-items: baseline;
  display: flex;
  gap: 8px 0;
  justify-content: space-between;
}

.notif-card__title {
  align-items: flex-start;
  color: #394859;
  display: inline-flex;
  font-size: 18px;
  font-weight: 500;
  gap: 8px;
  letter-spacing: 1px;
  line-height: 24px;
  margin: 0;
  margin-left: -16px;
}

.notif-card__toggle {
  color: #1b6ebf;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.15px;
  line-height: 22px;
  text-decoration: none;
}

/* Status bullet / check */
.notif-card__status {
  flex: 0 0 auto;
  translate: 0 2px;
}

.notif-card--unread .notif-card__status {
  background: #eb0e20;
  border-radius: 50%;
  height: 8px;
  margin-top: 6px;
  width: 8px;
}

.notif-card--read .notif-card__status {
  background: none;
  color: #394859;
  height: 8px;
  position: relative;
  width: 8px;
}

.notif-card--read .notif-card__status::before {
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  box-sizing: content-box;
  content: '';
  height: 5px;
  left: 2px;
  position: absolute;
  top: 4px;
  transform: rotate(-45deg);
  width: 9px;
}

/* Media */
.notif-card__media {
  margin: 8px 0 10px;
}

.notif-card__media img {
  border-radius: 8px;
  display: block;
  height: auto;
  max-width: 100%;
}

/* Summary (clamped) */
.notif-card__summary {
  color: #394859;
  display: flex;
  font-size: 14px;
  font-weight: 400;
  gap: 8px 0;
  letter-spacing: 0.15px;
  line-height: 18px;
}

.notif-card__summary .notif-card__summary-text {
  -webkit-box-orient: vertical;
  color: #394859;
  display: -webkit-box;
  letter-spacing: 0.15px;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  line-height: 18px;
  overflow: hidden;
}

.notif-card__summary p {
  margin: 0;
}

.notif-card__summary p + p {
  margin-top: 0.5rem;
}

.notif-card__summary ul,
.notif-card__summary ol {
  margin: 0;
  padding-left: 1.2rem;
}

/* Actions */
.notif-card__actions {
  display: flex;
  gap: 8px 0;
}

.notif-card__actions a {
  color: #185fa6;
  cursor: pointer;
  font-size: 1rem;
  font-weight: var(--font-weight-normal);
  letter-spacing: 0.024px;
  line-height: 1.5rem;
  text-decoration: underline;
}

.notif-card__rail {
  display: none;
} /* only on mobile */

/* =======================
   MOBILE (≤ 768px)
   ======================= */
@media (max-width: 768px) {
  /* Panel takes full width */
  .dxp-notif__panel {
    height: 100dvh;
    max-width: none;
    min-width: 0;
    width: 100vw;
  }

  .dxp-notif__content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dxp-notif__nav {
    padding: 0 16px 16px;
  }

  .dxp-notif__list {
    padding-left: 0;
    padding-right: 0;
  }

  /* Title spacing */
  .notif-card__title {
    flex-basis: auto;
    gap: 16px;
    margin-left: 0;
  }

  /* Toggle hidden on mobile; swipe is used */
  .notif-card__toggle {
    display: none !important;
  }

  /* Swipe container */
  .notif-card--swipe {
    background: #ffffff;
    overflow: hidden;
    padding: 0; /* avoid rail showing above/below */
    position: relative;
  }

  /* Sliding body */
  .notif-card__body {
    background: #ffffff;
    padding: 12px 0 24px; /* moved from .notif-card */
    position: relative;
    touch-action: pan-y;
    transform: translateX(var(--swipe-x, 0));
    transition: transform 180ms ease;
    will-change: transform;
    z-index: 1; /* above rail */
  }

  /* Right action rail */
  .notif-card__rail {
    align-items: center;
    background: #1b6ebf;
    bottom: 8.2px;
    color: #ffffff;
    display: flex;
    font-size: 16px;
    font-weight: 600;
    justify-content: center;
    letter-spacing: 0.15px;
    padding: 0 16px;
    position: absolute;
    right: 1px;
    top: 8px;
    width: 188px; /* equals max swipe distance */
    z-index: 0; /* under body */
  }

  .notif-card__rail-label {
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
  }

  .notif-card--unread .notif-card__rail {
    background: #1b6ebf;
  } /* Mark as read */
  .notif-card--read .notif-card__rail {
    background: #1b6ebf;
  } /* Mark unread */

  /* Open state */
  .notif-card--swipe.is-swipe-open .notif-card__body {
    --swipe-x: -188px;
  }

  /* Minor spacing */
  .notif-card__meta {
    margin-top: 16px;
    padding-left: 24px;
  }

  .notif-card__summary {
    padding-left: 24px;
  }

  .notif-card__actions {
    padding-left: 24px;
  }

  .notif-card__media {
    margin: 8px 0;
  }

  /* Safe-area padding for footer */
  .dxp-notif__footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
  }
}

/* =======================
   Hint banner (mobile only)
   ======================= */
.dxp-notif__hint {
  display: none;
}

@media (max-width: 768px) {
  .dxp-notif__hint {
    align-items: center;
    background: #e8f8fb;
    border: 1px solid #1b6ebf;
    border-radius: 8px;
    color: #394859;
    display: flex;
    font-size: 14px;
    gap: 8px;
    line-height: 18px;
    margin: 8px 16px 0;
    padding: 12px;
  }

  .dxp-notif__hint-icon {
    align-items: center;
    background: #dbeafe;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 auto;
    height: 22px;
    justify-content: center;
    width: 22px;
  }

  .dxp-notif__hint-close {
    appearance: none;
    background: transparent;
    border: 0;
    color: #1e3a8a;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    margin-left: auto;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dxp-notif__panel,
  .notif-card__body {
    animation: none !important;
    transition: none !important;
  }
}

/* Security: hide toggles globally unless inside the notifications shell */
.notif-card__toggle[data-dxp-owned='1'] {
  display: none;
}

#dxp-notif-root .notif-card__toggle[data-dxp-owned='1'] {
  display: inline;
}

.dxp-notification-description img {
  border-radius: 8px;
  height: auto;
  width: 100%;
}
