/*
 * LIVE_RACING_002BN — Shared evidence-page command system and Horse Profile
 * responsive/readability refinement.
 *
 * Scope:
 *   - Horse Profile
 *   - Trainer Stats
 *   - Jockey Stats
 *   - Sire Stats
 *   - Dam-sire Stats
 *   - Draw Stats command header only
 *
 * No application grid, sidebar, racecard, endpoint, evidence calculation or
 * exclusion-state changes.
 */

/* ========================================================================
   SHARED COMMAND HEADER — direct buttons, no nested action card
   ======================================================================== */
#liveHorseFormModal:is(
  .is-horse-profile,
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-modal-header{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  column-gap:24px!important;
  row-gap:10px!important;
}
#liveHorseFormModal:is(
  .is-horse-profile,
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-title-block{
  align-self:center!important;
  min-width:0!important;
  text-align:left!important;
}
#liveHorseFormModal:is(
  .is-horse-profile,
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-actions{
  align-self:center!important;
  justify-self:end!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:7px!important;
  flex-wrap:nowrap!important;
  width:auto!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  -webkit-backdrop-filter:none!important;
  backdrop-filter:none!important;
}
#liveHorseFormModal:is(
  .is-horse-profile,
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-actions button{
  flex:0 0 auto!important;
}

/* ========================================================================
   SIRE / DAM-SIRE — descriptive column left; numeric columns centred
   ======================================================================== */
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-section-stack{
  width:min(100%,2200px)!important;
  margin-inline:auto!important;
}
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact thead tr:first-child th:first-child,
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact tbody th{
  text-align:left!important;
}
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact thead tr:first-child th:first-child{
  padding-left:15px!important;
}
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact tbody th{
  padding-left:15px!important;
}
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact .horse-profile-stat-label,
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact tbody th small{
  margin-left:0!important;
  margin-right:0!important;
  text-align:left!important;
}
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact tbody td,
#liveHorseFormModal:is(.is-sire-stats,.is-dam-sire-stats) .sire-stats-table-compact thead tr:nth-child(2) th{
  text-align:center!important;
}

/* ========================================================================
   TRAINER / JOCKEY — full-row Strong / Weak semantics from existing rules
   ======================================================================== */
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-strong-today{
  border-color:rgba(38,179,120,.30)!important;
  background:linear-gradient(90deg,rgba(226,250,239,.98),rgba(239,253,247,.94))!important;
  box-shadow:inset 5px 0 0 #34b985,0 8px 20px rgba(22,109,78,.055),inset 0 1px 0 rgba(255,255,255,.78)!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-strong-today .trainer-stat-row-main :is(span,strong){
  color:#0b674f!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-strong-today .trainer-stat-metrics div{
  border-color:rgba(38,179,120,.18)!important;
  background:rgba(247,255,251,.78)!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-strong-today .trainer-stat-metrics .is-focus strong{
  color:#086a55!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-weak-today{
  border-color:rgba(230,85,126,.30)!important;
  background:linear-gradient(90deg,rgba(255,233,240,.98),rgba(255,244,247,.94))!important;
  box-shadow:inset 5px 0 0 #e65b82,0 8px 20px rgba(144,44,73,.055),inset 0 1px 0 rgba(255,255,255,.78)!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-weak-today .trainer-stat-row-main :is(span,strong){
  color:#9a2f54!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-weak-today .trainer-stat-metrics div{
  border-color:rgba(230,85,126,.18)!important;
  background:rgba(255,249,251,.78)!important;
}
#liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card.is-weak-today .trainer-stat-metrics .is-focus strong{
  color:#a22d56!important;
}

/* ========================================================================
   HORSE PROFILE — bounded table, responsive Stats Check, shared semantics
   ======================================================================== */
