/* css/switcher.css — Timetable switcher overlay (mutex state with slot-list per Phase 15 nav-stack). Imported into the components layer. */

/* post-v2.0 (2026-06-01): the switcher is an anchored DROPDOWN under #tt-switcher-trigger,
   not a full-screen overlay. top/left are set at open time by _positionSwitcherDropdown()
   (timetable-topbar.js) from the trigger's rect; the values below are a sane pre-position.
   z:70 paints above the slot-list scrim (z:50, which dims the background + handles
   outside-click dismiss) and the menu scrim (z:30); below the top-bar wrap (z:80). */
.timetable-switcher {
  position: absolute;
  top: 64px;
  left: var(--space-3, 12px);
  width: min(440px, calc(100vw - 2 * var(--space-3, 12px)));
  max-height: min(70vh, 560px);
  background: var(--bg-surface-2, #1c2026);
  border: 1px solid color-mix(in oklab, var(--fg) 14%, transparent);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 70;
  overflow: hidden;
}

.timetable-switcher[hidden] {
  display: none;
}

/* Dropdown mode: the legacy full-screen "← Back" header button is redundant — the dropdown
   is dismissed via outside-click (slot-list scrim), Escape, or re-clicking the trigger. Keep
   the element in the DOM (its listener closes the panel) but hide it in the dropdown. */
#timetable-switcher-close {
  display: none;
}

/* "+ New timetable" footer row (design parity) */
.timetable-switcher__footer {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-top: 1px solid color-mix(in oklab, var(--fg) 8%, transparent);
}

.timetable-switcher__new-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed color-mix(in oklab, var(--fg) 22%, transparent);
  border-radius: var(--radius, 12px);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.timetable-switcher__new-row:hover {
  border-color: var(--accent-amber);
  color: var(--text-primary);
  background: rgba(232, 168, 56, 0.06);
}

.timetable-switcher__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid color-mix(in oklab, var(--fg) 8%, transparent);
  flex-shrink: 0;
}

.timetable-switcher__title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timetable-switcher__list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  list-style: none;
  padding: var(--space-2) 0;
}

.tt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3);
  margin: 2px var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius, 12px);
  gap: var(--space-3);
  transition: background var(--transition), border-color var(--transition);
}

.tt-item:hover {
  background: color-mix(in oklab, var(--fg) 4%, transparent);
}

/* Active timetable: rounded amber outline + tint (design parity) */
.tt-item--active {
  background: rgba(232, 168, 56, 0.06);
  border-color: rgba(232, 168, 56, 0.4);
}

/* Per-item actions (rename / duplicate / share / delete) are revealed on hover/focus on
   pointer devices for a clean resting list; always visible on touch (no hover). */
@media (hover: hover) and (pointer: fine) {
  .tt-item__actions {
    opacity: 0;
    transition: opacity var(--transition);
  }
  .tt-item:hover .tt-item__actions,
  .tt-item:focus-within .tt-item__actions {
    opacity: 1;
  }
}

.tt-item__info {
  flex: 1;
  min-width: 0;
}

.tt-item__name {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-item__name:hover {
  text-decoration: underline;
  text-decoration-color: var(--text-muted);
}

/* Inline rename (260515-006) — replaces window.prompt() with in-place editing.
   Input inherits the name span's font/size/color; subtle amber underline cues editing state. */
.tt-item__name-input {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent-amber);
  outline: none;
  padding: 1px 0;
  width: 100%;
  box-sizing: border-box;
  cursor: text;
}

.tt-item__meta {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tt-item__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.tt-item__active-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-amber);
  padding: 2px 6px;
  border: 1px solid rgba(232, 168, 56, 0.35);
  border-radius: var(--radius-xs);
}
