* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: sans-serif;
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Style for the toggle switch */
.toggle-container {
  display: inline-block;
  position: relative;
  width: 60px;
  height: 30px;
  background-color: #ccc;
  border-radius: 15px;
  cursor: pointer;
}

.toggle-switch {
  position: absolute;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

  /* Style when the switch is toggled */
.toggle-on .toggle-switch {
  transform: translateX(30px);
}

.toggle-container.toggle-on {
  background-color: #32ac21;
}

/* Hide the checkbox input */
.checkbox-input { display: none; }

nav {
  background: linear-gradient(180deg, rgba(116,129,238,1) 75%, rgba(96,116,212,1) 100%);
  padding: 10px 0;
}

nav h1 {
  display: inline-block;
  margin: 0;
  font-family: sans-serif;
  color: white;
}

.video-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.video-wrapper.active { 
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-result {
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  box-sizing: border-box;
  display: none;
  font-family: sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 16px 20px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Camera Selector Styles */
#camera-selector {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
}

#camera-selector.loading {
  opacity: 0.6;
  pointer-events: none;
}

.camera-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}

.camera-selector-wrapper label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  width: auto;
  height: auto;
  box-shadow: none;
  filter: none;
}

.camera-selector-wrapper label:hover {
  cursor: default;
  box-shadow: none;
}

#camera-select {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

#camera-select:focus {
  outline: none;
  box-shadow: 0 2px 12px rgba(116, 129, 238, 0.5);
}

#camera-select:active {
  transform: scale(0.98);
}

#switch-camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 188, 51, 1);
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

#switch-camera-btn:hover {
  background: rgba(225, 158, 55, 1);
  transform: scale(1.05);
}

#switch-camera-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#switch-camera-btn svg {
  transition: transform 0.3s ease;
}

#switch-camera-btn:active svg {
  transform: rotate(180deg);
}

.camera-info {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  text-align: center;
  display: block;
  padding: 8px;
}

/* Scan Overlay & Viewfinder */
.scan-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}

.scan-frame {
  width: 260px;
  height: 260px;
  position: relative;
  border-radius: 24px;
}

.scan-frame::before,
.scan-frame::after {
  content: '';
  position: absolute;
  width: 50px;
  height: 50px;
  border-color: rgba(255, 188, 51, 0.9);
  border-style: solid;
  border-width: 0;
}

/* Top-left corner */
.scan-frame::before {
  top: 0;
  left: 0;
  border-top-width: 4px;
  border-left-width: 4px;
  border-top-left-radius: 24px;
}

/* Top-right corner */
.scan-frame::after {
  top: 0;
  right: 0;
  border-top-width: 4px;
  border-right-width: 4px;
  border-top-right-radius: 24px;
}

/* Bottom corners using box-shadow on a pseudo element won't work, so we use extra elements via CSS */
.scan-overlay::before,
.scan-overlay::after {
  content: '';
  position: fixed;
  width: 50px;
  height: 50px;
  border-color: rgba(255, 188, 51, 0.9);
  border-style: solid;
  border-width: 0;
}

/* Bottom-left corner */
.scan-overlay::before {
  bottom: calc(50% - 130px);
  left: calc(50% - 130px);
  border-bottom-width: 4px;
  border-left-width: 4px;
  border-bottom-left-radius: 24px;
}

/* Bottom-right corner */
.scan-overlay::after {
  bottom: calc(50% - 130px);
  right: calc(50% - 130px);
  border-bottom-width: 4px;
  border-right-width: 4px;
  border-bottom-right-radius: 24px;
}


.qr-result.success {
  background-color: #49de4c;
}

.qr-result.error {
  background-color: #de4c4c;
}

/* Panel - hidden for now */
#panel {
  display: none;
}

#panel-toggler {
  display: none;
}

#saved-results {
  display: none;
}

#counter {
  display: none;
}

.tabs {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  color: white;
}

