/* -------------------------------------------------------
   4. SECTION B: OWNER DEFAULTS (owner-only)
   
   Shown only when passVars.isOwner is true.
   Contains: riding style controls, entry defaults, save btn
   ------------------------------------------------------- */
.horsepage_owner_section {
  background: var(--hp-card-bg);
  padding: var(--hp-pad);
  border-radius: var(--hp-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: var(--hp-gap);
  border-left: 4px solid var(--hp-green);
}

.horsepage_owner_title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--hp-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.horsepage_owner_grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--hp-gap);
  align-items: end;
}

.horsepage_control_group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.horsepage_control_row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.horsepage_control_label {
  min-width: 90px;
  font-weight: 600;
  font-size: 13px;
}

.horsepage_control_input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-sm);
  font-size: 13px;
  font-family: var(--hp-font);
}

.horsepage_entry_defaults {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.horsepage_entry_title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.horsepage_checkbox_row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.horsepage_checkbox_item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
}

.horsepage_checkbox_item input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.horsepage_save_btn {
  padding: 8px 20px;
  background: var(--hp-green);
  color: white;
  border: none;
  border-radius: var(--hp-radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--hp-font);
  transition: background 0.2s;
  align-self: flex-end;
}

.horsepage_save_btn:hover {
  background: var(--hp-green-dark);
}

/* -------------------------------------------------------
   5. SECTION C: PAST PERFORMANCES (public)
   
   Uses <table> with progressive column hiding via 
   horsepage_hide_XXX utility classes. Expand button reveals
   hidden data on small screens.
   ------------------------------------------------------- */
.horsepage_pps_section {
  background: var(--hp-card-bg);
  border-radius: var(--hp-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: var(--hp-gap);
  overflow: hidden;        /* NEVER side scroll */
}

.horsepage_pps_title {
  font-size: 14px;
  font-weight: 700;
  padding: 10px var(--hp-pad);
  border-bottom: 1px solid var(--hp-border);
  color: var(--hp-text);
}

.horsepage_pps_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;     /* Let columns size to content; hide classes handle responsiveness */
}

.horsepage_pps_table thead {
  background: #0c420c !important;
  color: white !important;
  position: sticky;
  top: 0;
  z-index: 10;
}

.horsepage_pps_table th {
  padding: 10px 6px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.2);
  background: #0c420c !important;
  color: white !important;
}

.horsepage_pps_table th:last-child {
  border-right: none;
}

