/* ═══════════════════════════════════════════════════════════════
   ehr_content.css — Page container, main content, footer
   Load order: 4
   ═══════════════════════════════════════════════════════════════ */

/* Page container — wraps header + main content */
.ehr-page-container {
    background: var(--ehr-wrapper-bg);
    margin-left: var(--ehr-sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--ehr-transition);
    position: relative;
}

/* When sidebar is collapsed */
.ehr-sidebar.collapsed ~ .ehr-page-container {
    margin-left: 0;
}

/* Main content area */
.ehr-main-content {
    padding-top: var(--ehr-header-height);
    padding-bottom: 1em;
    min-height: calc(100vh - var(--ehr-header-height));
    background: var(--ehr-page-bg);
}

/* Content frame — replaces old centered box. Full width, no gaps. */
.ehr-content-frame {
    background: #ffffff;
    padding: 16px;
    width: 100%;
}

/* Page content flex wrapper */
.ehr-page-content {
    display: flex;
    flex-flow: column;
    gap: 1em;
    width: 100%;
}

/* Footer */
.ehr-footer {
    padding: 16px 20px;
    color: var(--ehr-text-secondary);
    text-align: center;
    background: var(--ehr-page-bg);
}

/* ─── Mobile ─── */
@media (max-width: 980px) {
    .ehr-page-container {
        margin-left: 0;
    }

    .ehr-main-content {
        padding-top: var(--ehr-mobile-bar-height);
    }

    .ehr-content-frame {
        padding: 10px;
    }
}

/* Legacy .page-content — used by stable and other pages */
.page-content {
    display: flex;
    flex-flow: column;
    gap: 1em;
    width: 100%;
    padding: 2em;
    max-width: 1300px;
    margin: auto;

    container-type: inline-size;
    container-name: content;
}
.page-content-header {
  position: relative;
  margin-bottom: .5em;
}

.page-content-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  padding: .25em;
  position: relative;
}
.page-content-grid {
  display: flex;
  flex-direction: column;
  gap: 2em;
}

@media (max-width: 980px) {
    .page-content {
      padding: .5em;
      width: auto;
    }

  .page-content-grid.reverse {
      flex-direction: column;
  }
}

/* ─── Stable horse list fixes ─── */

/* Horse name + icons side-by-side (pencil/arrow next to name, not below) */
/* Horse name cell layout — flex to align icons/badges inline.
   :not([colspan]) excludes detail cells and expanded info cells
   (which have colspan and are also td:first-child in their row).
   The > combinator prevents matching TDs in nested tables. */
/* .stable_horse_list_table > tbody > tr > td:first-child:not([colspan]) {
    display: flex;
    align-items: center;
    gap: 6px;
} */
/* Horse name div — takes all available space, truncates when needed */
.stable_horse_list_table > tbody > tr > td:first-child:not([colspan]) > div:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
/* Icons div — pushed to far right, never shrinks */
.stable_horse_list_table > tbody > tr > td:first-child:not([colspan]) > div:last-child {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.stable_horse_list_table > tbody > tr {
  color: var(--ehr-text-primary);
  /* border-bottom: 1px solid var(--ehr-border); */
}
/* Alternating row colors for stable table.
   Each horse has 3 TRs: data row, expanded-info row, detail row.
   6n cycle alternates color every other horse:
   Rows 1-3 (horse 1): white,  Rows 4-6 (horse 2): grey,
   Rows 7-9 (horse 3): white,  Rows 10-12 (horse 4): grey, etc.
   Detail rows get white override from .stable_horse_list_horse_detail_row rule. */
.stable_horse_list_table > tbody > tr:nth-child(6n+1),
.stable_horse_list_table > tbody > tr:nth-child(6n+2),
.stable_horse_list_table > tbody > tr:nth-child(6n+3) { background-color: var(--ehr-table-row-bg); }
.stable_horse_list_table > tbody > tr:nth-child(6n+4),
.stable_horse_list_table > tbody > tr:nth-child(6n+5),
.stable_horse_list_table > tbody > tr:nth-child(6n+6) { background-color: var(--ehr-table-row-alt-bg); }

/* My Stable: 3 rows per horse. Scoped so it skips Entries (.hidden-1, 4 rows per entry). */
/* Entries: one divider per entry, on the visible first row only */
.stable_horse_list_table.hidden-1 > tbody > tr > td {
  border-bottom: 0;
  box-shadow: none;
}
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(4n+1) > td {
  box-shadow: inset 0 -1px 0 var(--ehr-row-divider);
}
/* end */

/* Alternating row colors for entries table. */
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+1),
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+2),
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+3),
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+4) {
    background-color: var(--ehr-table-row-bg);
}
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+5),
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+6),
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+7),
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(8n+8) {
    background-color: var(--ehr-table-row-alt-bg);
}

/* Entries: 4 rows per entry. Was unscoped, which also highlighted the wrong rows on My Stable. */
/* plain rows (no surface tint): theme hover colour */
.stable_horse_list_table.hidden-1 > tbody > tr:nth-child(4n+1):not([class*="horsepage_pprow_"]):not([class*="-mkw"]):hover {
    background-color: var(--ehr-hover-bg) !important;
}

/* tinted rows: keep their own colour and darken it slightly */
@media (hover: hover) {
  .stable_horse_list_table.hidden-1 > tbody > tr:nth-child(4n+1)[class*="horsepage_pprow_"]:hover,
  .stable_horse_list_table.hidden-1 > tbody > tr:nth-child(4n+1)[class*="-mkw"]:hover {
      background-image: linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18)) !important;
  }
}
/* end */


/* Stable expanded info — hide entire row by default, show when JS toggles */
tr:has(> td > .stable_horse_list_expanded_info) {
    display: none;
}
tr:has(> td > .stable_horse_list_expanded_info.stable_horse_list_show) {
    display: table-row;
}
.stable_horse_list_expanded_info {
    display: none !important;
}
.stable_horse_list_expanded_info.stable_horse_list_show {
    display: block !important;
}

/* .stable_horse_list_table > tbody > tr > td.entered:before {
  content: "";
  border-left: 5px solid green;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
} */