/* =========================================================
   NOTIFICATIONS / NOTIFICATION BADGES / NOTIFICATION TABLES
========================================================= */

.dashboard-notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #E94763;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.dashboard-nav-notification-link .dashboard-notification-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid #ffd36a;
  background: #fff3cd;
  color: #8a5a00;
  font-size: 13px;
}

.dashboard-nav-notification-link .dashboard-notification-badge[style*="display:none"] {
  display: none;
}

.dashboard-topbar-notification-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #434B49;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.dashboard-topbar-notification-link:hover {
  background: transparent;
}

.dashboard-topbar-notification-link .dashboard-nav-icon {
  width: auto;
  margin-right: 0;
}

.dashboard-topbar-notification-link .dashboard-notification-badge {
  position: static;
  display: inline;
  min-width: auto;
  height: auto;
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #00A19E;
  font-size: 14px;
  font-weight: 700;
}

.dashboard-topbar-notification-icon,
.dashboard-mobile-notification-icon {
  font-size: 18px;
}

.dashboard-topbar-notification-text {
  display: inline-block;
}

.dashboard-mobile-notification-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #00A19E;
  font-size: 16px;
  font-weight: 700;
}

.dashboard-mobile-notification-icon {
  font-size: 24px;
}

/* Notifications List */

.dashboard-notification-filter-card {
  margin-bottom: 20px;
}

.dashboard-notification-message-cell {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
}

.dashboard-notification-detail-actions,
.notification-detail-actions-top {
  justify-content: flex-end;
}

