/* Card da câmera (Visão Óptica) extraído de style.css do projeto Elo. */
#camera-button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid rgba(var(--ui-0-229-255), 0.28);
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--ui-0-229-255), 0.10);
  color: rgb(var(--ui-0-229-255));
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease, border-color 0.2s ease, color 0.2s ease;
}

#camera-button:hover {
  transform: translateY(-1px) scale(1.05);
  color: rgb(var(--ui-128-240-255));
  background: rgba(var(--ui-0-229-255), 0.22);
  border-color: rgba(var(--ui-0-229-255), 0.6);
  box-shadow: 0 8px 24px -2px rgba(var(--ui-0-229-255), 0.4);
}

#camera-button .icon-camera-off {
  display: block;
}

#camera-button .icon-camera-on {
  display: none;
}

#camera-button.is-active {
  background: linear-gradient(135deg, rgb(var(--ui-0-229-255)) 0%, rgb(var(--ui-0-168-232)) 52%, rgb(var(--ui-0-119-182)) 100%);
  border-color: rgba(255, 255, 255, 0.6);
  color: #ffffff;
  box-shadow: 0 8px 24px -2px rgba(var(--ui-0-180-216), 0.65);
  animation: camera-pulse 1.6s ease-in-out infinite;
}

#camera-button.is-active .icon-camera-off {
  display: none;
}

#camera-button.is-active .icon-camera-on {
  display: block;
}

#camera-pip-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 250px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(var(--ui-16-26-38), 0.52) 0%, rgba(var(--ui-6-12-20), 0.64) 100%);
  border: 1px solid rgba(var(--ui-0-229-255), 0.35);
  border-top: 1.5px solid rgba(var(--ui-0-229-255), 0.7);
  box-shadow:
    0 20px 48px -10px rgba(0, 0, 0, 0.72),
    0 0 30px rgba(var(--ui-0-229-255), 0.22),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px) saturate(155%);
  -webkit-backdrop-filter: blur(4px) saturate(155%);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.25s ease;
}

#camera-pip-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.92);
  display: none !important;
}

.camera-pip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(var(--ui-0-229-255), 0.08);
  border-bottom: 1px solid rgba(var(--ui-0-229-255), 0.2);
}

.camera-pip-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.camera-pip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--ui-0-229-255));
  box-shadow: 0 0 10px rgb(var(--ui-0-229-255));
  animation: camera-dot-pulse 1.4s ease-in-out infinite alternate;
}

.camera-pip-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: rgb(var(--ui-0-229-255));
  text-transform: uppercase;
}

#camera-pip-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

#camera-pip-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.camera-pip-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}

#camera-pip-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* espelhamento natural de webcam */
  display: block;
}

.camera-pip-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(var(--ui-0-229-255), 0.06) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
}

.camera-pip-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
  opacity: 0.4;
}

.camera-pip-crosshair::before,
.camera-pip-crosshair::after {
  content: "";
  position: absolute;
  background: rgb(var(--ui-0-229-255));
}

.camera-pip-crosshair::before {
  top: 9px;
  left: 0;
  width: 20px;
  height: 2px;
}

.camera-pip-crosshair::after {
  top: 0;
  left: 9px;
  width: 2px;
  height: 20px;
}

.camera-pip-reticle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgb(var(--ui-0-229-255));
  pointer-events: none;
  opacity: 0.7;
}

.camera-pip-reticle.tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }

.camera-pip-reticle.tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }

.camera-pip-reticle.bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }

.camera-pip-reticle.br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.camera-pip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(var(--ui-0-229-255), 0.15);
  font-size: 9.5px;
  letter-spacing: 1px;
}

.camera-pip-fps {
  color: rgba(255, 255, 255, 0.6);
  font-family: monospace;
}

.camera-pip-status-txt {
  color: rgb(var(--ui-0-229-255));
  font-weight: 700;
}

@media (max-width: 600px) {
#camera-pip-container {
    top: 90px;
    bottom: auto;
    right: 14px;
    width: 148px;
    border-radius: 14px;
  }
.camera-pip-header {
    padding: 5px 8px;
  }
.camera-pip-title {
    font-size: 8px;
    letter-spacing: 0.8px;
  }
.camera-pip-footer {
    display: none;
  }
}

@keyframes camera-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(var(--ui-0-229-255), 0.55);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(var(--ui-0-229-255), 0);
  }
}

@keyframes camera-dot-pulse {
  from { opacity: 0.6; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.2); }
}

:root {
  --ui-0-119-182: 0, 119, 182;
  --ui-0-168-232: 0, 168, 232;
  --ui-0-180-216: 0, 180, 216;
  --ui-0-229-255: 0, 229, 255;
  --ui-128-240-255: 128, 240, 255;
  --ui-16-26-38: 16, 26, 38;
  --ui-6-12-20: 6, 12, 20;
}
