/* ============================================================
   AgentAIShield — Discord-Style Toggle Component
   Enabled:  filled #6366f1 circle with ✓ inside
   Disabled: dark muted circle with ✕ inside
   ============================================================ */

/* ─── Base toggle wrapper ─────────────────────────────────── */
.aais-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

/* ─── Hidden native checkbox ──────────────────────────────── */
.aais-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ─── The pill track ──────────────────────────────────────── */
.aais-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 3px;
}

/* ─── The circular knob with ✕/✓ icon ───────────────────── */
.aais-toggle-slider::after {
  content: '✕';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  background: rgba(148, 163, 184, 0.7);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.2, 0.64, 1),
              background 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: translateX(0);
}

/* ─── Enabled/checked state ──────────────────────────────── */
.aais-toggle input:checked + .aais-toggle-slider {
  background: #6366f1;
  border-color: #6366f1;
}

.aais-toggle input:checked + .aais-toggle-slider::after {
  content: '✓';
  background: #fff;
  color: #6366f1;
  font-size: 10px;
  transform: translateX(20px);
}

/* ─── Focus ring (accessibility) ─────────────────────────── */
.aais-toggle input:focus-visible + .aais-toggle-slider {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ─── Hover states ───────────────────────────────────────── */
.aais-toggle:hover .aais-toggle-slider {
  border-color: rgba(255, 255, 255, 0.2);
}
.aais-toggle:hover input:checked + .aais-toggle-slider {
  background: #7274f3;
  border-color: #7274f3;
}

/* ─── Disabled state ─────────────────────────────────────── */
.aais-toggle input:disabled + .aais-toggle-slider {
  opacity: 0.4;
  cursor: not-allowed;
}
.aais-toggle input:disabled ~ * { cursor: not-allowed; }

/* ─── Light theme override ───────────────────────────────── */
[data-theme="light"] .aais-toggle-slider {
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .aais-toggle-slider::after {
  background: rgba(100, 116, 139, 0.75);
}
[data-theme="light"] .aais-toggle input:checked + .aais-toggle-slider {
  background: #6366f1;
  border-color: #6366f1;
}
[data-theme="light"] .aais-toggle input:checked + .aais-toggle-slider::after {
  background: #fff;
}

/* ─── Size variants ─────────────────────────────────────── */
.aais-toggle.sm {
  width: 36px;
  height: 20px;
}
.aais-toggle.sm .aais-toggle-slider::after {
  width: 14px;
  height: 14px;
  min-width: 14px;
  font-size: 7px;
}
.aais-toggle.sm input:checked + .aais-toggle-slider::after {
  transform: translateX(16px);
}

.aais-toggle.lg {
  width: 52px;
  height: 28px;
}
.aais-toggle.lg .aais-toggle-slider {
  padding: 0 4px;
}
.aais-toggle.lg .aais-toggle-slider::after {
  width: 20px;
  height: 20px;
  min-width: 20px;
  font-size: 11px;
}
.aais-toggle.lg input:checked + .aais-toggle-slider::after {
  transform: translateX(24px);
}

/* ─── Inline label pairing ───────────────────────────────── */
.aais-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.aais-toggle-row .aais-toggle-label {
  font-size: 13px;
  color: var(--text, #e2e8f0);
  cursor: pointer;
  user-select: none;
}
