/* app/assets/stylesheets/components/scheduler.css */

/* === MODAL SHELL === */

.scheduler {
  position: relative;
  display: flex;
  flex-direction: column;
  /* Grown for the candidate strip + swap chrome (epic 0032 PR2 §6.5); stays
     fluid at 96vw below the cap — no minimum width. */
  width: min(1720px, 96vw);
  height: min(94vh, 1100px);
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.scheduler__header {
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.scheduler__header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.scheduler__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}

.scheduler__header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.scheduler__division-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scheduler__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
}
.scheduler__close:hover {
  background: var(--bg-2);
  color: var(--ink);
}

.scheduler__content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface);
}

.scheduler__footer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.scheduler__footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.scheduler__footer-right {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

/* === TOP BAR (Period + Date + Allocation Counter) === */

.scheduler-top-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.scheduler-top-bar__left {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.scheduler-top-bar__right {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

/* === FORM ELEMENTS === */

.scheduler-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.scheduler-field--inline {
  position: relative;
}
.scheduler-field--compact {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.scheduler-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  white-space: nowrap;
}

.scheduler-select,
.scheduler-input {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  transition: border-color 0.15s;
}
.scheduler-select:hover,
.scheduler-input:hover { border-color: var(--ink-3); }
.scheduler-select:focus,
.scheduler-input:focus {
  outline: 0;
  border-color: var(--accent-dark);
  box-shadow: var(--focus-ring);
}

.scheduler-select--sm { font-size: 0.85rem; padding: 0.3rem 0.5rem; }
.scheduler-input--sm  { font-size: 0.85rem; padding: 0.3rem 0.5rem; }

.scheduler-caret {
  font-size: 0.6rem;
  color: var(--ink-3);
  margin-left: 0.2rem;
}

/* === ALLOCATION COUNTER === */

.scheduler-allocation-counter {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.scheduler-allocation-counter--under {
  background: var(--warning-soft);
  color: var(--warning);
}
.scheduler-allocation-counter--exact {
  background: var(--success-soft);
  color: var(--success);
}
.scheduler-allocation-counter--over {
  background: var(--danger-soft);
  color: var(--danger);
}

/* === NOTICES === */

.scheduler-notice {
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.scheduler-notice--info {
  background: var(--info-soft);
  color: var(--info);
  border-left: 3px solid var(--info);
}
.scheduler-notice--warning {
  background: var(--warning-soft);
  color: var(--warning-dark);
  border-left: 3px solid var(--warning);
}
.scheduler-notice--success {
  background: var(--success-soft);
  color: var(--success-dark);
  border-left: 3px solid var(--success);
}
.scheduler-notice__tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--ink-3);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: default;
  flex-shrink: 0;
}

/* === TOOLTIP === */

/* Suppress the global [data-tooltip]::after CSS tooltip inside the scheduler;
   the scheduler uses JS-positioned tooltips instead. */
.scheduler [data-tooltip]:hover::after,
.scheduler [data-tooltip]:focus-visible::after {
  content: none;
}

.scheduler-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--white);
  font-size: 0.8rem;
  line-height: 1.4;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* === BLOCK CARDS === */

.scheduler-blocks {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.scheduler-block {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: visible;
}

/* Single header row: arrows · BLOCK n/name · TEAMS · … stats · delete. */
.scheduler-block__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
}

.scheduler-block__header .scheduler-block__stats {
  margin-left: auto;
}

/* BLOCK n label stacked over the name input, like the DATE field. */
.scheduler-block__title-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Arrows stretch to match the label + input column beside them. */
.scheduler-block__reorder {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: stretch;
}

.scheduler-block__reorder-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 8px;
  cursor: pointer;
}
.scheduler-block__reorder-btn:hover { background: var(--accent); color: #fff; }

/* Placeholder keeps the surviving arrow in its natural half at the edges. */
.scheduler-block__reorder-btn--hidden {
  visibility: hidden;
  pointer-events: none;
}

/* Read-only input look — matches .scheduler-input metrics so it sits at
   the same height as the date field. */
.scheduler-period-badge {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 400;
  background: var(--bg-2);
  color: var(--ink-2);
  white-space: nowrap;
}

.scheduler-period-badge--warning {
  background: var(--warning-soft, rgba(245, 158, 11, 0.14));
  color: var(--warning, #b45309);
}


/* A visible input box (not disguised text) so editability is obvious. */
.scheduler-block__name {
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
  min-width: 200px;
  color: var(--ink);
}
.scheduler-block__name:hover { border-color: var(--ink-3); }
.scheduler-block__name:focus {
  outline: 0;
  background: var(--surface);
  border: 1px solid var(--accent-dark);
  box-shadow: var(--focus-ring);
}

/* (scheduler-block__header-right removed — replaced by header-meta layout) */

.scheduler-block__delete {
  background: none;
  border: none;
  color: var(--ink-4);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: var(--r-sm);
  line-height: 1;
}
.scheduler-block__delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.scheduler-block__body {
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface-2);
}

/* Block toggled off: excluded from generation but still fully editable. */
.scheduler-block__body--disabled {
  opacity: 0.45;
}

/* Include pill: one button, whole surface toggles. Sized to the input
   control height so the INCLUDE label lines up with BLOCK n / TEAMS in the
   vertically-centered header row. */
.scheduler-include-toggle {
  cursor: pointer;
  height: 2.1rem;
  align-items: center;
  box-sizing: border-box;
}

/* Block body: side-by-side sub-cards */
/* Locations and Time Slots get equal, larger shares; Pool Note the rest. */
.scheduler-block__cards {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 900px) {
  .scheduler-block__cards { grid-template-columns: 1fr; }
}

.scheduler-block__subcard {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scheduler-block__subcard-title {
  display: flex;
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin: 0;
}

.scheduler-block__location-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color 0.15s;
}
.scheduler-block__location-select:hover { border-color: var(--ink-3); }
.scheduler-block__location-select:focus {
  outline: 0;
  border-color: var(--accent-dark);
  box-shadow: var(--focus-ring);
}

/* Location multi-select within a block */
.scheduler-block__locations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  min-height: 2rem;
}

.scheduler-block__location-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}
.scheduler-block__location-chip--selected {
  background: var(--accent-light);
  border-color: var(--accent);
}
.scheduler-block__location-chip button {
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}
.scheduler-block__location-chip button:hover { color: var(--danger); }

