/*
 * _referral-notif.css
 * ─────────────────────────────────────────────────────────────────────────────
 * Notifications widget – left-side tab + animated side nav panel.
 *
 * Panel structure:
 *   .referral-notif-btn          Left-side trigger tab
 *   .referral-sidenav-overlay    Click-away overlay
 *   .referral-sidenav            Side nav container
 *     .referral-sidenav-header   Title row + close button
 *     .notif-type-tabs           Notification-type selector (Referrals | Facilities | …)
 *     .referral-filter-tabs      Read-status filter (All | Unread) + Mark all read button
 *     .referral-sidenav-body     Scrollable notification card list
 *
 * ProRisk colour palette:
 *   Primary Navy  : #2a2e53  (rgb(42,46,83) – ProRisk brand navy/blue)
 *   Hover Navy    : #1e2240  (10% darker for hover / focus)
 *   Navy tint bg  : #eeeef3  (very light navy surface)
 *   Navy border   : #c3c5d6  (subtle navy border)
 *   Danger Red    : #ee3524  (unread / urgent indicators – ProRisk primary red)
 *   Dark Red      : #c42d1e  (danger hover)
 *   Secondary     : #585A5B  (secondary grey text / borders)
 *   White         : #ffffff
 *   Body bg       : #f8f9fa
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── Keyframe animations ─────────────────────────────────────────────────── */
@keyframes referral-notif-pulse {
  0%   { box-shadow: 3px 0 5px rgba(0,0,0,0.3), 0 0 0 0   rgba(42,46,83,0.75); }
  50%  { box-shadow: 3px 0 5px rgba(0,0,0,0.3), 0 0 0 14px rgba(42,46,83,0); }
  100% { box-shadow: 3px 0 5px rgba(0,0,0,0.3), 0 0 0 0   rgba(42,46,83,0); }
}
@keyframes referral-card-in {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes referral-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Left-side tab trigger (mirrors right-side .feedback-btn) ────────────── */
.referral-notif-btn {
  background: #2a2e53;
  width: 32px;
  height: 130px;
  position: fixed;
  top: calc(50vh - 65px);
  left: 0;
  z-index: 999;
  transition: width 0.3s ease, background 0.2s ease;
  box-shadow: 3px 0 6px rgba(0,0,0,0.22);
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.referral-notif-btn button {
  width: 130px;
  background: transparent;
  border: 0;
  color: #ffffff;
  padding: 4px 0;
  transform: rotate(90deg);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.5px;
  line-height: 1.3;
  pointer-events: none;
}
.referral-notif-btn:hover {
  width: 42px;
  background: #1e2240;
}
.referral-notif-btn.pulse {
  animation: referral-notif-pulse 1.1s ease-out 3;
}

/* Unread badge on the tab */
.referral-tab-badge {
  position: absolute;
  top: 6px;
  right: -9px;
  background: #ee3524;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  pointer-events: none;
  border: 2px solid #fff;
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.referral-sidenav-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.38);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.32s ease;
}
.referral-sidenav-overlay.open {
  display: block;
  opacity: 1;
}

/* ── Side nav panel ──────────────────────────────────────────────────────── */
.referral-sidenav {
  position: fixed;
  top: 0;
  left: -420px;
  width: 400px;
  max-width: 94vw;
  height: 100%;
  background: #fff;
  z-index: 1050;
  box-shadow: 6px 0 28px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transition: left 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 14px 14px 0;
  overflow: hidden;
}
.referral-sidenav.open {
  left: 0;
}

/* ── Panel header ────────────────────────────────────────────────────────── */
.referral-sidenav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 10px;
  background: linear-gradient(135deg, #2a2e53 0%, #1e2240 100%);
  color: #fff;
  flex-shrink: 0;
}
.referral-sidenav-header h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  line-height: 1.2;
}
.referral-header-icon {
  font-size: 18px;
  opacity: 0.92;
}

/* ── Close button ────────────────────────────────────────────────────────── */
.referral-sidenav-close {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  outline: none;
}
.referral-sidenav-close:hover {
  background: rgba(255,255,255,0.35);
  border-color: rgba(255,255,255,0.65);
  transform: scale(1.1);
}
.referral-sidenav-close:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.35);
  outline: none;
}
.referral-sidenav-close span {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-top: -1px;
}

/* ── Notification Type Tabs (Referrals | Facilities | …) ─────────────────── */
.notif-type-tabs {
  display: flex;
  background: #eeeef3;
  border-bottom: 2px solid #c3c5d6;
  padding: 0 14px;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
}
.notif-type-tabs::-webkit-scrollbar { height: 0; }

.notif-type-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #585A5B;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px 7px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  border-radius: 4px 4px 0 0;
  margin-bottom: -2px;
}
.notif-type-tab.active {
  color: #2a2e53 !important;
  border-bottom-color: #2a2e53 !important;
  background: #fff !important;
  font-weight: 700;
}
.notif-type-tab:hover:not(.active) {
  color: #2a2e53;
  background: #dddde6;
}

