/* =============================================================================
   ehr_style_16_horsetags.css -- horse tags                           2026-11-04

   HORSETAGS_20261104 (run list 569, phase 1, level 999 only). Three places:
     1. Stables -> #tags (stable_tags.j2, stable_tags_horses.j2): make, edit and delete tags, and the horses of a tag.
     2. The "#my" chip group first in the stable Filter panel (stable_tags_my.j2). It uses the chip grid of
        ehr_legacy_01_base.css (.temp-tag-grid); only the held chip is styled here.
     3. The owner's tag line on the horse page (horsepage_tags.jinja): remove, and add from its list (575).
   Behaviour: js/incJS_19_horsetags.js. Loaded from wrappers/topwrapper.j2 with ?v=575 (569 before).

   Built on the kit (ehr_kit.css: pg_card, pg_btn, pg_in, pg_note ...) and the theme tokens of ehr_base.css, so main,
   derby, dark and light all work with no theme lines here. Class prefix ht_ throughout so nothing here reaches
   another screen. Lists are flex rows, never tables: nothing scrolls sideways at 390 px.
   Held tags and chips (a level drop): lower opacity, cursor not-allowed.
   ============================================================================= */

/* The hidden attribute must win over the display rules below (the edit, delete and horse rows open by removing it). */
.ht_page [hidden], .ht_hp [hidden] { display: none !important; }

/* ---- answers (role="status"): empty = takes no room ---------------------------------------------------------------- */
.ht_msg:empty { display: none; }
.ht_msg {
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--pg-info-border);
  border-left-width: 4px;
  background: var(--pg-info-bg);
  color: var(--pg-info-text);
  font-size: 12.5px;
  line-height: 1.45;
}
.ht_msg.ht_msg_ok  { border-color: var(--pg-ok-border);  background: var(--pg-ok-bg);  color: var(--pg-ok-text); }
.ht_msg.ht_msg_bad { border-color: var(--pg-bad-border); background: var(--pg-bad-bg); color: var(--pg-bad-text); }
.ht_msg_top { margin: 0 0 var(--pg-gap); }

/* ---- 1. the #tags page --------------------------------------------------------------------------------------------- */
.ht_form {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: end;
}
.ht_f_btn { display: flex; gap: 6px; flex-wrap: wrap; }
.ht_rules { margin-top: 6px; line-height: 1.45; }
.ht_maxnote { margin-top: 8px; }