.scheduler-block__add-location {
  background: none;
  border: 1px dashed var(--line);
  border-radius: var(--r-pill);
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-3);
  cursor: pointer;
}
.scheduler-block__add-location:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

/* Location dropdown — fixed position to escape modal overflow */
.scheduler-block__location-dropdown {
  position: fixed;
  z-index: 300;
  min-width: 240px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}

.scheduler-block__location-dropdown .tg-dropdown__location-row {
  padding: 0.15rem 0.25rem;
}
.scheduler-block__location-dropdown .tg-dropdown__location {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

/* === SLOT MANAGEMENT === */

.scheduler-slot-entry {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.scheduler-slot-entry__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.scheduler-slot-entry__field .scheduler-input {
  width: 100%;
}

.scheduler-slot-entry__add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--success);
  color: var(--white);
  border: none;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 0.05rem;
}
.scheduler-slot-entry__add:hover { filter: brightness(90%); }

/* Slot chips container */
.scheduler-slot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 1.5rem;
}

.scheduler-slot-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  padding: 0.15rem 0.25rem 0.15rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}
.scheduler-slot-chip button {
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0 0.15rem;
}
.scheduler-slot-chip button:hover { color: var(--danger); }

/* Copy/Paste buttons */
.scheduler-block__copy-notes-label {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  user-select: none;
}

.scheduler-block__notes-input {
  resize: vertical;
  min-height: 2.4rem;
  font-size: 0.82rem;
  /* Fill the Pool Note subcard instead of hugging the top. */
  flex: 1;
}

.scheduler-copy-paste-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.scheduler-copy-btn,
.scheduler-paste-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.scheduler-copy-btn:hover,
.scheduler-paste-btn:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}
.scheduler-copy-btn--copied {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}
.scheduler-paste-btn {
  background: var(--info-soft);
  border-color: var(--info);
  color: var(--info);
}

/* === BLOCK STATS (inline feedback) === */

.scheduler-block__stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.scheduler-block__stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.scheduler-block__stat-icon {
  font-size: 0.9rem;
}
.scheduler-block__stat-icon--ok { color: var(--success); }
.scheduler-block__stat-icon--warn { color: var(--warning); }

.scheduler-block__stat-detail {
  color: var(--ink-3);
  font-size: 0.78rem;
}

/* === BLOCK ACTIONS (Add Block + Templates) === */

.scheduler-block-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.scheduler-template-controls {
  display: flex;
  gap: 0.5rem;
}

/* === EMPTY STATE === */

