/*
 * Mythery — Shared UI components
 * Loaded by both the user-facing app (base.html) and the admin panel (admin/base.html).
 * Uses only variables that exist in both contexts, or hardcoded values.
 */

/* ═══ TOGGLE SWITCH ═══
 *
 * Usage:
 *   <label class="toggle-switch">
 *     <input type="checkbox" [checked]>
 *     <span class="toggle-track"></span>
 *     <span class="toggle-knob"></span>
 *   </label>
 *
 * The slot/channel look comes from the inset shadow on the track.
 * OFF  → dark track + muted knob  (clearly inactive)
 * ON   → gold track + white knob  (clearly active)
 */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: #1a1a2e;
  border: 2px solid #3a3a58;
  /* The inset shadow creates the recessed slot/channel look */
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.toggle-switch:hover .toggle-track {
  border-color: #5a5a7a;
}

.toggle-switch input:checked + .toggle-track {
  background: #c9a82c;
  border-color: #a8891f;
  /* Shallower inset when lit — the channel fills with light */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.toggle-knob {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #5a5a7a;
  top: 4px;   /* (24px track − 2px×2 border − 16px knob) / 2 = 2px inner → 4px from outer */
  left: 4px;  /* equal gap on both sides when combined with translateX(20px) */
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  /* Raised knob sitting in the slot */
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.toggle-switch input:checked ~ .toggle-knob {
  transform: translateX(20px);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(168, 137, 31, 0.3);
}
