/* JR — Memory Entry Gap Shrink (Mobile)
   Goal: remove the huge empty gap below the table area and above the Delete Memory button.
   Scoped to BuddyPress memory table pages.
*/

@media (max-width: 900px) {
  /* Safety scope: only on your memory pages where you add the jr-memory-page class */
  body.jr-memory-page #bp-memory-form-wrapper #memory-forms-container {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  /* The wrapper that is showing an oversized height in your debug overlay */
  body.jr-memory-page #bp-memory-form-wrapper #memory-forms-container .memory-entry {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
  }

  /* Any direct child div inside .memory-entry (your DOM shows a generic <div> wrapper) */
  body.jr-memory-page #bp-memory-form-wrapper #memory-forms-container .memory-entry > div {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
  }

  /* The table container itself (your purple debug box) */
  body.jr-memory-page #bp-memory-form-wrapper #memory-forms-container .memory-entry .table-container {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Keep the row button tight */
  body.jr-memory-page #bp-memory-form-wrapper #memory-forms-container .add-row-btn {
    margin-bottom: 8px !important;
  }

  /* Bring Delete Memory up (it has inline margin-top:10px already; this also prevents extra margins elsewhere) */
  body.jr-memory-page #bp-memory-form-wrapper #memory-forms-container .delete-memory-btn {
    margin-top: 12px !important;
    margin-bottom: 0 !important;
  }
}
