/* ============================================
   COACH DASHBOARD
============================================ */
.hub-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #eee2f2;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.hub-client-row:hover { border-color: #c6b7e2; }
.hub-client-row .name { font-weight: 600; color: #333; }
.hub-client-row .email { color: #8a8073; font-size: 0.82rem; margin-top: 2px; }

.hub-client-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }   /* long emails wrap, pills stay put */

/* Right side of a client card: "Week 2" + "2/3" pills, then the arrow */
.client-row-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: 10px;
}
.client-pill {
  background: #c6b7e2;
  color: #3f3550;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.client-row-right > span:last-child { margin-left: 4px; }

.hub-coach-exercise-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid #eee2f2;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.hub-coach-exercise-row .name { font-weight: 600; color: #333; font-size: 0.92rem; }
.hub-coach-exercise-row .spec { color: #8a8073; font-size: 0.8rem; margin-top: 2px; }

.hub-coach-exercise-row,
.drag-handle {
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Exercise search ---------- */
.exercise-search-input {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 4px;
  box-sizing: border-box;
  font-size: 14px;
}
.exercise-search-results {
  height: 200px;
  overflow-y: scroll; /* forces the scrollbar to always show */
  border: 1px solid #ddd;
  border-radius: 6px;
}
.exercise-option {
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}
.exercise-option:last-child {
  border-bottom: none;
}
.exercise-option:hover {
  background-color: #f0f0f5;
}

/* ---------- Tag picker + filter ---------- */
.tag-picker-wrap {
  position: relative;
  margin-bottom: 0.6rem;
}
.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.tag-chip {
  background: #ece6f5;
  color: #4b3f5c;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tag-chip .remove-tag {
  cursor: pointer;
  font-weight: bold;
}
.tag-suggestions {
  position: absolute;
  z-index: 10;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}
.tag-suggestion-item {
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
.tag-suggestion-item:hover {
  background: #f0f0f5;
}
.tag-suggestion-create {
  font-style: italic;
  color: #6b5b8a;
}
.tag-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tag-filter-chip {
  background: #f0f0f5;
  color: #4b3f5c;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid #ddd;
}
.tag-filter-chip:hover {
  background: #e4e0ee;
}
.tag-filter-chip.active {
  background: #6b5b8a;
  color: #fff;
  border-color: #6b5b8a;
}

/* ---------- Template builder: title/notes + tag box ---------- */
.tpl-top-row { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin-bottom: 0.6rem; }
.tpl-top-left { min-width: 0; }
.tpl-top-left #tpl-builder-notes { display: block; width: 100%; box-sizing: border-box; margin-bottom: 0; }
.tpl-tag-box { background: #fff; border: 1px solid #eee2f2; border-radius: 12px; padding: 8px; box-sizing: border-box; }
.tpl-tag-box #tpl-tag-picker-wrap { position: relative; }
.tpl-tag-box .selected-tags { margin-bottom: 6px; }
.tpl-tag-box .tag-search-input { margin-bottom: 0; }
.tpl-tag-box .tag-suggestions { top: 100%; left: 0; margin-top: 2px; }
@media (min-width: 900px) {
  .tpl-top-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 0.8rem; align-items: stretch; }
  .tpl-tag-box { position: relative; padding: 0; }
  .tpl-tag-box #tpl-tag-picker-wrap { position: absolute; inset: 0; padding: 8px; box-sizing: border-box; display: flex; flex-direction: column; }
  .tpl-tag-box .selected-tags { flex: 1; min-height: 0; overflow-y: auto; align-content: flex-start; margin-bottom: 6px; }
}

/* ---------- Movement mapping (mm-) ---------- */
.mm-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0.8rem 0; }
.mm-tabs button {
  border: 1px solid #eee2f2; background: #fff; color: #8a8073;
  padding: 5px 14px; border-radius: 999px; font-size: 0.8rem; cursor: pointer;
  transition: background-color 0.2s ease;
}
.mm-tabs button.active { background: #c6b7e2; color: #3f3550; border-color: #c6b7e2; font-weight: 600; }

.mm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}
/* From 700px up: as many columns as fit (cards never narrower than 320px), max 4 */
@media (min-width: 700px) {
  .mm-grid {
    display: block;
    column-width: 320px;
    column-count: 4;
    column-gap: 12px;
  }
  .mm-group-card, .mm-standalone-card {
    break-inside: avoid;
    margin-bottom: 12px;
  }
}

.mm-group-card, .mm-standalone-card {
  border: 1px solid #eee2f2; border-radius: 12px; background: #fff; overflow: hidden;
  box-shadow: 0 3px 10px rgba(75, 63, 92, 0.12);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.mm-group-card:hover, .mm-standalone-card:hover {
  box-shadow: 0 6px 14px rgba(75, 63, 92, 0.18);
  transform: translateY(-2px);
}
.mm-standalone-card { border-style: dashed; padding: 10px 12px 8px; }
.mm-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer; gap: 8px;
}
.mm-name { font-weight: 700; font-size: 0.9rem; color: #3f3550; min-width: 0; }
.mm-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mm-cat-select {
  font-size: 0.72rem; border: 1px solid #eee2f2; border-radius: 6px;
  padding: 2px 4px; color: #4b3f5c; background: #fff;
}
.mm-count {
  font-size: 0.7rem; color: #8a8073; background: #f2ede4;
  border-radius: 999px; padding: 1px 8px; font-weight: 700;
}
.mm-group-trash, .mm-trash, .mm-group-edit { cursor: pointer; opacity: 0.55; font-size: 0.85rem; }
.mm-group-trash:hover, .mm-trash:hover { opacity: 1; color: #b3475a; }
.mm-group-edit:hover { opacity: 1; }
.mm-chev { font-size: 0.7rem; color: #8a8073; transition: transform 0.15s ease; }
.mm-group-card.open .mm-chev { transform: rotate(180deg); }

.mm-sub-list { max-height: 0; overflow: hidden; transition: max-height 0.2s ease; border-top: 1px solid transparent; }
.mm-group-card.open .mm-sub-list { max-height: 360px; overflow-y: auto; border-top-color: #eee2f2; }
@media (min-width: 700px) {
  .mm-group-card.open .mm-sub-list { max-height: none; overflow-y: visible; }
}
.mm-sub-list ul { list-style: none; margin: 0; padding: 8px 12px 4px; display: flex; flex-direction: column; gap: 5px; }
.mm-sub-list li { font-size: 0.8rem; color: #4b3f5c; display: flex; justify-content: space-between; align-items: center; }

.mm-add-row { display: flex; align-items: stretch; gap: 8px; padding: 4px 12px 8px; position: relative; }
.mm-add-row .mm-add-input { flex: 1; min-width: 0; margin-bottom: 0; padding: 0.45rem 0.75rem; font-size: 0.82rem; }
.mm-add-row .mm-add-btn {
  width: auto;
  flex: 0 0 auto;
  padding: 0.45rem 0.9rem;
  white-space: nowrap;
  background: #c6b7e2;
  border: none;
  border-radius: 8px;
  color: #3f3550;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.mm-map-btn { font-size: 0.85rem; }
.mm-add-row .mm-add-btn:hover { background: #ddd2eb; }

.mm-standalone-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; font-weight: 700; color: #3f3550; }
.mm-tag-badge {
  font-size: 0.68rem; font-weight: 600; color: #8a8073;
  background: #f2ede4; border-radius: 999px; padding: 1px 8px;
}
.mm-map-row { display: none; gap: 6px; margin-top: 6px; position: relative; }
.mm-map-row.open { display: flex; align-items: stretch; }
.mm-map-row input { flex: 1; min-width: 0; padding: 0.45rem 0.75rem; font-size: 0.82rem; }
.mm-map-confirm {
  width: auto;
  flex: 0 0 auto;
  padding: 0.45rem 0.9rem;
  white-space: nowrap;
  font-size: 0.8rem;
  border-radius: 8px;
  background: #c6b7e2;
  border: none;
  color: #3f3550;
  font-weight: 700;
  cursor: pointer;
}
.mm-map-confirm:hover { background: #ddd2eb; }
/* ============================================
   CLIENTS | WEBSITE SWITCH + WEBSITE SECTION (coach-website.js)
============================================ */
/* "Coach Dashboard" heading with the switch right next to it (wraps under it on narrow phones) */
.coach-header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  min-width: 0;
}
.hub-header .coach-mode-toggle {
  width: 200px;
  margin: 0;
}
#coach-signout-btn { white-space: nowrap; }

.web-tabs {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ddd2eb;
}
.web-tab {
  padding: 6px 14px;
  font-size: 0.85rem;
  color: #8a8073;
  cursor: pointer;
}
.web-tab.active {
  color: #4b3f5c;
  font-weight: 600;
  border-bottom: 2px solid #c6b7e2;
}

.web-card {
  background: #fff;
  border: 1px solid #eee2f2;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.web-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.web-card-name { font-weight: 600; color: #333; }
.web-card-date { color: #8a8073; font-size: 0.8rem; margin-top: 2px; }
.web-card-contact { color: #4b3f5c; font-size: 0.85rem; margin-top: 8px; overflow-wrap: anywhere; }
.web-card-message {
  margin-top: 10px;
  color: #3f3550;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.web-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.web-card-actions:empty { display: none; }
.web-card-error { margin-top: 0.4rem; min-height: 0; }

.web-pill {
  background: #b5aca0;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}
.web-pill.web-pill-live { background: #3fae7a; }

.web-btn {
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-family: inherit;
}
.web-btn:disabled { opacity: 0.5; cursor: default; }
.web-btn-main { background: #c6b7e2; color: #3f3550; border: none; }
.web-btn-main:hover { background: #ddd2eb; }
.web-btn-quiet { background: #fff; color: #8a8073; border: 1px solid #ddd2eb; }

/* Consult request: status dropdown + × (top right) */
.web-card-controls { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.web-status-select {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3f3550;
  background: #ece6f5;
  border: 1px solid #ddd2eb;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}
.web-card[data-status="scheduled"] .web-status-select { background: #d7f0e3; border-color: #3fae7a; color: #24704d; }
.web-card[data-status="replied"] .web-status-select { background: #fde7d3; border-color: #f08c2e; color: #9a4f0c; }
.web-card[data-status="cold"] .web-status-select { background: #eeeae4; border-color: #b5aca0; color: #6b6258; }
.web-card[data-status="cold"] { opacity: 0.75; }
.web-delete-x {
  background: none;
  border: none;
  color: #8a8073;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 0.2rem;
  cursor: pointer;
}
.web-delete-x:hover { color: #b3441f; }

/* ============================================
   CLIENT SETTINGS (gear next to the client's name + popup)
============================================ */
.cs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.cs-gear {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #ddd2eb;
  background: #fff;
  color: #4b3f5c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.cs-gear:hover { background: #ece6f5; border-color: #c6b7e2; }

.cs-overlay {
  position: fixed; inset: 0;
  background: rgba(60, 50, 70, 0.55);
  align-items: center; justify-content: center;
  padding: 1rem; z-index: 1000;
}
.cs-modal {
  background: #faf7f2;
  border-radius: 16px;
  padding: 1rem 1.1rem 1.1rem;
  width: 100%; max-width: 420px;
  max-height: 85vh; overflow-y: auto;
  box-sizing: border-box;
}
.cs-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.cs-top h4 { margin: 0; color: #4b3f5c; font-size: 1.05rem; }
.cs-x {
  background: none; border: none; color: #4b3f5c;
  font-size: 1.5rem; line-height: 1; padding: 0 0.2rem; cursor: pointer;
}
.cs-label { display: block; margin-bottom: 0.3rem; color: #4b3f5c; font-size: 0.85rem; font-weight: 600; }
.cs-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.cs-hint { font-size: 0.78rem; color: #8a8073; margin-top: 0.3rem; }

/* On/off switch built from a checkbox */
.cs-switch {
  -webkit-appearance: none; appearance: none;
  flex: 0 0 auto;
  width: 44px; height: 26px; margin: 0;
  border-radius: 13px;
  background: #cfc8bd;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-switch::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}
.cs-switch:checked { background: #8f78bd; }
.cs-switch:checked::after { left: 21px; }
.cs-switch:disabled { opacity: 0.6; cursor: default; }
.cs-switch:focus-visible { outline: 2px solid #4b3f5c; outline-offset: 2px; }

.cs-warn {
  background: #fbeee6; color: #a3542e;
  border-radius: 8px; padding: 0.55rem 0.7rem;
  font-size: 0.8rem; line-height: 1.4; margin-top: 0.6rem;
}
.cs-warn b { display: block; margin-bottom: 0.15rem; }
.cs-warn ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.cs-status { font-size: 0.8rem; color: #8a8073; min-height: 1.1em; margin: 0.8rem 0 0.5rem; }

/* Hide / Show a week from the client (coach-workout-list.js) */
.mm-hide-week-btn {
  margin-left: auto;
  background: #fff;
  border: 1.5px solid #c6b7e2;
  color: #4b3f5c;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.mm-hide-week-btn:disabled { opacity: 0.5; cursor: default; }
.mm-hidden-tag {
  background: #b3475a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
}
.mm-week-hidden { opacity: 0.55; }