.tabs > span { position: relative; }

.tabs > span:nth-child(2) {
  height: 36px;
}

.tab-attendees {
  display: none;
  margin-top: 45px;
  position: relative;
  height: 480px;
  max-width: 700px;
  width: 100%;
  overflow-y: auto;
}
.tab-attendees.active {
  display: inline-block;
}

.tab-attendees table td {
  word-break: break-word;
}

.tab-attendees table th:first-child {
  min-width: 32px;
}

.tab-attendees table th:nth-child(2) {
  min-width: 20px;
}

.checked-in-true::after,
.checked-in-false::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: lightgreen;
  box-shadow: 0 0 5px 0px lightgreen;
  display: block;
}
.checked-in-false::after {
  background-color: red;
  box-shadow: 0 0 5px 0px red;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  padding: 24px;
}

.left-switch.active::after,
.right-switch.active::after {
  content: '';
  width: 10px;
  margin-top: 5px;
  height: 10px;
  border-radius: 50%;
  background-color: lightgreen;
  box-shadow: 0 0 5px 0px lightgreen;
  display: block;
  position: absolute;
  left: calc(50% - 5px);
}

#switch {
  outline: none;
  display: block;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  position: relative;
  width: 6rem;
  height: 2rem;
  background: #452e6b;
  border-radius: 2rem;
  appearance: none;
  filter: blur(0.4px);
  box-shadow: -0.05rem -0.05rem 0.08rem rgba(37, 0, 51, 0.6), 0.05rem 0.05rem 0.1rem #b6e1fb, inset 0.5rem 0.5rem 2rem rgba(37, 0, 51, 0.5), inset 0.1rem 0.1rem 0.2rem rgba(37, 0, 51, 0.75), inset -0.5rem -0.5rem 4rem rgba(182, 225, 251, 0.5);
}

.switch-wrap {
  display: block;
  position: relative;
  width: 6rem;
  height: 2rem;
  border-radius: 2rem;
  /* overflow: hidden; */
  z-index: 1;
  transform: translatey(-110%) translatex(3px);
}

label {
  display: block;
  position: absolute;
  top: 50%;
  left: 0.1rem;
  width: 4rem;
  height: 1.8rem;
  background: #abafba;
  border-radius: 2rem;
  transform: translate3d(0%, -50%, 0);
  transition: transform 150ms cubic-bezier(0.55, 0.085, 0.68, 0.53);
  filter: blur(0.4px);
  box-shadow: inset -0.05rem -0.05rem 0.08rem rgba(37, 0, 51, 0.6), inset 0.05rem 0.05rem 0.1rem #b6e1fb, 0.5rem 0.5rem 2rem rgba(37, 0, 51, 0.5), 0.1rem 0.1rem 0.2rem rgba(37, 0, 51, 0.75);
}

label:hover {
  cursor: pointer;
  box-shadow: 0 0 0px 4px #d6d0e8;
}

#switch:checked + div label {
  transform: translate3d(1.85rem, -50%, 0);
}

.rib {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.35rem;
  height: 1.2rem;
  border-radius: 1rem;
  background: #abafba;
  opacity: 1;
  transform: translate3d(-50%, -50%, 0);
  box-shadow: inset -0.02rem -0.03rem 0.08rem rgba(37, 0, 51, 0.5), inset 0.03rem 0.03rem 0.1rem #b6e1fb, inset -0.02rem -0.03rem 0.2rem rgba(37, 0, 51, 0.3), inset 0.03rem 0.03rem 0.2rem rgba(182, 225, 251, 0.8), 0.05rem 0.08rem 0.3rem rgba(37, 0, 51, 0.3), -0.05rem -0.08rem 0.4rem rgba(182, 225, 251, 0.3), 0rem 0rem 0.2rem rgba(69, 46, 107, 0.2);
}
.rib:nth-child(1) {
  left: 35%;
}
.rib:nth-child(3) {
  left: 65%;
}