.notification-date,
.dashboard-table-date {
  color: #434B49;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.notification-time,
.dashboard-table-time {
  display: block;
  margin-top: 4px;
  color: #839898;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.15;
  white-space: nowrap;
}

/* Notification tables */

.dashboard-notification-table,
.dashboard-notifications-table {
  min-width: 860px;
}

.dashboard-notifications-table {
  min-width: 0;
  table-layout: fixed;
}

.dashboard-notifications-table th,
.dashboard-notifications-table td {
  text-align: left;
  vertical-align: middle;
}

.dashboard-notifications-table th:nth-child(1),
.dashboard-notifications-table td:nth-child(1) {
  width: 120px;
}

.dashboard-notifications-table th:nth-child(2),
.dashboard-notifications-table td:nth-child(2) {
  width: auto;
}

.dashboard-notifications-table th:nth-child(3),
.dashboard-notifications-table td:nth-child(3) {
  width: 100px;
}

.dashboard-notifications-table th:nth-child(4),
.dashboard-notifications-table td:nth-child(4) {
  width: 85px;
}

.dashboard-notifications-table th:nth-child(5),
.dashboard-notifications-table td:nth-child(5) {
  width: 90px;
  text-align: right;
}

.dashboard-dashboard-notifications-table {
  min-width: 0;
  table-layout: fixed;
}

.dashboard-dashboard-notifications-table th,
.dashboard-dashboard-notifications-table td {
  text-align: left;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.dashboard-dashboard-notifications-table th:nth-child(1),
.dashboard-dashboard-notifications-table td:nth-child(1) {
  width: 150px;
}

.dashboard-dashboard-notifications-table th:nth-child(2),
.dashboard-dashboard-notifications-table td:nth-child(2) {
  width: auto;
}

.dashboard-dashboard-notifications-table th:nth-child(3),
.dashboard-dashboard-notifications-table td:nth-child(3) {
  width: 110px;
  white-space: nowrap;
}

.dashboard-dashboard-notifications-table th:nth-child(4),
.dashboard-dashboard-notifications-table td:nth-child(4) {
  width: 110px;
  white-space: nowrap;
}

.dashboard-dashboard-notifications-table th:nth-child(5),
.dashboard-dashboard-notifications-table td:nth-child(5) {
  width: 100px;
  text-align: right;
  white-space: nowrap;
}

.dashboard-dashboard-notifications-table .dashboard-badge,
.dashboard-dashboard-notifications-table .dashboard-link-btn {
  white-space: nowrap;
}

.dashboard-dashboard-notifications-table .dashboard-badge {
  max-width: 100%;
}

@media (max-width: 860px) {
  .dashboard-dashboard-notifications-table th:nth-child(4),
  .dashboard-dashboard-notifications-table td:nth-child(4) {
    display: none;
  }

  .dashboard-dashboard-notifications-table th:nth-child(1),
  .dashboard-dashboard-notifications-table td:nth-child(1) {
    width: 28%;
  }

  .dashboard-dashboard-notifications-table th:nth-child(2),
  .dashboard-dashboard-notifications-table td:nth-child(2) {
    width: 34%;
  }

  .dashboard-dashboard-notifications-table th:nth-child(3),
  .dashboard-dashboard-notifications-table td:nth-child(3) {
    width: 20%;
  }

  .dashboard-dashboard-notifications-table th:nth-child(5),
  .dashboard-dashboard-notifications-table td:nth-child(5) {
    width: 18%;
    text-align: right;
  }

  .dashboard-dashboard-notifications-table th,
  .dashboard-dashboard-notifications-table td,
  .dashboard-notifications-table th,
  .dashboard-notifications-table td {
    padding: 8px 4px;
    font-size: 12px;
  }

  .dashboard-notifications-table th:nth-child(1),
  .dashboard-notifications-table td:nth-child(1) {
    width: 22%;
  }

  .dashboard-notifications-table th:nth-child(2),
  .dashboard-notifications-table td:nth-child(2) {
    width: 34%;
  }

  .dashboard-notifications-table th:nth-child(3),
  .dashboard-notifications-table td:nth-child(3) {
    width: 24%;
  }

  .dashboard-notifications-table th:nth-child(4),
  .dashboard-notifications-table td:nth-child(4) {
    display: none;
  }

  .dashboard-notifications-table th:nth-child(5),
  .dashboard-notifications-table td:nth-child(5) {
    width: 20%;
    text-align: right;
  }

  .notification-date,
  .notification-time,
  .dashboard-table-date,
  .dashboard-table-time {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.15;
  }

  .notification-date,
  .dashboard-table-date {
    font-size: 12px;
  }

  .notification-time,
  .dashboard-table-time {
    font-size: 10px;
  }

  .dashboard-notifications-table .dashboard-badge {
    padding: 4px 6px;
    font-size: 10px;
  }

  .dashboard-notifications-table .dashboard-link-btn {
    padding: 6px 7px;
    font-size: 11px;
  }

  .dashboard-notification-message-col,
  .dashboard-notification-message-cell {
    display: none;
  }

  .dashboard-notification-date-cell {
    width: 28%;
  }

  .dashboard-notification-type-cell {
    width: 24%;
  }

  .dashboard-notification-status-cell {
    width: 18%;
  }

  .dashboard-notification-action-cell {
    width: 16%;
  }

  .dashboard-notification-detail-actions,
  .notification-detail-actions-top {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-notification-detail-actions .dashboard-btn,
  .notification-detail-actions-top .dashboard-btn {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 9px;
    font-size: 12px;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .notification-filter-row {
    display: grid;
    grid-template-columns: 1fr 90px 80px;
    gap: 6px;
    align-items: end;
    padding: 10px;
  }

  .notification-filter-row .dashboard-filter-field label {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .notification-filter-row .dashboard-input {
    min-height: 36px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .notification-refresh-btn {
    min-height: 36px;
    padding: 0;
    font-size: 12px;
  }

  .dashboard-notifications-table .dashboard-link-btn {
    padding: 7px 10px;
    font-size: 12px;
  }
}

.notification-collapsible-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.notification-detail-grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.notification-detail-grid-compact.is-collapsed {
  display: none;
}

@media (max-width: 768px) {
  .notification-collapsible-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .notification-detail-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dashboard-notification-card-header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.dashboard-notification-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-priority-pill,
.dashboard-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.priority-normal {
  background: #5FE07C;
  color: #434B49;
}

.priority-high {
  background: #D5DA39;
  color: #434B49;
}

.priority-urgent {
  background: #FF8438;
  color: #FFFFFF;
}

.status-open {
  background: #258D3B;
  color: #FFFFFF;
}

.status-unread {
  background: #98962A;
  color: #FFFFFF;
}

.status-archived {
  background: #D64923;
  color: #FFFFFF;
}

.status-overdue {
  background: #AC455C;
  color: #FFFFFF;
}

.dashboard-notification-card.status-overdue {
  border: 2px solid #AC455C;
}

.dashboard-notification-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.dashboard-notification-message {
  margin-bottom: 18px;
  line-height: 1.5;
}

.dashboard-notification-meta {
  margin-bottom: 18px;
  color: #687373;
}

.dashboard-notification-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.dashboard-notification-footer-left {
  font-size: 14px;
  color: #687373;
}

.dashboard-notification-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
  gap: 18px;
  align-items: stretch;
}

.dashboard-notification-card {
  cursor: pointer;
  border: 1px solid #D9E6E6 !important;
  box-shadow: 0 4px 14px rgba(67, 75, 73, 0.06) !important;
  border-radius: 18px;
}

.dashboard-notification-card.status-border-overdue {
  border: 2px solid #AC455C !important;
}

.dashboard-notification-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-priority-pill,
.dashboard-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.priority-normal {
  background: #5FE07C;
  color: #434B49;
}

.priority-high {
  background: #D5DA39;
  color: #434B49;
}

.priority-urgent {
  background: #FF8438;
  color: #FFFFFF;
}

.status-open {
  background: #258D3B;
  color: #FFFFFF;
}

.status-unread {
  background: #98962A;
  color: #FFFFFF;
}

.status-archived {
  background: #D64923;
  color: #FFFFFF;
}

.status-overdue {
  background: #AC455C;
  color: #FFFFFF;
}

.status-response-needed {
  background: #AC455C;
  color: #FFFFFF;
}

.notification-archive-btn {
  background: #D64923;
  color: #FFFFFF;
  border: 1px solid #D64923;
}

.notification-archive-btn:hover {
  background: #B93D20;
  color: #FFFFFF;
}

.notification-collapsible-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.notification-detail-grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.notification-detail-grid-compact.is-collapsed {
  display: none;
}

@media (max-width: 768px) {
  .dashboard-notification-board {
    grid-template-columns: 1fr;
  }

  .notification-collapsible-head {
    flex-direction: column;
  }

  .notification-detail-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dashboard-notification-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.dashboard-notification-card {
  cursor: pointer;
  border: 1px solid #D9E6E6 !important;
  box-shadow: 0 4px 14px rgba(67, 75, 73, 0.06) !important;
  border-radius: 18px;
}

.dashboard-notification-board-archived {
  opacity: 0.88;
}

.dashboard-notification-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-notification-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
}

.dashboard-notification-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-priority-pill,
.dashboard-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.priority-normal {
  background: #5FE07C;
  color: #434B49;
}

.priority-high {
  background: #D5DA39;
  color: #434B49;
}

.priority-urgent {
  background: #FF8438;
  color: #FFFFFF;
}

.status-open {
  background: #258D3B;
  color: #FFFFFF;
}

.status-unread {
  background: #98962A;
  color: #FFFFFF;
}

.status-archived {
  background: #D64923;
  color: #FFFFFF;
}

.status-overdue {
  background: #AC455C;
  color: #FFFFFF;
}

.status-border-overdue {
  border: 2px solid #AC455C !important;
}

.status-border-archived {
  border: 2px solid #D64923 !important;
}

.dashboard-notification-meta {
  margin-bottom: 18px;
  color: #687373;
  font-size: 14px;
}

.dashboard-notification-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: auto;
}

.dashboard-notification-footer-left {
  font-size: 13px;
  color: #687373;
}

.notification-archive-btn {
  background: #D64923;
  color: #FFFFFF;
  border: 1px solid #D64923;
}

.notification-archive-btn:hover {
  background: #B93D20;
  color: #FFFFFF;
}

@media (max-width: 1200px) {
  .dashboard-notification-board {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-notification-board {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .dashboard-notification-board {
    grid-template-columns: 1fr;
  }

  .dashboard-notification-card-heading {
    flex-direction: column;
  }

  .dashboard-notification-pill-row {
    justify-content: flex-start;
  }
}

/* =========================================================
   NOTIFICATIONS MOBILE / COLLAPSE / MESSAGE FORMATTING
========================================================= */

.status-border-unread {
  border: 2px solid #007274 !important;
}

.dashboard-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-board-section.is-collapsed .dashboard-notification-board,
.dashboard-board-section.is-collapsed .dashboard-empty {
  display: none;
}

.dashboard-archived-section.is-collapsed .dashboard-notification-board,
.dashboard-archived-section.is-collapsed .dashboard-empty {
  display: none;
}

.notification-detail-grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.notification-original-message {
  white-space: pre-wrap;
  line-height: 1.6;
}

.notification-section-body.is-collapsed {
  display: none;
}

@media (max-width: 768px) {
  .dashboard-page-header {
    gap: 14px;
  }

  .dashboard-page-actions {
    flex-direction: row;
    justify-content: flex-start;
    width: 100%;
  }

  .dashboard-page-actions .dashboard-btn {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
  }

  .notification-detail-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Force notification header buttons side by side on mobile */
@media (max-width: 768px) {
  .dashboard-container .dashboard-page-header .dashboard-page-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .dashboard-container .dashboard-page-header .dashboard-page-actions .dashboard-btn {
    flex: 1 1 0 !important;
    width: 50% !important;
    max-width: none !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    font-size: 13px !important;
  }
}

/* =========================================================
   NOTIFICATION DETAIL IMPROVEMENTS
========================================================= */

.notification-detail-grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.notification-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notification-section-body.is-hidden {
  display: none;
}

.notification-original-message {
  white-space: pre-wrap;
  line-height: 1.6;
}

#notificationMessageText {
  white-space: pre-wrap;
  line-height: 1.7;
}

.notification-collapsible-head {
  align-items: flex-start;
}

.notification-collapsible-head .dashboard-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .notification-detail-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {

  .notification-section-head {
    flex-direction: row;
    align-items: center;
  }

  .notification-collapsible-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .notification-collapsible-head .dashboard-detail-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .notification-detail-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
