/* ============================================================================
   MÓDULO PORTÁTIL: RELATO DE BUG E MELHORIA COM PRINT DA TELA E PDF VANTTECH
   Arquivo autocontido — pode ser usado em qualquer aplicação Web sem dependências
   externas de CSS. Totalmente responsivo para qualquer monitor, notebook ou celular.
   ============================================================================ */

/* Botão Flutuante (⚡) no Canto Inferior Direito */
.fab-bug-report {
  position: fixed;
  bottom: 14px;
  right: var(--relato-bug-fab-right, 230px);
  z-index: 1850;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #022C22 0%, #064E3B 100%);
  color: #F8FAFC;
  border: 2px solid #F59E0B;
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(2, 44, 34, 0.38);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  transition:
    transform 0.2s ease-out,
    box-shadow 0.2s ease-out,
    border-color 0.2s ease,
    background 0.2s ease;
  user-select: none;
}

/* Se a aplicação hospedeira não tiver o botão "Mostrar Demitidos" ao lado, encosta na direita */
body:not(:has(#fabMostrarDemitidosContainer)) .fab-bug-report {
  right: 18px;
}

.fab-bug-report:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: #10B981;
  box-shadow: 0 14px 32px rgba(2, 44, 34, 0.48);
}

.fab-bug-report:active {
  transform: translateY(0) scale(0.97);
}

.fab-bug-report:focus-visible {
  outline: 2px solid #F59E0B;
  outline-offset: 3px;
}

.fab-bug-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #022C22;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(2, 44, 34, 0.35);
  flex-shrink: 0;
}

.fab-bug-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.fab-bug-label strong {
  font-size: 12px;
  font-weight: 800;
  color: #F8FAFC;
  letter-spacing: -0.01em;
}

.fab-bug-label span {
  font-size: 10px;
  font-weight: 600;
  color: #F8FAFC;
  opacity: 0.9;
}

/* Overlay e Container do Modal Autocontido */
#modalRelatoBug.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 44, 34, 0.72);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: clamp(6px, 1.5vh, 18px);
  overflow-y: auto;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#modalRelatoBug.modal-overlay.active {
  display: flex;
}

#modalRelatoBug .modal-container {
  background: var(--chronos-card-bg, #FFFFFF);
  color: var(--chronos-text-main, #0F172A);
  border: 1px solid var(--chronos-border, #CBD5E1);
  border-radius: 10px;
  width: 100%;
  max-width: min(880px, 96vw);
  max-height: calc(100vh - 14px);
  max-height: calc(100dvh - 14px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
  box-shadow: 0 20px 45px rgba(2, 44, 34, 0.35);
}

#modalRelatoBug .modal-container > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 60px);
  max-height: calc(100dvh - 60px);
  overflow: hidden;
}

#modalRelatoBug .modal-header {
  padding: clamp(10px, 1.2vh, 13px) clamp(14px, 1.8vw, 18px);
  border-bottom: 1px solid var(--chronos-border, #CBD5E1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #022C22 0%, #064E3B 100%);
  color: #F8FAFC;
}

#modalRelatoBug .modal-header h3 {
  margin: 0;
  font-size: clamp(13.5px, 1vw, 15px);
  font-weight: 800;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  gap: 8px;
}

#modalRelatoBug .modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #F8FAFC;
  flex-shrink: 0;
}

#modalRelatoBug .modal-body {
  padding: clamp(10px, 1.5vh, 16px) clamp(12px, 1.8vw, 20px);
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

#modalRelatoBug .modal-footer {
  padding: clamp(9px, 1.1vh, 12px) clamp(14px, 1.8vw, 18px);
  border-top: 1px solid var(--chronos-border, #CBD5E1);
  background: var(--chronos-card-bg, #FFFFFF);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 5;
}

#modalRelatoBug .form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#modalRelatoBug .form-group {
  margin-bottom: 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#modalRelatoBug .form-group label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--chronos-text-main, #1E293B);
}

#modalRelatoBug .form-control {
  width: 100%;
  padding: 7px 10px;
  font-size: 12.5px;
  border: 1px solid var(--chronos-border, #CBD5E1);
  border-radius: 6px;
  background: var(--chronos-input-bg, #FFFFFF);
  color: var(--chronos-text-main, #0F172A);
  box-sizing: border-box;
}

#modalRelatoBug textarea.form-control {
  min-height: 56px;
  resize: vertical;
}

/* Stage de Preview e Destaque do Print da Tela */
.bug-screenshot-stage {
  background: #022C22;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bug-screenshot-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  color: #F8FAFC;
  font-size: 11px;
}

.bug-screenshot-canvas-wrap {
  position: relative;
  width: 100%;
  max-height: clamp(115px, 24vh, 230px);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  background: #011913;
  display: flex;
  justify-content: center;
}

.bug-screenshot-canvas {
  max-width: 100%;
  max-height: clamp(110px, 23vh, 224px);
  width: auto;
  height: auto;
  cursor: crosshair;
  display: block;
  object-fit: contain;
}

/* Toast próprio de fallback caso a aplicação hospedeira não tenha mostrarToast() */
.relato-bug-standalone-toast {
  position: fixed;
  bottom: 76px;
  right: 20px;
  background: #022C22;
  color: #F8FAFC;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1.5px solid #10B981;
  box-shadow: 0 12px 28px rgba(2, 44, 34, 0.45);
  font-size: 12.5px;
  font-weight: 700;
  z-index: 9999;
  display: none;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

.relato-bug-standalone-toast.active {
  display: block;
}

/* Responsividade para Notebooks de Menor Altura e Dispositivos Móveis */
@media screen and (max-height: 820px) {
  .bug-screenshot-canvas-wrap {
    max-height: clamp(95px, 19vh, 175px);
  }
  .bug-screenshot-canvas {
    max-height: clamp(90px, 18vh, 170px);
  }
}

@media screen and (max-width: 768px) {
  .fab-bug-report {
    bottom: 12px;
    right: 12px !important;
    padding: 6px 10px 6px 6px;
  }
  .fab-bug-label span {
    display: none;
  }
  #modalRelatoBug .form-row {
    grid-template-columns: 1fr;
  }
  #modalRelatoBug .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

@media print {
  .fab-bug-report,
  #modalRelatoBug {
    display: none !important;
  }
}
