/* MOBILE ONLY: BuddyPress Profile > Notifications (Perfect Fit) */
@media (max-width: 768px) {

  /* 1) Give the content a bit more room on this screen */
  body.buddypress.bp-user.notifications #page,
  body.buddypress.bp-user.notifications #primary,
  body.buddypress.bp-user.notifications #content,
  body.buddypress.bp-user.notifications .site-content,
  body.buddypress.bp-user.notifications .content-wrap,
  body.buddypress.bp-user.notifications .content-container,
  body.buddypress.bp-user.notifications .entry-content-wrap,
  body.buddypress.bp-user.notifications .entry-content,
  body.buddypress.bp-user.notifications #buddypress,
  body.buddypress.bp-user.notifications #buddypress .bp-wrap,
  body.buddypress.bp-user.notifications #buddypress .bp-screen-content,
  body.buddypress.bp-user.notifications #buddypress .item-body {
    max-width: 100% !important;
    width: 100% !important;
  }

  body.buddypress.bp-user.notifications .content-wrap,
  body.buddypress.bp-user.notifications .entry-content-wrap,
  body.buddypress.bp-user.notifications .entry-content {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* 2) Table: lock layout so columns cannot overflow */
  body.buddypress.bp-user.notifications #buddypress table.notifications,
  body.buddypress.bp-user.notifications #buddypress table.notifications.bp-tables-user {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse;
  }

  /* 3) Tighter typography */
  body.buddypress.bp-user.notifications #buddypress table.notifications th,
  body.buddypress.bp-user.notifications #buddypress table.notifications td {
    font-size: 10px !important;
    line-height: 1.15 !important;
    padding: 4px 3px !important;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 4) Column sizing using nth-child (reliable even if BP doesn't add classes) */
  /* Column 1: empty/indicator column */
  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(1),
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(1) {
    width: 0px !important;
    padding: 0 !important;
  }

  /* Column 2: checkbox */
  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(2),
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(2) {
    width: 28px !important;
    text-align: center;
  }

  /* Column 4: Date Received (narrow + header wraps to 2 lines) */
  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(4),
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(4) {
    width: 54px !important;
    text-align: center;
    white-space: nowrap;
  }

  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(4) {
    white-space: normal !important;
    line-height: 1.05 !important;
    letter-spacing: -0.2px;
    word-break: break-word;
  }

  /* Column 5: Actions */
  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(5),
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(5) {
    width: 46px !important;
    text-align: center;
    white-space: nowrap;
  }

  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(5) {
    white-space: normal !important;
    line-height: 1.05 !important;
    word-break: break-word;
  }

  /* Column 3: Notification description wraps */
  body.buddypress.bp-user.notifications #buddypress table.notifications thead th:nth-child(3),
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(3) {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word;
  }

  /* 5) Shrink action icons/buttons */
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(5) a,
  body.buddypress.bp-user.notifications #buddypress table.notifications tbody td:nth-child(5) button {
    transform: scale(0.75);
    transform-origin: center;
    display: inline-block;
  }

  body.buddypress.bp-user.notifications #buddypress table.notifications input[type="checkbox"] {
    transform: scale(0.9);
    transform-origin: center;
  }

  /* 6) Safety: prevent clipping */
  body.buddypress.bp-user.notifications #buddypress .bp-screen-content,
  body.buddypress.bp-user.notifications #buddypress .item-body,
  body.buddypress.bp-user.notifications .content-wrap {
    overflow-x: visible !important;
  }
}
