/* R51: internal notifications (bell, unread badge, list panel). No external libraries. */

#r51NotificationRoot.hidden,
#r51NotificationRoot [hidden],
#r51NotificationRoot .hidden {
  display: none !important;
}

/* The topbar is a sticky stacking context (z-index 20/40). While the panel is open, lift it
   above the sidebar drawer and page cards so the list is never covered. */
body .topbar:has(#r51NotificationPanel:not([hidden])) {
  z-index: 1100 !important;
}

.r51-notification {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* `body` prefix: integrated.css sets `body button, body .btn {min-height:40px; padding:9px 14px}`, which
   would otherwise win over a single class and shrink the bell and 더 보기 below the 44px touch target. */
body .r51-notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.r51-notification-bell[aria-expanded="true"] {
  background: #eaf0ff;
  border-color: #b8c8f5;
}

.r51-notification-bell:focus-visible,
.r51-notification-item:focus-visible,
.r51-notification-more:focus-visible {
  outline: 3px solid #3159d9;
  outline-offset: 2px;
}

.r51-notification-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

.r51-notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 360px;
  max-width: calc(100vw - 32px);
  /* --r51-panel-room: the space left below the panel's top edge, set by r51-notifications.js on open and on
     resize, so the end of the list and 더 보기 stay reachable under a tall (wrapped, sticky) topbar. */
  max-height: min(70vh, 560px, var(--r51-panel-room, 100vh));
  padding: 14px;
  box-sizing: border-box;
  overflow: auto;
  background: #fff;
  color: #17233c;
  border: 1px solid #dce2ef;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
  text-align: left;
}

.r51-notification-head {
  padding-bottom: 8px;
  border-bottom: 1px solid #e8eaf1;
}

.r51-notification-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.r51-notification-help {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.r51-notification-status {
  margin: 0;
  color: #667085;
  font-size: 13px;
}

.r51-notification-status:empty {
  display: none;
}

.r51-notification-status.error {
  color: #c62828;
}

.r51-notification-empty {
  margin: 12px 0;
  color: #667085;
  font-size: 13px;
  text-align: center;
}

.r51-notification-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.r51-notification-list:empty {
  display: none;
}

.r51-notification-item {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px 10px 14px;
  box-sizing: border-box;
  border: 1px solid #e8eaf1;
  border-left: 4px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.r51-notification-item.is-unread {
  background: #f2f5ff;
  border-left-color: #3159d9;
}

.r51-notification-item.is-read {
  cursor: default;
  opacity: 0.78;
}

/* R51-20: a read notification that links to a loan still opens its detail. */
.r51-notification-item.is-read.has-loan {
  cursor: pointer;
}

.r51-notification-item-link {
  color: #3159d9;
  font-weight: 600;
}

.r51-notification-item.is-busy {
  cursor: progress;
  opacity: 0.6;
}

.r51-notification-item-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.r51-notification-item.is-unread .r51-notification-item-title {
  font-weight: 700;
}

.r51-notification-item-message {
  display: block;
  margin-top: 3px;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.r51-notification-item-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 8px;
  margin-top: 6px;
  color: #667085;
  font-size: 12px;
}

.r51-notification-item-state {
  font-weight: 600;
  white-space: nowrap;   /* 읽음 / 읽지 않음 never break inside a word (320px) */
}

.r51-notification-item.is-unread .r51-notification-item-state {
  color: #3159d9;
}

body .r51-notification-more {
  align-self: center;
  min-height: 44px;
  margin-top: 4px;
}

@media (max-width: 767px) {
  /* On phones the panel spans the (sticky, positioned) topbar's width right under it instead of
     hanging off the bell, which may sit anywhere in the wrapped action row. */
  .r51-notification {
    position: static;
  }

  .r51-notification-panel {
    top: calc(100% + 4px);
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
    max-height: min(70vh, var(--r51-panel-room, 70vh));
  }
}