.scheduler-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-3);
}
.scheduler-empty-state__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 0.5rem;
}
.scheduler-empty-state__desc {
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

/* === ADD BLOCK (dashed card) === */

.scheduler-add-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 1.25rem;
  margin-top: 0.75rem;
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.scheduler-add-block:hover {
  border-color: var(--ink-3);
  color: var(--ink-2);
  background: var(--surface);
}
.scheduler-add-block__icon {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
}
.scheduler-add-block__text {
  font-size: 0.85rem;
  font-weight: 600;
}

/* === FOOTER CONTROLS (Minimize Repeats toggle, Games/Match) === */

.scheduler-footer-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.scheduler-footer-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.scheduler-footer-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
}
.scheduler-footer-field > .scheduler-label {
  min-width: 10rem;
}

/* === SLOT COUNTER === */

.scheduler-block-counter,
.scheduler-slot-counter {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
  color: var(--ink-3);
}
.scheduler-block-counter:not(:empty),
.scheduler-slot-counter:not(:empty) {
  background: var(--bg-2);
}

/* === MODE CHOICE === */

.scheduler-mode-choice {
  border-top: 1px solid var(--line-2);
  padding-top: 1rem;
}
.scheduler-mode-choice__heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.scheduler-mode-choice__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 600px) {
  .scheduler-mode-choice__options { grid-template-columns: 1fr; }
}

.scheduler-mode-btn {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scheduler-mode-btn:hover {
  border-color: var(--ink-3);
}
.scheduler-mode-btn--primary:hover {
  border-color: var(--accent-dark);
  box-shadow: var(--focus-ring);
}
.scheduler-mode-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.scheduler-mode-btn:disabled:hover {
  border-color: var(--line);
  box-shadow: none;
}

.scheduler-mode-btn__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.scheduler-mode-btn__desc {
  font-size: 0.82rem;
  color: var(--ink-3);
  line-height: 1.35;
}

.scheduler-mode-choice__disabled-msg {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--warning);
  font-style: italic;
}

/* === AUTOMATED SETTINGS === */

.scheduler-automated-settings {
  border-top: 1px solid var(--line-2);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scheduler-automated-settings__row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.scheduler-automated-settings__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.scheduler-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.scheduler-toggle input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}
.scheduler-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* === DROPDOWN === */

.scheduler-dropdown {
  position: fixed;
  z-index: 300;
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.scheduler-dropdown__save-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--line-2);
}
.scheduler-dropdown__save-btn {
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.scheduler-dropdown__save-btn:hover { background: var(--accent-dark); }
.scheduler-dropdown__list {
  max-height: 200px;
  overflow-y: auto;
}
.scheduler-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.scheduler-dropdown__item:hover { background: var(--bg-2); }
.scheduler-dropdown__item-name { flex: 1; }
.scheduler-dropdown__item-delete {
  background: none;
  border: none;
  color: var(--ink-4);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0.25rem;
}
.scheduler-dropdown__item-delete:hover { color: var(--danger); }
.scheduler-dropdown__empty {
  padding: 0.75rem;
  color: var(--ink-3);
  font-size: 0.82rem;
  text-align: center;
}

/* === PREVIEW: HEADER BADGES (step-2 top right, replaces stat tiles) === */

.scheduler-preview-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Same metrics as the step-1 counters so every header badge is one height. */
.scheduler-header-badge {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
  background: var(--bg-2);
  color: var(--ink-3);
}
.scheduler-header-badge--success {
  background: var(--success-soft);
  color: var(--success);
}
.scheduler-header-badge--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

/* === PREVIEW: WARNINGS === */

.scheduler-warnings-toggle {
  background: none;
  border: none;
  font-size: 0.82rem;
  color: var(--warning);
  cursor: pointer;
  padding: 0.3rem 0;
  font-weight: 600;
}
.scheduler-warnings-toggle:hover { text-decoration: underline; }

.scheduler-warnings__indicator {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.scheduler-warnings {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.3rem 0;
}
.scheduler-warnings__item {
  font-size: 0.82rem;
  color: var(--ink-2);
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-sm);
}
.scheduler-warnings__item--danger {
  background: var(--danger-soft);
}
.scheduler-warnings__item--warning {
  background: var(--warning-soft);
}
.scheduler-warnings__item--info {
  background: var(--bg-2);
}
.scheduler-warnings__type {
  font-weight: 700;
  font-size: 0.78rem;
  margin-right: 0.25rem;
}

/* === PREVIEW: TABS (folder-tab style) === */

.scheduler-tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  padding-bottom: 2px;
  scrollbar-gutter: stable;
}
.scheduler-tabs::-webkit-scrollbar {
  height: 8px;
}
.scheduler-tabs::-webkit-scrollbar-track {
  background: var(--bg-2);
  border-radius: 4px;
}
.scheduler-tabs::-webkit-scrollbar-thumb {
  background: var(--ink-4);
  border-radius: 4px;
}
.scheduler-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
}