/* Unread count pill on type tabs */
.notif-type-count {
  display: inline-block;
  background: #ee3524;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 5px;
  line-height: 15px;
  min-width: 16px;
  text-align: center;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Stats strip (kept hidden – counts shown inline on filter tabs) ────────── */
.referral-sidenav-stats {
  display: none;
  background: #eeeef3;
  border-bottom: 1px solid #c3c5d6;
  flex-shrink: 0;
}
.referral-stat-item {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  border-right: 1px solid #c3c5d6;
}
.referral-stat-item:last-child { border-right: none; }
.referral-stat-number {
  font-size: 20px;
  font-weight: 700;
  color: #2a2e53;
  line-height: 1;
}
.referral-stat-label {
  font-size: 10px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── Read-status Filter Tabs (All | Unread) ──────────────────────────────── */
.referral-filter-tabs {
  display: flex;
  align-items: center;
  padding: 10px 14px 0;
  gap: 4px;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
  background: #fff;
  overflow-x: auto;
}
.referral-filter-tabs::-webkit-scrollbar { height: 0; }
.referral-filter-tab {
  background: none;
  border: none;
  padding: 6px 12px 9px;
  font-size: 12px;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  border-radius: 4px 4px 0 0;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
}
.referral-filter-tab.active {
  color: #2a2e53 !important;
  border-bottom-color: #2a2e53 !important;
  background: #eeeef3 !important;
  font-weight: 600;
}
.referral-filter-tab:hover:not(.active) {
  color: #2a2e53;
  background: #eeeef3;
}

/* Inline count pill on read-status filter tabs */
.referral-tab-count {
  display: inline-block;
  background: #c3c5d6;
  color: #2a2e53;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 5px;
  line-height: 15px;
  min-width: 16px;
  text-align: center;
  margin-left: 3px;
  vertical-align: middle;
}
.referral-filter-tab.active .referral-tab-count {
  background: #2a2e53;
  color: #fff;
}
.referral-tab-count-unread {
  background: #fde8e7;
  color: #c42d1e;
}
.referral-filter-tab.active .referral-tab-count-unread {
  background: #ee3524;
  color: #fff;
}

/* ── Notification list body ──────────────────────────────────────────────── */
.referral-sidenav-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  background: #f8f9fa;
}
.referral-sidenav-body::-webkit-scrollbar { width: 4px; }
.referral-sidenav-body::-webkit-scrollbar-track { background: #f0f0f0; }
.referral-sidenav-body::-webkit-scrollbar-thumb {
  background: #c3c5d6;
  border-radius: 3px;
}

/* ── Notification card ───────────────────────────────────────────────────── */
.referral-notif-card {
  background: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-left: 3px solid #2a2e53;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
  position: relative;
  animation: referral-card-in 0.28s ease both;
}
.referral-notif-card:hover {
  box-shadow: 0 4px 14px rgba(42,46,83,0.15);
  transform: translateX(3px);
}
/* Unread cards – red left accent + tinted background */
.referral-notif-card.unread {
  border-left-color: #ee3524;
  background: #fff9f8;
}
/* Unread dot indicator (top-right corner) */
.referral-notif-card.unread::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: #ee3524;
  border-radius: 50%;
}

.referral-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2px;
  gap: 6px;
}

/* Card title – plain variant */
.referral-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #212529;
  line-height: 1.25;
  flex: 1;
}

/* Card title – link variant (replaces separate referral-card-link) */
.referral-card-title-link {
  font-size: 12px;
  font-weight: 600;
  color: #2a2e53;
  line-height: 1.25;
  flex: 1;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #2a2e53;
  transition: color 0.15s, text-decoration-color 0.15s;
  cursor: pointer;
}
.referral-card-title-link:hover,
.referral-card-title-link:focus {
  color: #1e2240;
  text-decoration-color: #1e2240;
  outline: none;
}

.referral-card-time {
  font-size: 10px;
  color: #adb5bd;
  white-space: nowrap;
  margin-top: 1px;
  flex-shrink: 0;
}
.referral-card-body-text {
  font-size: 11px;
  color: #6c757d;
  line-height: 1.4;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.referral-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: #adb5bd;
  text-align: center;
}
.referral-empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.45;
}
.referral-empty-state p {
  font-size: 14px;
  margin: 0;
  color: #6c757d;
}

/* ── Mark-all-read inline button (lives in the filter-tabs row) ──────────── */
.referral-mark-all-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ee3524 0%, #c42d1e 100%);
  border: none;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 13px 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  letter-spacing: 0.25px;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(238,53,36,0.35);
  transition: background 0.22s, box-shadow 0.22s, transform 0.12s;
  align-self: center;
  margin-bottom: 8px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.12);
}
.referral-mark-all-btn:hover {
  background: linear-gradient(135deg, #d42f1e 0%, #a82518 100%);
  box-shadow: 0 3px 10px rgba(238,53,36,0.45);
  transform: translateY(-1px);
}
.referral-mark-all-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(238,53,36,0.25);
}
.referral-mark-all-btn:focus-visible {
  outline: 2px solid #ee3524;
  outline-offset: 2px;
}
.referral-mark-all-btn i {
  font-size: 14px;
  opacity: 0.95;
}

/* Keep secondary-style class for the error-state retry button in JS */
.referral-footer-btn-secondary {
  background: #eeeef3;
  color: #2a2e53;
  border: 1px solid #c3c5d6;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.referral-footer-btn-secondary:hover {
  background: #c3c5d6;
  color: #1e2240;
}

/* ── Load-more button (rendered by JS between body and footer) ───────────── */
.referral-load-more-btn {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 10px;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid #c3c5d6;
  background: #eeeef3;
  color: #2a2e53;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}
.referral-load-more-btn:hover:not(:disabled) {
  background: #c3c5d6;
  color: #1e2240;
  box-shadow: 0 2px 6px rgba(42,46,83,0.15);
}
.referral-load-more-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
.referral-skeleton {
  border-radius: 8px;
  height: 72px;
  margin-bottom: 10px;
  animation: referral-skeleton-shimmer 1.4s infinite linear;
  background: linear-gradient(90deg, #f0f0f0 25%, #fafafa 50%, #f0f0f0 75%);
  background-size: 400% 100%;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .referral-notif-btn { display: none !important; }
  .referral-sidenav   { width: 100%; max-width: 100%; border-radius: 0; }
}