.ht_list { display: flex; flex-direction: column; }
.ht_item { border-bottom: 1px solid var(--ehr-border); }
.ht_item:last-child { border-bottom: 0; }
.ht_row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 8px 12px;
}
.ht_tagbtn {
  padding: 3px 12px;
  border: 1px solid var(--ehr-border-strong);
  border-radius: var(--pg-radius-pill);
  background: var(--ehr-surface-subtle);
  color: var(--ehr-text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.ht_tagbtn:hover { border-color: var(--ehr-theme-accent); }
.ht_tagbtn[aria-expanded="true"] {
  background: var(--ehr-theme-accent);
  border-color: var(--ehr-text-primary);
  color: var(--ehr-theme-on-accent);
}
.ht_descr { flex: 1 1 160px; min-width: 0; color: var(--ehr-text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.ht_count { color: var(--ehr-text-secondary); font-size: 12px; white-space: nowrap; }
.ht_actions { display: flex; gap: 6px; margin-left: auto; }

.ht_held .ht_tagbtn, .ht_held .ht_descr, .ht_held .ht_count { opacity: 0.6; }
.ht_held .ht_row { cursor: not-allowed; }
.ht_held .ht_row button { cursor: pointer; }   /* the tag can still be opened, renamed and deleted */
.ht_heldwhy { padding: 0 12px 8px; }

.ht_sub { padding: 8px 12px 12px; background: var(--ehr-surface-subtle); border-top: 1px dashed var(--ehr-border-strong); }
.ht_del { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.ht_del .ht_msg { flex-basis: 100%; }
.ht_del_q { font-weight: 600; }
.ht_del_btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* the horse list of one tag */
.ht_hl_head { margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--ehr-text-secondary); }
.ht_hl_list { margin: 0 0 10px; padding: 0; list-style: none; border: 1px solid var(--ehr-border); background: var(--ehr-surface-bg); }
.ht_hl_row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--ehr-border);
  font-size: 13px;
}
.ht_hl_row:last-child { border-bottom: 0; }
.ht_hl_row:nth-child(even) { background: var(--ehr-table-row-alt-bg); }
.ht_hl_name { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.ht_hl_meta { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ht_hl_age { min-width: 1.5em; text-align: right; color: var(--ehr-text-secondary); }
.ht_hl_stable { flex: 0 1 160px; min-width: 0; color: var(--ehr-text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.ht_hl_rm { margin-left: auto; }
.ht_hl_none { margin-bottom: 10px; }
.ht_hl_addrow { display: flex; gap: 8px; align-items: center; }
.ht_hl_sel { flex: 1 1 auto; min-width: 0; max-width: 420px; }
.ht_hl_why { margin-top: 4px; }

.ht_busy { opacity: 0.6; cursor: progress !important; }

@media (max-width: 560px) {
  .ht_form { grid-template-columns: minmax(0, 1fr); }
  .ht_row { padding: 8px 10px; }
  .ht_descr { flex-basis: 100%; order: 3; }
  .ht_actions { order: 4; margin-left: 0; }
  .ht_count { margin-left: auto; }
  .ht_sub { padding: 8px 10px 10px; }
  .ht_hl_stable { flex-basis: 100%; order: 3; }
  .ht_hl_rm { order: 2; }
}

/* ---- 2. the "#my" chips in the stable Filter panel ----------------------------------------------------------------- */
/* A held chip cannot be picked (no id, no data-act). Dashed and faded, and the hover tint is turned off. */
.temp-tag-grid .ht_chip_held a,
.temp-tag-grid .ht_chip_held a:hover {
  opacity: 0.5;
  border-style: dashed;
  background: var(--ehr-surface-bg);
  border-color: var(--ehr-border-strong);
  cursor: not-allowed;
}

/* ---- 3. the horse page tag line (owner: remove, and add from the list since 575) ---------------------------------- */
/* it sits right under the Horse Settings panel (horsepage_defaults.jinja), so it takes that panel's padding and fill */
.ht_hp { margin: calc(-1 * var(--hp-gap, 1em)) 0 var(--hp-gap, 1em); padding: 4px var(--hp-pad, 1em) 12px; background: var(--ehr-surface-bg); }
.ht_hp_line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ht_hp_chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px 1px 10px;
  border: 1px solid var(--ehr-border-strong);
  border-radius: var(--pg-radius-pill);
  background: var(--ehr-surface-subtle);
  color: var(--ehr-text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.ht_hp_chip.ht_held { opacity: 0.55; border-style: dashed; cursor: not-allowed; }
.ht_hp_x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ehr-text-secondary);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.ht_hp_x:hover, .ht_hp_x:focus-visible { background: var(--pg-bad-bg); color: var(--pg-neg); outline: none; }
.ht_hp_chip.ht_held .ht_hp_x { cursor: pointer; }
.ht_hp_none { font-size: 12.5px; }
.ht_hp_hint { margin-top: 4px; }
/* HTAGHPADD_20261105 (run list 575): the add list, a pill the height of a chip; it wraps under the chips on a phone */
.ht_hp_add {
  max-width: 100%;
  height: 24px;
  padding: 0 6px 0 8px;
  border: 1px dashed var(--ehr-border-strong);
  border-radius: var(--pg-radius-pill);
  background: var(--ehr-surface-bg);
  color: var(--ehr-text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ht_hp_add:hover, .ht_hp_add:focus-visible { border-style: solid; color: var(--ehr-text-primary); outline: none; }
.ht_hp_add.ht_busy, .ht_hp_add:disabled { opacity: 0.6; cursor: progress; }
