/* Gesture Scroll Widget styles */
.gesture-scroll-panel {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 260px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(22, 163, 74, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(22, 163, 74, 0.1);
  border-radius: 20px;
  overflow: hidden;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  user-select: none;
}

.gesture-scroll-panel.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

/* Header/Drag Handle */
.gesture-scroll-header {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
}

.gesture-scroll-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gesture-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  /* red by default */
  transition: background-color 0.3s;
}

.gesture-status-dot.active {
  background-color: #22c55e;
  /* green */
  box-shadow: 0 0 8px #22c55e;
  animation: gesture-pulse 1.5s infinite;
}

.gesture-status-dot.connecting {
  background-color: #fbbf24;
  /* yellow */
  box-shadow: 0 0 8px #fbbf24;
  animation: gesture-pulse 1.0s infinite;
}

@keyframes gesture-pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

.gesture-close-btn {
  background: transparent;
  border: none;
  color: #a3a3a3;
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gesture-close-btn:hover {
  color: #fff;
}

/* Main Content Area */
.gesture-scroll-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease, opacity 0.25s ease, gap 0.3s ease;
  overflow: hidden;
}

.gesture-scroll-panel.minimized .gesture-scroll-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  gap: 0;
  opacity: 0;
  pointer-events: none;
}

.gesture-scroll-panel.minimized {
  width: 220px;
  border-radius: 12px;
}

/* Webcam Window container */
.gesture-camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #171717;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gesture-camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  /* Mirror camera */
  display: block;
}

.gesture-camera-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  /* Mirror canvas to match video */
  z-index: 10;
  pointer-events: none;
}

/* Overlay Guidelines */
.gesture-zone-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 5;
  pointer-events: none;
}

.gesture-zone-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 8px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.05em;
  pointer-events: none;
}

.gesture-zone-line.top-line {
  top: 35%;
}

.gesture-zone-line.bottom-line {
  top: 65%;
}

/* Active Zone Glow effects */
.gesture-active-zone-glow {
  position: absolute;
  left: 0;
  right: 0;
  background: transparent;
  transition: background-color 0.2s, opacity 0.2s;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.gesture-active-zone-glow.top-glow {
  top: 0;
  height: 35%;
}

.gesture-active-zone-glow.bottom-glow {
  top: 65%;
  height: 35%;
}

.gesture-active-zone-glow.active-up {
  background: linear-gradient(to bottom, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0));
  opacity: 1;
}

.gesture-active-zone-glow.active-down {
  background: linear-gradient(to top, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0));
  opacity: 1;
}

/* Controls */
.gesture-controls-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.gesture-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  color: #d4d4d4;
}

.gesture-control-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gesture-control-value {
  color: #16a34a;
  font-family: monospace;
}

/* Range input styling */
.gesture-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #404040;
  outline: none;
  transition: background 0.3s;
}

.gesture-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #16a34a;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.8);
  transition: transform 0.1s;
}

.gesture-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Instructions and Warnings */
.gesture-info-text {
  font-size: 9px;
  color: #a3a3a3;
  line-height: 1.4;
  font-weight: 600;
  text-align: center;
}

/* Toggle button styling on page */
.gesture-toggle-btn-pulse {
  animation: gesture-btn-glow 2s infinite;
}

@keyframes gesture-btn-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
}

.gesture-indicator-floating {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: #22c55e;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10000;
  border: 2px solid #22c55e;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
}

.gesture-indicator-floating.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .gesture-scroll-panel {
    bottom: 16px;
    left: 16px;
    width: 190px;
    border-radius: 14px;
  }

  .gesture-scroll-header {
    padding: 8px 10px;
  }

  .gesture-scroll-title {
    font-size: 9px;
  }

  .gesture-scroll-body {
    padding: 8px;
    gap: 8px;
  }

  .gesture-controls-card {
    padding: 6px 8px;
    gap: 4px;
  }

  .gesture-control-row {
    font-size: 8px;
  }

  .gesture-info-text {
    font-size: 8px;
  }

  .gesture-indicator-floating {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}