#liveHorseFormModal.is-horse-profile .horse-profile-evidence{
  width:min(100%,2200px)!important;
  margin-inline:auto!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-section-stack{
  width:100%!important;
  margin-inline:auto!important;
  gap:13px!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-section-card{
  border-radius:18px!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-section-card > header{
  min-height:44px!important;
  padding:9px 13px!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-table-wrap{
  overflow:auto!important;
  scrollbar-width:thin!important;
  scrollbar-color:rgba(80,104,190,.34) transparent!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2{
  width:100%!important;
  min-width:1320px!important;
  table-layout:fixed!important;
  border-collapse:separate!important;
  border-spacing:0!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 col.hp-col-check{width:22%!important;}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 col.hp-col-metric{width:5%!important;}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 col.hp-col-delta{width:8%!important;}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 thead tr:first-child th:first-child,
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 tbody th{
  text-align:left!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 thead tr:first-child th:first-child{
  padding-left:14px!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 tbody th{
  position:sticky!important;
  left:0!important;
  z-index:2!important;
  padding:9px 12px 9px 14px!important;
  box-shadow:1px 0 0 rgba(85,107,193,.12)!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 .horse-profile-stat-label{
  display:block!important;
  margin:0 0 3px!important;
  color:#15253e!important;
  font-size:12.5px!important;
  line-height:1.18!important;
  font-weight:900!important;
  text-align:left!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 tbody th small{
  display:block!important;
  color:#71839b!important;
  font-size:9.7px!important;
  line-height:1.22!important;
  font-weight:620!important;
  text-align:left!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 tbody td,
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 thead tr:nth-child(2) th{
  text-align:center!important;
  vertical-align:middle!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 tbody td{
  height:52px!important;
  padding:8px 4px!important;
  font-size:11.5px!important;
  font-variant-numeric:tabular-nums!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 :is(.hp-cell-win-pct,.hp-cell-ae,.hp-cell-wve,.hp-delta-single){
  font-size:12px!important;
  font-weight:900!important;
}

/* Existing Horse Profile Strong Today / Weak Today logic marks the full row. */
#liveHorseFormModal.is-horse-profile .horse-profile-stat-row.is-strong-today > :is(th,td){
  color:#124f42!important;
  background:linear-gradient(90deg,rgba(226,250,239,.98),rgba(239,253,247,.95))!important;
  border-top-color:rgba(31,170,116,.23)!important;
  border-bottom-color:rgba(31,170,116,.23)!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-row.is-strong-today > th{
  box-shadow:inset 5px 0 0 #34b985,1px 0 0 rgba(85,107,193,.10)!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-row.is-strong-today :is(.horse-profile-stat-label,.hp-cell-win-pct,.hp-cell-ae,.hp-cell-wve,.hp-delta-single){
  color:#086a55!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-row.is-weak-today > :is(th,td){
  color:#7e3148!important;
  background:linear-gradient(90deg,rgba(255,233,240,.98),rgba(255,244,247,.95))!important;
  border-top-color:rgba(230,85,126,.24)!important;
  border-bottom-color:rgba(230,85,126,.24)!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-row.is-weak-today > th{
  box-shadow:inset 5px 0 0 #e65b82,1px 0 0 rgba(85,107,193,.10)!important;
}
#liveHorseFormModal.is-horse-profile .horse-profile-stat-row.is-weak-today :is(.horse-profile-stat-label,.hp-cell-win-pct,.hp-cell-ae,.hp-cell-wve,.hp-delta-single){
  color:#a22d56!important;
}

/* ========================================================================
   VIEWPORT MATRIX
   ======================================================================== */
@media(max-width:1200px){
  #liveHorseFormModal:is(
    .is-horse-profile,
    .is-trainer-stats,
    .is-jockey-stats,
    .is-sire-stats,
    .is-dam-sire-stats,
    .is-draw-stats
  ) .horse-drilldown-modal-header{
    grid-template-columns:1fr!important;
    align-items:start!important;
  }
  #liveHorseFormModal:is(
    .is-horse-profile,
    .is-trainer-stats,
    .is-jockey-stats,
    .is-sire-stats,
    .is-dam-sire-stats,
    .is-draw-stats
  ) .horse-drilldown-actions{
    justify-self:start!important;
    justify-content:flex-start!important;
    flex-wrap:wrap!important;
  }
}
@media(max-width:900px){
  #liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2{
    min-width:1240px!important;
  }
  #liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 col.hp-col-check{width:20%!important;}
  #liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 col.hp-col-metric{width:5.15%!important;}
  #liveHorseFormModal.is-horse-profile .horse-profile-stat-table.hp-comparison-table-v2 col.hp-col-delta{width:7.9%!important;}
}
@media(prefers-reduced-motion:reduce){
  #liveHorseFormModal:is(
    .is-horse-profile,
    .is-trainer-stats,
    .is-jockey-stats,
    .is-sire-stats,
    .is-dam-sire-stats,
    .is-draw-stats
  ) .horse-drilldown-actions button,
  #liveHorseFormModal:is(.is-trainer-stats,.is-jockey-stats) .trainer-stat-row-card{
    transition:none!important;
  }
}