.scheduler-tab {
  padding: 0.5rem 0.9rem 0.45rem;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: var(--r-md) var(--r-md) 0 0;
  margin-bottom: -2px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
  flex-shrink: 0;
}
.scheduler-tab:hover {
  color: var(--ink);
  background: var(--bg-2);
}
.scheduler-tab--active:hover {
  background: var(--accent-dark);
  color: var(--white);
}
.scheduler-tab--active {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent-dark);
  border-bottom: 2px solid var(--accent);
}
.scheduler-tab__name {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.2;
}
.scheduler-tab__meta {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-3);
  line-height: 1.2;
}
.scheduler-tab--active .scheduler-tab__meta {
  color: var(--white);
  opacity: 0.85;
}

/* === GENERATOR PARAMETERS MODAL (epic 0032 PR2) === */

/* Sub-modal: stacks above the scheduler shell (and works standalone on the
   season configure page); below the JS tooltip layer (z 10000). */
.scheduler-config-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.scheduler-config {
  width: min(660px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.25);
  display: flex;
  flex-direction: column;
}

.scheduler-config__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.scheduler-config__title {
  font-weight: 800;
}
.scheduler-config__close {
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.scheduler-config__body {
  padding: 1rem 1.25rem;
}

.scheduler-config__toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.scheduler-config__toggle-btn {
  border: none;
  background: none;
  padding: 3px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-3);
  cursor: pointer;
}
.scheduler-config__toggle-btn--active {
  background: var(--accent);
  color: var(--white);
}
.scheduler-config__toggle-note {
  font-weight: 500;
}

.scheduler-config__vintage {
  font-size: 0.72rem;
  color: var(--ink-3);
  margin: 0 0 0.75rem;
}

.scheduler-config__table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}
.scheduler-config__table th {
  text-align: left;
  font-size: 0.72rem;
  color: var(--ink-3);
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.scheduler-config__table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--bg-2);
}
.scheduler-config__preset-name {
  font-weight: 600;
}
.scheduler-config__table select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.78rem;
  background: var(--surface);
}
.scheduler-config__table select:disabled {
  color: var(--ink-3);
  background: var(--bg-2);
}

.scheduler-config__explainer {
  font-size: 0.72rem;
  color: var(--ink-2);
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.6rem 0.8rem;
}

.scheduler-config__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* === PREVIEW: CANDIDATE PICKER (epic 0032) === */

/* Same horizontal-scroll pattern as .scheduler-tabs: one row, never wraps. */
.scheduler-candidates {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.35rem;
  margin-bottom: 0.75rem;
  scrollbar-gutter: stable;
}
.scheduler-candidates::-webkit-scrollbar {
  height: 8px;
}
.scheduler-candidates::-webkit-scrollbar-track {
  background: var(--bg-2);
  border-radius: 4px;
}
.scheduler-candidates::-webkit-scrollbar-thumb {
  background: var(--ink-4);
  border-radius: 4px;
}
.scheduler-candidates::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
}

.scheduler-candidate {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  width: 320px;
  padding: 0.55rem 0.8rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.scheduler-candidate:hover {
  background: var(--bg-2);
  border-color: var(--ink-4);
}
.scheduler-candidate--selected,
.scheduler-candidate--selected:hover {
  border-color: var(--accent);
  background: var(--accent-light, var(--bg-2));
  box-shadow: 0 0 0 1px var(--accent);
}
.scheduler-candidate__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--ink-2);
  line-height: 1.2;
}
.scheduler-candidate__marker {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  background: var(--bg-2);
  border-radius: 4px;
  padding: 0 5px;
  vertical-align: 2px;
}

.scheduler-candidate__subtext {
  font-size: 0.7rem;
  color: var(--ink-3);
  line-height: 1.2;
  text-align: center;
}

.scheduler-candidate__stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.scheduler-candidate__stat-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.scheduler-candidate__stat-label {
  /* Fixed width so both meters start at the same x regardless of label
     length ("Rematches:" vs "Strength Gap:"). */
  flex-shrink: 0;
  width: 6.2rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink);
}
.scheduler-candidate__stat-detail {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.3;
  white-space: nowrap;
}

