/* ========================================
   SCROLLBAR PERSONALIZADA
   ======================================== */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========================================
   SLIDER (INPUT RANGE)
   ======================================== */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid #051d3b;
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid #051d3b;
}

/* ========================================
   ALPINE.JS - X-CLOAK
   ======================================== */
[x-cloak] {
  display: none !important;
}

/* ========================================
   QUILL EDITOR
   ======================================== */
.ql-toolbar.ql-snow {
  border-top-left-radius: 0.75rem !important;
  border-top-right-radius: 0.75rem !important;
  border-color: #e2e8f0 !important;
  border: 1px solid #e5e7eb !important;
  border-bottom: none !important;
  background-color: #f9fafb !important;
}
.ql-container.ql-snow {
  border-bottom-left-radius: 0.75rem !important;
  border-bottom-right-radius: 0.75rem !important;
  border-color: #e2e8f0 !important;
  border: 1px solid #e5e7eb !important;
  border-top: none !important;
  background-color: white !important;
  font-family: inherit;
  font-size: 0.875rem;
}
.ql-toolbar.ql-snow button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 4px !important;
  margin: 1px !important;
  border: 1px solid transparent !important;
  background: none !important;
  cursor: pointer !important;
  min-width: 28px !important;
  height: 28px !important;
}
.ql-toolbar.ql-snow button svg {
  width: 18px !important;
  height: 18px !important;
  fill: currentColor !important;
  stroke: currentColor !important;
}
.ql-toolbar.ql-snow .ql-picker-label,
.ql-toolbar.ql-snow button {
  color: #4b5563 !important;
}
.ql-toolbar.ql-snow button:hover,
.ql-toolbar.ql-snow .ql-active {
  color: #051d3b !important;
  background-color: #f3f4f6 !important;
  border-radius: 4px !important;
}

/* ========================================
   ANIMAÇÕES
   ======================================== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.animate-spin {
  animation: spin 1s linear infinite;
}
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-fade-in-down {
  animation: fadeInDown 0.3s ease-out;
}
@keyframes introPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(251, 191, 36, 0.6);
  }
}
@keyframes blinkDot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ========================================
   PIP (PICTURE-IN-PICTURE) - WEBCAM
   ======================================== */
#pipWrapper {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 240px;
  height: 135px;
  border-radius: 12px;
  border: 3px solid #ffffff;
  display: none;
  background: #000;
  overflow: hidden;
  z-index: 9999;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  user-select: none;
  touch-action: none;
  pointer-events: auto;
  transition: box-shadow 0.3s ease;
  will-change: left, top, width, height;
}
#pipWrapper:hover {
  border-color: #e2e8f0;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
}
#pipWrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#pip {
  transform: scaleX(1);
}
#pip.mirrored {
  transform: scaleX(-1);
}

.pip-flip-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(4px);
  padding: 0;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.2s ease,
    background 0.2s ease;
}
.pip-flip-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}
.pip-flip-btn svg {
  width: 16px;
  height: 16px;
}

#dragArea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 35px;
  cursor: move;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#resizeHandle {
  position: absolute;
  width: 18px;
  height: 18px;
  top: 0;
  left: 0;
  cursor: nwse-resize;
  background: rgba(255, 255, 255, 0.9);
  z-index: 25;
  border-bottom-right-radius: 100%;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    width 0.1s ease,
    height 0.1s ease;
}
#resizeHandle:hover {
  background: #ffffff;
  width: 22px;
  height: 22px;
}
#pipWrapper:hover #dragArea,
#pipWrapper:hover #resizeHandle,
#pipWrapper:hover .pip-flip-btn {
  opacity: 1;
}

/* ========================================
   BOTÃO DE GRAVAR (ESTADOS)
   ======================================== */
#recBtn {
  transition:
    opacity 0.3s ease,
    background-color 0.3s ease,
    transform 0.2s ease;
  position: relative;
  opacity: 1;
}
#recBtn.intro-countdown {
  opacity: 1 !important;
  z-index: 60;
  pointer-events: auto;
}
#recBtn.intro-countdown .w-2 {
  background-color: #000000 !important;
  animation: blinkDot 1s infinite;
}
#recBtn.intro-countdown span {
  color: #000000 !important;
  font-weight: 700 !important;
}
#recBtn.intro-countdown .text-\[10px\],
#recBtn.intro-countdown .font-mono {
  color: #78350f !important;
}
#recBtn.recording {
  opacity: 0.15 !important;
  background-color: rgba(243, 244, 246, 0.1) !important;
  border-color: rgba(209, 213, 219, 0.2) !important;
  box-shadow: none !important;
  z-index: 50;
  animation: none !important;
}
#recBtn.recording:hover {
  opacity: 0.9 !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  border-color: #cbd5e1 !important;
  transform: translateY(-1px);
}
#recBtn.recording .w-2 {
  background-color: #ef4444 !important;
}
#recBtn.recording span {
  color: #6b7280 !important;
}

/* ========================================
   MODAL DE DISPOSITIVOS (CORRIGIDO PARA CHROME)
   ======================================== */
#deviceModal {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  z-index: 10000 !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ✅ Substitui o hack de atributo [style*="display: flex"] que falha no Chrome */
#deviceModal.modal-active {
  display: flex !important;
}

/* 📳 Animação de vibração para feedback de limite */
@keyframes pipShake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-4px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(4px);
  }
}
.pip-shake {
  animation: pipShake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  will-change: transform;
  transform-origin: center;
}
