/**
 * Synergy Publication - Liquid Glass Toggle Switch Design System
 * Ultra-tactile frosted glass slider switches (Apple iOS / VisionOS frosted glass aesthetic)
 */

/* Container */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 48px;
  height: 26px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  flex-shrink: 0;
  margin: 0;
}

/* Hidden Native Checkbox */
.switch input[type="checkbox"],
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  pointer-events: none;
  margin: 0;
}

/* Glass Track / Slider */
.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(148, 163, 184, 0.28);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  border: 1.2px solid rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Rounded Slider Variation */
.switch .slider.round {
  border-radius: 34px;
}

/* Glossy Liquid Knob / Thumb */
.switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 1.8px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.28), 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 1px 1px #ffffff;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s;
}

/* Hover State */
.switch:hover .slider {
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.06), 0 0 10px rgba(0, 122, 255, 0.15);
}

/* Active / Checked State - Liquid Blue Gradient */
.switch input:checked + .slider {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.92) 0%, rgba(14, 165, 233, 0.95) 100%);
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(0, 122, 255, 0.38);
}

.switch input:checked + .slider:before {
  transform: translateX(22px);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 1px 1px #ffffff;
}

/* Elastic Stretch on Press */
.switch:active .slider:before {
  width: 24px;
}

/* Focus Outline for Accessibility */
.switch input:focus-visible + .slider {
  outline: 2px solid #007aff;
  outline-offset: 2px;
}

/* Disabled State */
.switch input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Compact / Mini Switch (ideal for dense tables & list items) */
.switch-sm {
  width: 38px;
  height: 22px;
}
.switch-sm .slider:before {
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 1.8px;
}
.switch-sm input:checked + .slider:before {
  transform: translateX(16px);
}
.switch-sm:active .slider:before {
  width: 19px;
}

/* Emerald Green Variant */
.switch-emerald input:checked + .slider {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(16, 185, 129, 0.38) !important;
}

/* Liquid Glass Switch Status Pill (ON/OFF text badge) */
.switch-status-pill {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 99px;
  transition: all 0.2s ease;
  user-select: none;
  display: inline-block;
  line-height: 1.3;
}
.switch-status-pill.on {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.switch-status-pill.off {
  background: rgba(148, 163, 184, 0.18);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Bootstrap / Form Switch Compatibility with Liquid Glass */
.form-switch .form-check-input {
  width: 46px !important;
  height: 24px !important;
  border-radius: 34px !important;
  background-color: rgba(148, 163, 184, 0.28) !important;
  background-image: none !important;
  backdrop-filter: blur(10px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(160%) !important;
  border: 1.2px solid rgba(255, 255, 255, 0.65) !important;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03) !important;
  position: relative !important;
  cursor: pointer !important;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  margin: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.form-switch .form-check-input::before {
  content: "" !important;
  position: absolute !important;
  height: 18px !important;
  width: 18px !important;
  left: 2px !important;
  bottom: 2px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25), inset 0 1px 1px #ffffff !important;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.form-switch .form-check-input:checked {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.92) 0%, rgba(14, 165, 233, 0.95) 100%) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(0, 122, 255, 0.38) !important;
}

.form-switch .form-check-input:checked::before {
  transform: translateX(22px) !important;
}

.form-switch .form-check-input::after {
  display: none !important;
}

/* Standalone Checkbox Liquid Glass Form Control */
input[type="checkbox"]:not(.switch input):not(.raw-checkbox) {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(148, 163, 184, 0.5);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-right: 6px;
}
input[type="checkbox"]:not(.switch input):not(.raw-checkbox):checked {
  background: linear-gradient(135deg, #007aff, #0284c7);
  border-color: #007aff;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.35);
}
input[type="checkbox"]:not(.switch input):not(.raw-checkbox):checked::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}
input[type="checkbox"]:not(.switch input):not(.raw-checkbox):focus-visible {
  outline: 2px solid #007aff;
  outline-offset: 2px;
}