.horsepage_pps_table td {
  padding: 8px 3px;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horsepage_pps_table tbody tr {
  transition: background 0.15s;
}

.horsepage_pps_table tbody tr:hover {
  filter: brightness(0.96);
}

/* PP row background colors — surface-based striping.
   HTML emits horsepage_pprow_dirt / surf_dirt-mkw etc.
   The old class names (yellow/green/purple) didn't match HTML output.
   Legacy color-name aliases kept at bottom for any old templates. */

/* Dirt fast — light yellow */
.horsepage_pprow_dirt,
.surf_dirt-mkw         { background: #fff9c4 !important; }

/* Dirt off/other — darker yellow */
.horsepage_pprow_dirtoff,
.surf_dirtoff-mkw      { background: #ffe082 !important; }

/* Turf firm — light green */
.horsepage_pprow_turf,
.surf_turf-mkw         { background: #c8e6c9 !important; }

/* Turf off/good/soft — darker green */
.horsepage_pprow_turfoff,
.surf_turfoff-mkw      { background: #81c784 !important; }

/* Turf yielding — peach */
.horsepage_pprow_turfyld,
.surf_turfyld-mkw      { background: #f2d6c1 !important; }

/* Poly — purple */
.horsepage_pprow_poly,
.surf_poly-mkw         { background: #ce93d8 !important; }

/* Poly off — blue */
.horsepage_pprow_polyoff,
.surf_polyoff-mkw      { background: #90caf9 !important; }

/* Legacy color-name aliases (backward compat) */
.horsepage_pprow_yellow     { background: #fff9c4 !important; }
.horsepage_pprow_darkyellow,
.surf_darkyellow-mkw        { background: #ffe082 !important; }
.horsepage_pprow_green,
.surf_green-mkw             { background: #c8e6c9 !important; }
.horsepage_pprow_darkgreen,
.surf_darkgreen-mkw         { background: #81c784 !important; }
.horsepage_pprow_peach,
.surf_peach-mkw             { background: #f2d6c1 !important; }
.horsepage_pprow_purple,
.surf_purple-mkw            { background: #ce93d8 !important; }
.horsepage_pprow_blue,
.surf_blue-mkw              { background: #90caf9 !important; }
.surf_yellow-mkw            { background: #fff9c4 !important; }

/* === PP CELL BADGE COLORS ===
   Individual cells get colored backgrounds for quick visual scanning.
   Applied to <span> elements inside <td>. */

/* Shared badge base styles */
.horsepage_cell_sex_m,
.horsepage_cell_sex_f,
.horsepage_cell_age_2,
.horsepage_cell_age_3,
.horsepage_cell_age_3p,
.horsepage_cell_age_4p,
.horsepage_cell_surf_dfst,
.horsepage_cell_surf_dother,
.horsepage_cell_surf_tfrm,
.horsepage_cell_surf_tyld,
.horsepage_cell_surf_tother,
.horsepage_cell_surf_poly,
.horsepage_cell_rtype_a,
.horsepage_cell_rtype_c,
.horsepage_cell_rtype_mc,
.horsepage_cell_rtype_m,
.horsepage_cell_rtype_s,
.horsepage_cell_rtype_st,
.horsepage_cell_rtype_g1,
.horsepage_cell_rtype_g2,
.horsepage_cell_rtype_g3,
.horsepage_cell_rtype_o {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  min-width: 18px;
}

/* Sex badges */
.horsepage_cell_sex_m { background: #5b9bd5; color: white; }
.horsepage_cell_sex_f { background: #e57398; color: white; }

/* Age badges */
.horsepage_cell_age_2  { background: #7e57c2; color: white; }
.horsepage_cell_age_3  { background: #26a69a; color: white; }
.horsepage_cell_age_3p { background: #66bb6a; color: #000; }
.horsepage_cell_age_4p { background: #42a5f5; color: white; }

/* Surface/Condition badges */
.horsepage_cell_surf_dfst   { background: #a1887f; color: white; }
.horsepage_cell_surf_dother { background: #6d4c41; color: white; }
.horsepage_cell_surf_tfrm   { background: #81c784; color: #000; }
.horsepage_cell_surf_tyld   { background: #8d6e63; color: white; }
.horsepage_cell_surf_tother { background: #2e7d32; color: white; }
.horsepage_cell_surf_poly   { background: #7e57c2; color: white; }

/* Race Type badges */
.horsepage_cell_rtype_a            { background: #ef5350; color: white; }
.horsepage_cell_rtype_c,
.horsepage_cell_rtype_mc           { background: #8d6e63; color: white; }
.horsepage_cell_rtype_m            { background: #ff7043; color: white; }
.horsepage_cell_rtype_s,
.horsepage_cell_rtype_st           { background: #fdd835; color: #333; }
.horsepage_cell_rtype_g1,
.horsepage_cell_rtype_g2,
.horsepage_cell_rtype_g3           { background: #ab47bc; color: white; }
.horsepage_cell_rtype_o            { background: #26a69a; color: white; }

/* Pedigree position badges — S / DS / DDS */
.horsepage_ped_badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  min-width: 22px;
  margin-right: 4px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}
.horsepage_ped_badge_s   { background: #0c420c; color: #fff; }
.horsepage_ped_badge_ds  { background: #1565c0; color: #fff; }
.horsepage_ped_badge_dds { background: #6a1b9a; color: #fff; }

/* Generic fallbacks (backward compat) */
.horsepage_cell_blue   { background: #5b9bd5; color: white; font-weight: 700; border-radius: 3px; }
.horsepage_cell_green  { background: #66bb6a; color: #000; font-weight: 700; border-radius: 3px; }
.horsepage_cell_teal   { background: #26a69a; color: white; font-weight: 700; border-radius: 3px; }
.horsepage_cell_brown  { background: #8d6e63; color: white; font-weight: 700; border-radius: 3px; }
.horsepage_cell_red    { background: #ef5350; color: white; font-weight: 700; border-radius: 3px; }

/* Superscript in PP cells */
.horsepage_sup {
  font-size: 0.7em;
  vertical-align: super;
  margin-left: 1px;
}

/* PP icons (3D, video, chart) */
.horsepage_pp_icons {
  display: flex;
  gap: 2px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}

.horsepage_pp_icon {
  width: 20px;
  height: 20px;
  border: 1px solid #999;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  flex-shrink: 0;
}

.horsepage_pp_icon_3d    { background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%); color: white; }
.horsepage_pp_icon_video { background: #666; color: white; }
.horsepage_pp_icon_chart { background: #e0e0e0; color: #333; }

/* Expand/collapse button */
.horsepage_pp_expand_cell {
  width: 40px;
  min-width: 40px;
  padding: 4px !important;
}

.horsepage_pp_expand_btn {
  background: var(--hp-yellow);
  border: none;
  padding: 3px 6px;
  font-weight: 700;
  border-radius: var(--hp-radius-sm);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  width: 100%;
}

.horsepage_pp_expand_btn:hover {
  background: #ffcd38;
}

/* Expanded detail row */
.horsepage_pp_detail_row {
  display: none;
  background: #f8f8f0 !important;
}

.horsepage_pp_detail_row.horsepage_show {
  display: table-row;
}

.horsepage_pp_detail_row td {
  padding: 10px 12px !important;
  text-align: left !important;
  border-bottom: 2px solid #ccc;
}

.horsepage_pp_detail_grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}

.horsepage_pp_detail_item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px 8px;
  border-left: 3px solid var(--hp-green);
}

.horsepage_pp_detail_label {
  font-weight: 700;
  color: var(--hp-text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.horsepage_pp_detail_value {
  font-weight: 600;
  font-size: 13px;
  color: var(--hp-text);
}

/* Color-coded left borders for specific detail cards */
.horsepage_pp_detail_item_track  { border-left-color: #4a90e2; }
.horsepage_pp_detail_item_dist   { border-left-color: #ff9800; }
.horsepage_pp_detail_item_time   { border-left-color: #607d8b; }
.horsepage_pp_detail_item_speed  { border-left-color: #e53935; }
.horsepage_pp_detail_item_odds   { border-left-color: #fdd835; }
.horsepage_pp_detail_item_jockey { border-left-color: #ab47bc; }

/* Detail cards that get FULL colored value badges (matching table cells) */
.horsepage_pp_detail_item_sex    { border-left-color: #5b9bd5; }
.horsepage_pp_detail_item_sex .horsepage_pp_detail_value {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 12px;
}
.horsepage_pp_detail_item_sex.horsepage_dv_m .horsepage_pp_detail_value {
  background: #5b9bd5; color: white;
}
.horsepage_pp_detail_item_sex.horsepage_dv_f .horsepage_pp_detail_value {
  background: #e57398; color: white;
}

.horsepage_pp_detail_item_age { border-left-color: #26a69a; }
.horsepage_pp_detail_item_age .horsepage_pp_detail_value {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 12px;
}
.horsepage_pp_detail_item_age.horsepage_dv_2 .horsepage_pp_detail_value   { background: #7e57c2; color: white; }
.horsepage_pp_detail_item_age.horsepage_dv_3 .horsepage_pp_detail_value   { background: #26a69a; color: white; }
.horsepage_pp_detail_item_age.horsepage_dv_3p .horsepage_pp_detail_value  { background: #66bb6a; color: #000; }
.horsepage_pp_detail_item_age.horsepage_dv_4p .horsepage_pp_detail_value  { background: #42a5f5; color: white; }

.horsepage_pp_detail_item_surf { border-left-color: #8d6e63; }
.horsepage_pp_detail_item_surf .horsepage_pp_detail_value {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 12px;
}
.horsepage_pp_detail_item_surf.horsepage_dv_dfst .horsepage_pp_detail_value   { background: #a1887f; color: white; }
.horsepage_pp_detail_item_surf.horsepage_dv_dother .horsepage_pp_detail_value { background: #6d4c41; color: white; }
.horsepage_pp_detail_item_surf.horsepage_dv_tfrm .horsepage_pp_detail_value   { background: #81c784; color: #000; }
.horsepage_pp_detail_item_surf.horsepage_dv_tyld .horsepage_pp_detail_value   { background: #8d6e63; color: white; }
.horsepage_pp_detail_item_surf.horsepage_dv_tother .horsepage_pp_detail_value { background: #2e7d32; color: white; }
.horsepage_pp_detail_item_surf.horsepage_dv_poly .horsepage_pp_detail_value   { background: #7e57c2; color: white; }

.horsepage_pp_detail_item_rtype { border-left-color: #ef5350; }
.horsepage_pp_detail_item_rtype .horsepage_pp_detail_value {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 12px;
}
.horsepage_pp_detail_item_rtype.horsepage_dv_a .horsepage_pp_detail_value  { background: #ef5350; color: white; }
.horsepage_pp_detail_item_rtype.horsepage_dv_c .horsepage_pp_detail_value  { background: #8d6e63; color: white; }
.horsepage_pp_detail_item_rtype.horsepage_dv_mc .horsepage_pp_detail_value { background: #8d6e63; color: white; }
.horsepage_pp_detail_item_rtype.horsepage_dv_m .horsepage_pp_detail_value  { background: #ff7043; color: white; }
.horsepage_pp_detail_item_rtype.horsepage_dv_s .horsepage_pp_detail_value  { background: #fdd835; color: #333; }
.horsepage_pp_detail_item_rtype.horsepage_dv_o .horsepage_pp_detail_value  { background: #26a69a; color: white; }
.horsepage_pp_detail_item_rtype.horsepage_dv_g .horsepage_pp_detail_value  { background: #ab47bc; color: white; }