/* Pastel comparison meters: rematches out of total matchups; avg gap out of
   350 elo-equivalent. Green < ⅓ fill, yellow to ⅔, red above. */
.scheduler-candidate__bar {
  flex: 1;
  height: 0.55rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--r-pill);
  background: var(--white);
  overflow: hidden;
}
.scheduler-candidate__bar-fill {
  display: block;
  position: relative;
  height: 100%;
  /* Square right edge; the track's overflow:hidden + pill radius clips a
     100% fill into the rounded end, so it can never spill past the corner. */
  border-radius: var(--r-pill) 0 0 var(--r-pill);
}
/* Faint dividers subdividing the filled portion into its sub-categories
   (rematch recency buckets; strength-gap bands). */
.scheduler-candidate__bar-div {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(17, 24, 39, 0.18);
}
.scheduler-candidate__bar-fill--green { background: #b7e4c7; }
.scheduler-candidate__bar-fill--yellow { background: #fbe6a2; }
.scheduler-candidate__bar-fill--red { background: #f5c2bd; }

/* === PREVIEW: TIMETABLE === */

.scheduler-tab-content {
  padding: 0.5rem 0;
  overflow-x: auto;
}

.scheduler-block-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.scheduler-block-preview__teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Badge restyle (epic 0032 PR2 §6.5): white face, uniform neutral border
   (per-team border colors rejected — Kyle 07-19), 6px corners so the grey
   elo chip reads as its own element. */
.scheduler-team-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  max-width: 260px;
}
.scheduler-team-badge__rank {
  font-size: 0.7rem;
  color: var(--ink-3);
  font-weight: 600;
}
.scheduler-team-badge__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheduler-team-badge__caret {
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 0.1rem;
  line-height: 1;
}
.scheduler-team-badge__caret:hover {
  color: var(--ink);
}

.scheduler-badge-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 0.25rem;
  white-space: nowrap;
}
.scheduler-badge-menu__item {
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.scheduler-badge-menu__item:hover,
.scheduler-badge-menu__item:focus-visible {
  background: var(--bg-2);
}

/* === SWAP MODAL (epic 0032 PR2 §6.5) === */

.scheduler-swap-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.scheduler-swap-overlay.hidden {
  display: none;
}

.scheduler-swap {
  width: min(560px, 94vw);
  max-height: 86vh;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.25);
  display: flex;
  flex-direction: column;
  outline: none;
}
.scheduler-swap__header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.scheduler-swap__subject {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
}
.scheduler-swap__close {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.scheduler-swap__body {
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}
.scheduler-swap-group__name {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0.6rem 0.5rem 0.25rem;
}
.scheduler-swap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid transparent;
  background: none;
  border-radius: var(--r-md);
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}
.scheduler-swap-row:hover,
.scheduler-swap-row:focus-visible {
  background: var(--bg-2);
}
.scheduler-swap-row--selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.scheduler-swap-row__team {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheduler-swap-row__delta {
  flex-shrink: 0;
  font-size: 0.74rem;
  color: var(--ink-3);
}
.scheduler-swap-delta--bad { color: var(--danger); font-weight: 600; }
.scheduler-swap-delta--good { color: var(--success, #16a34a); font-weight: 600; }
.scheduler-swap-delta--zero { color: var(--ink-3); }

.scheduler-swap__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.scheduler-block-preview__avg {
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* === PREVIEW: SLOT MATRIX ===
   The grid itself is the shared .schedule-matrix* component
   (components/schedule_matrix.css); only scheduler-specific cell states
   (dead/conflict/drop zones) live here. */

/* Must outrank `.schedule-matrix tbody td` for their backgrounds to win. */
.schedule-matrix tbody td.scheduler-matrix__cell--dead { background: var(--bg-2); }

.schedule-matrix tbody td.scheduler-matrix__cell--conflict { background: var(--danger-soft); }
.scheduler-matrix__cell--conflict .scheduler-gamecard { border-color: var(--danger); }

.scheduler-matrix__conflict-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.scheduler-matrix__cell-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 2.5rem;
  height: 100%;
}

.scheduler-matrix__drop-hint {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 1rem 0.5rem;
  /* Match a typical single-line game card's height so empty rows sit at
     the same rhythm as occupied ones. */
  min-height: 5.5rem;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.75rem;
  pointer-events: none;
}

/* While a card (including Sortable's drag ghost) occupies the cell, the
   hint is redundant — the ghost already previews the drop. */
.scheduler-matrix__cell-body:has(.scheduler-gamecard) .scheduler-matrix__drop-hint {
  display: none;
}

/* === PREVIEW: GAME CARD === */

.scheduler-gamecard {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0.6rem 0.4rem;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
}
/* Standard card hover feedback (see .tc-card / .explore-card). */
.scheduler-gamecard:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.scheduler-gamecard:active { cursor: grabbing; }

.scheduler-gamecard--ghost {
  opacity: 0.6;
  border: 1px dashed var(--accent);
  background: var(--accent-light);
}

/* A team double-booked at this time pattern — anywhere in the preview. */
.scheduler-gamecard--team-conflict {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.scheduler-gamecard__conflict-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  margin-bottom: 0.4rem;
  text-align: center;
}
.scheduler-gamecard__name--conflict {
  color: var(--danger);
}
.scheduler-gamecard__name--conflict b {
  color: var(--danger);
}

/* Team A text | icon A | vs | icon B | team B text — mirrors the public
   site's schedule rows so the icons flank the center "vs". */
.scheduler-gamecard__teams {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.scheduler-gamecard__side {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.scheduler-gamecard__side--a { justify-content: flex-end; }
.scheduler-gamecard__side--b { justify-content: flex-start; }

.scheduler-gamecard__side-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.scheduler-gamecard__side--a .scheduler-gamecard__side-text { align-items: flex-end; text-align: right; }
.scheduler-gamecard__side--b .scheduler-gamecard__side-text { align-items: flex-start; text-align: left; }

.scheduler-gamecard__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.scheduler-gamecard__name {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.scheduler-gamecard__name b {
  color: var(--ink-3);
  font-weight: 700;
  font-size: 0.72rem;
}

.scheduler-gamecard__vs-col {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0 0.15rem;
}

.scheduler-gamecard__vs {
  color: var(--ink-3);
  font-size: 0.72rem;
  font-style: italic;
}

.scheduler-gamecard__swap {
  border: 0;
  background: var(--bg-2);
  color: var(--ink-2);
  border-radius: var(--r-pill);
  font-size: 0.8rem;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
}
.scheduler-gamecard__swap:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.scheduler-gamecard__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line-2);
  font-size: 0.72rem;
  color: var(--ink-2);
}

.scheduler-gamecard__ref {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Accent badge on the ref value — visibly different from the grey info
   chips because this one is clickable. */
.scheduler-gamecard__ref-badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: var(--r-pill);
  background: var(--accent-light);
  color: var(--accent-dark, var(--accent));
  font-weight: 600;
}
.scheduler-gamecard__ref:hover .scheduler-gamecard__ref-badge {
  background: var(--accent);
  color: #fff;
}

.scheduler-gamecard__diffs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.scheduler-gamecard__diff {
  padding: 0.05rem 0.5rem;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-2);
  color: var(--ink-2);
}

/* Only the Δ value tints when the gap is large; the Elo/Rank label stays grey. */
.scheduler-gamecard__diff-val--high {
  color: var(--warning-dark);
}

/* Matchup-history chip (left of the Δ chips): weeks the pair already met. */
.scheduler-gamecard__history--none {
  color: var(--ink-3);
  font-weight: 500;
}


/* Matchup notes icon — a real button so the tooltip is keyboard-reachable */
.scheduler-alert-icon {
  border: 0;
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--warning);
  vertical-align: middle;
  cursor: pointer;
}
.scheduler-alert-icon--warning { color: var(--warning); }

/* On/Off pill wrapper (footer Minimize Repeats) — mirrors
   .standings-aggregation-toggle so the inactive side reads as part of a
   control, not floating text. */
.scheduler-diff-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  vertical-align: middle;
}

.scheduler-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06rem;
  line-height: 1.2;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.scheduler-toggle-btn:hover { color: var(--ink); }
.scheduler-toggle-btn--active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Loading spinner overlay */
.scheduler-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--ink-3);
  font-size: 0.9rem;
}

/* Team count input in block */
.scheduler-block__team-count-input {
  width: 3.5rem;
  text-align: center;
}

/* Tier select in block */
.scheduler-block__tier-select {
  min-width: 120px;
}

/* Referee picker overlay — renders on top of the scheduler modal */
#scheduler-ref-overlay:empty { display: none; }
#scheduler-ref-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
}
