/**
 * Estilos do WebcamController
 */

.webcam-container {
  width: 100%;
  max-width: 100%;
  padding: 1rem;
}

.webcam-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* Camera Overlay - Estilo Nubank */
.camera-overlay {
  position: relative;
  width: 100%;
  max-width: 400px; /* Reduzido para proporção 3:4 */
  aspect-ratio: 3 / 4; /* Proporção 3:4 vertical */
  min-height: 500px;
  overflow: hidden;
  background: #FFFFFF !important; /* Fundo branco sólido - sempre visível */
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  margin: 0 auto; /* Centralizar */
  box-sizing: border-box;
}

/* Garantir que o overlay mantenha o fundo branco mesmo quando congelado */
.camera-overlay.frozen,
.camera-overlay[data-frozen="true"] {
  background: #FFFFFF !important;
}

.webcam-video-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #FFFFFF !important; /* Fundo branco sempre visível */
  box-sizing: border-box;
}

#webcam-video {
  display: none;
}

#webcam-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  z-index: 2; /* Como no guia: z-index 2 para canvas */
  pointer-events: none;
  background: #FFFFFF; /* Fundo branco sólido como no guia */
  transition: none;
  display: block;
}

#webcam-lines-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  z-index: 10; /* Z-index maior para ficar por cima do vídeo */
  pointer-events: none;
  background: transparent; /* Fundo transparente - apenas as linhas são visíveis */
  transition: none;
  display: block;
}

/* Moldura Oval (invisível, usada apenas para cálculos) */
.oval-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  max-width: 280px;
  aspect-ratio: 2 / 3;
  z-index: 3;
  pointer-events: none;
}

/* Indicador de Posição do Rosto */
.face-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  max-width: 280px;
  aspect-ratio: 2 / 3;
  border-radius: 50%;
  border: 3px solid transparent;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}

.face-indicator.visible {
  opacity: 1;
}

.face-indicator.positioning {
  border-color: #FFC107;
  animation: pulse 1.5s ease-in-out infinite;
}

.face-indicator.ready {
  border-color: #4CAF50;
  animation: pulse-success 1s ease-in-out infinite;
}

.face-indicator.too-far {
  border-color: #FF9800;
}

.face-indicator.too-close {
  border-color: #FF5722;
}

@keyframes pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    opacity: 1;
  }
}

@keyframes pulse-success {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.02);
    opacity: 1;
  }
}

/* Área de Instruções */
.instructions-area {
  position: absolute;
  bottom: 120px;
  left: 0;
  right: 0;
  padding: 0 2rem;
  z-index: 20; /* Acima das linhas de posicionamento (z-index: 10) */
  text-align: center;
}

.instruction-text {
  font-size: 18px;
  font-weight: 500;
  color: #333333;
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.instruction-text.instruction-approaching {
  color: #FF9800;
}

.instruction-text.instruction-positioning {
  color: #FFC107;
}

.instruction-text.instruction-ready {
  color: #4CAF50;
  font-weight: 600;
}

.instruction-text.instruction-measuring {
  color: #2196F3;
  font-weight: 600;
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.controls-panel {
  width: 100%;
  max-width: 640px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.controls-panel h4 {
  margin: 0 0 1rem 0;
  color: #fff;
  font-size: 1.1rem;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.controls-row label {
  color: #fff;
  font-weight: 600;
  flex: 1;
  min-width: 150px;
}

.btn-iris-adjust {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #4A9EFF 0%, #357ABD 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s;
}

.btn-iris-adjust:hover {
  transform: translateY(-2px);
}

.btn-iris-adjust:active {
  transform: translateY(0);
}

.btn-position-guide {
  padding: 0.5rem 1rem;
  background: #666;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
}

.btn-position-guide:hover {
  opacity: 0.9;
}

.capture-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 0.5rem;
}

.capture-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.capture-btn:disabled {
  background: linear-gradient(135deg, #666 0%, #555 100%);
  cursor: not-allowed;
  opacity: 0.6;
}

.values-panel {
  width: 100%;
  max-width: 640px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.measurement-item {
  color: #fff;
  font-size: 1rem;
  text-align: center;
}

.measurement-item strong {
  margin-right: 0.5rem;
}

.pose-quality {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: none;
}

.position-info,
.distance-info {
  width: 100%;
  max-width: 640px;
  padding: 0.5rem;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}

.validation-status {
  width: 100%;
  max-width: 640px;
  padding: 0.5rem;
  text-align: center;
  border-radius: 6px;
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  font-weight: 600;
  font-size: 0.85rem;
  display: none;
}

.back-btn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
  margin-top: 1rem;
}

.back-btn:hover {
  transform: translateY(-2px);
}

/* Validation Status Card */
.validation-status-card {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  transition: all 0.3s ease;
  overflow: visible;
  min-height: fit-content;
  word-wrap: break-word;
  overflow-wrap: break-word;
  border-radius: 6px;
}

.validation-status-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Debug Panel */
/* Tabela Comparativa Completa */
.comparison-table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.comparison-table thead {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.3) 0%, rgba(25, 118, 210, 0.3) 100%);
}

.comparison-table th {
  padding: 0.75rem;
  text-align: left;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.comparison-table th.mediapipe-col {
  background: rgba(67, 121, 184, 0.3);
}

.comparison-table th.tensorflow-col {
  background: rgba(255, 152, 0, 0.3);
}

.comparison-table th.difference-col {
  background: rgba(76, 175, 80, 0.3);
}

.comparison-table th.ai-col {
  background: rgba(156, 39, 176, 0.3);
}

.comparison-table th.final-col {
  background: rgba(76, 175, 80, 0.4);
}

.comparison-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.2s;
}

.comparison-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.comparison-table td {
  padding: 0.75rem;
  color: #fff;
}

.measurement-label-cell {
  font-weight: 600;
}

.measurement-desc {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.25rem;
}

.value-display {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.value-display.mediapipe {
  color: #4379b8;
}

.value-display.tensorflow {
  color: #FF9800;
}

.value-display.difference {
  font-weight: 700;
}

.value-display.ai-corrected {
  color: #9C27B0;
  font-weight: 700;
}

.value-display.final-value {
  color: #4CAF50;
  font-weight: 700;
  font-size: 1.1rem;
}

.value-display .unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
}

.diff-icon {
  margin-left: 0.5rem;
  font-size: 1rem;
}

.mediapipe-value-cell {
  background: rgba(67, 121, 184, 0.1);
}

.tensorflow-value-cell {
  background: rgba(255, 152, 0, 0.1);
}

.difference-value-cell {
  background: rgba(76, 175, 80, 0.1);
}

.ai-value-cell {
  background: rgba(156, 39, 176, 0.1);
}

.final-value-cell {
  background: rgba(76, 175, 80, 0.2);
}

.debug-panel {
  margin-bottom: 0.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.98) 0%, rgba(30, 30, 50, 0.98) 100%);
  border-radius: 8px;
  border: 2px solid #4A9EFF;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(74, 158, 255, 0.3);
  transition: all 0.3s ease;
  overflow: visible;
  min-height: fit-content;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.debug-panel:hover {
  border-color: #5AAFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(74, 158, 255, 0.3) !important;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(74, 158, 255, 0.3);
}

.debug-header h3 {
  font-size: 1rem;
  color: #4A9EFF;
  margin: 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.2;
}

.debug-section {
  margin-bottom: 1rem;
}

.debug-section h4 {
  font-size: 0.85rem;
  color: #fff;
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.tech-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tech-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
}

.tech-badge.mediapipe {
  background-color: rgba(67, 121, 184, 0.3);
  border: 1px solid #4379b8;
}

.tech-badge.tensorflow {
  border: 1px solid;
}

.tech-badge.tensorflow.validated {
  background-color: rgba(76, 175, 80, 0.3);
  border-color: #4CAF50;
}

.tech-badge.tensorflow.warning {
  background-color: rgba(255, 152, 0, 0.3);
  border-color: #FF9800;
}

.decision-process {
  padding: 0.75rem;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.decision-content {
  font-size: 0.75rem;
  color: #ccc;
  line-height: 1.6;
}

.decision-content p {
  margin: 0.3rem 0;
}

.measurement-details {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.measurement-label {
  font-size: 0.8rem;
  color: #fff;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.measurement-values {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.value-item {
  flex: 1;
  min-width: 120px;
}

.value-label {
  font-size: 0.7rem;
  color: #aaa;
  margin-bottom: 0.2rem;
}

.value-number {
  font-size: 0.9rem;
  font-weight: bold;
}

.mediapipe-value {
  color: #4379b8;
}

.tensorflow-value {
  color: #FF6B6B;
}

.average-value {
  color: #9C27B0;
}

.difference-value {
  /* Cor definida inline baseada no valor */
}

.final-value {
  color: #4CAF50;
}

.value-source {
  font-size: 0.65rem;
  color: #888;
  margin-top: 0.2rem;
}

.debug-legend {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid #555;
  font-size: 0.65rem;
  color: #aaa;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.mediapipe {
  background-color: #4379b8;
}

.legend-color.tensorflow {
  background-color: #FF6B6B;
}

/* Realtime Debug Panel */
.realtime-debug-panel {
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.95) 0%, rgba(30, 30, 40, 0.95) 100%);
  border-radius: 8px;
  border: 2px solid #4A9EFF;
  width: 100%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 15px rgba(74, 158, 255, 0.2);
  transition: all 0.3s ease;
}

.realtime-debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(74, 158, 255, 0.3);
}

.realtime-debug-measurement {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.realtime-debug-measurement:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Confidence Summary */
.confidence-summary {
  padding: 0.75rem;
  background-color: rgba(74, 158, 255, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(74, 158, 255, 0.3);
  margin-bottom: 1rem;
}

.confidence-summary-title {
  font-size: 0.85rem;
  color: #4A9EFF;
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.confidence-summary-content {
  font-size: 0.75rem;
  color: #ccc;
  line-height: 1.6;
}

.confidence-reliability {
  margin: 0.3rem 0;
}

.confidence-item {
  margin: 0.3rem 0;
}

/* History Panel */
#history-panel-container {
  width: 100%;
  max-width: 100%;
  margin-top: 1rem;
  display: block !important;
  visibility: visible !important;
}

.history-panel {
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  border: 1px solid rgba(74, 158, 255, 0.3);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.history-panel-title {
  font-size: 0.85rem;
  color: #fff;
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.history-stats {
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-stats-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.7rem;
}

.history-stat-box {
  flex: 1;
  min-width: 100px;
  padding: 0.3rem;
  border-radius: 4px;
}

.history-stat-label {
  color: #aaa;
}

.history-stat-value {
  color: #fff;
  font-weight: bold;
}

.history-tabs {
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
}

.history-tab-btn {
  padding: 0.3rem 0.6rem;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: all 0.2s;
}

.history-tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.history-tab-btn.active {
  background-color: rgba(74, 158, 255, 0.3);
  border-bottom-color: #4A9EFF;
}

.history-frames-container {
  max-height: 200px;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  padding: 0.5rem;
}

.history-frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.3rem;
  font-size: 0.65rem;
}

.history-frame-item {
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  text-align: center;
  position: relative;
  transition: transform 0.2s;
}

.history-frame-item:hover {
  transform: scale(1.05);
}

.history-frame-checkmark {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background-color: #4CAF50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #fff;
  font-weight: bold;
  border: 2px solid #fff;
}

.history-frame-number {
  color: #aaa;
  font-size: 0.6rem;
}

.history-frame-value {
  color: #fff;
  font-weight: bold;
  font-size: 0.7rem;
}

.history-legend {
  margin-top: 0.5rem;
  font-size: 0.65rem;
  color: #888;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-box {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  position: relative;
}

.legend-box.agreement {
  background-color: rgba(76, 175, 80, 0.4);
  border: 2px solid #4CAF50;
}

.legend-box.close {
  background-color: rgba(76, 175, 80, 0.2);
  border: 1px solid #4CAF50;
}

.legend-box.far {
  background-color: rgba(255, 152, 0, 0.2);
  border: 1px solid #FF9800;
}

.legend-checkmark {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background-color: #4CAF50;
  border-radius: 50%;
  font-size: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
}

/* Model Status Styles */
.model-status-container {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.5rem;
  transition: all 0.3s ease;
}

.model-status-container:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.model-status-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  justify-content: center;
}

.model-status-title.trained {
  color: #4CAF50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.model-status-title.ready {
  color: #FF9800;
  text-shadow: 0 0 10px rgba(255, 152, 0, 0.3);
}

.model-status-title.collecting {
  color: #64B5F6;
  animation: pulse-status 2s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(100, 181, 246, 0.4);
}

@keyframes pulse-status {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

.model-status-subtitle {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  color: #bbb;
  line-height: 1.5;
  text-align: center;
}

.download-thinking-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  box-shadow: 0 2px 8px rgba(156, 39, 176, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.download-thinking-btn:hover {
  background: linear-gradient(135deg, #7B1FA2 0%, #6A1B9A 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.5);
}

.download-thinking-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(156, 39, 176, 0.4);
}

.model-status-error {
  color: #F44336;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(244, 67, 54, 0.3);
}

/* Responsividade Mobile */
@media (max-width: 480px) {
  .instruction-text {
    font-size: 16px;
    padding: 0.9rem 1.2rem;
  }
  
  .instructions-area {
    bottom: 100px;
    padding: 0 1.5rem;
  }
  
  .camera-overlay {
    aspect-ratio: 3 / 4; /* Mesma proporção 3:4 no mobile */
    max-width: 100%;
    min-height: 500px;
  }
  
  #webcam-canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    aspect-ratio: none !important;
  }
}

@media (min-width: 768px) {
  .camera-overlay {
    max-width: 400px; /* Mantém 3:4 no desktop também */
  }
  
  .oval-frame {
    max-width: 280px; /* Mantém mesmo tamanho */
  }
  
  .face-indicator {
    max-width: 280px; /* Mantém mesmo tamanho */
  }
  
  #webcam-canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
  }
}

/* Desabilitar Landscape */
@media (orientation: landscape) and (max-height: 500px) {
  .camera-overlay::before {
    content: "Por favor, gire seu dispositivo para o modo retrato";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333333;
    z-index: 9999;
    text-align: center;
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .webcam-container {
    padding: 0.5rem;
  }
  
  .controls-panel,
  .values-panel {
    padding: 0.75rem;
  }
}

/* Contador Regressivo */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.countdown-text {
  font-size: 120px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 
    0 0 20px rgba(255, 255, 255, 0.8),
    0 0 40px rgba(74, 158, 255, 0.6),
    0 0 60px rgba(74, 158, 255, 0.4);
  transition: transform 0.2s ease, opacity 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  animation: countdown-pulse 0.5s ease-out;
}

@keyframes countdown-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsividade do contador */
@media (max-width: 480px) {
  .countdown-text {
    font-size: 80px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .countdown-text {
    font-size: 100px;
  }
}

/* ============================================
   MODO FULLSCREEN - Aplicativo Final
   ============================================ */

/* Botão discreto para alternar modo fullscreen */
.fullscreen-toggle-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.fullscreen-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.fullscreen-toggle-btn:active {
  transform: scale(0.95);
}

/* Modo fullscreen ativo */
body.fullscreen-mode {
  overflow: hidden;
  height: 100vh;
}

body.fullscreen-mode #app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #FFFFFF;
  z-index: 9999;
}

body.fullscreen-mode header#header {
  display: none !important;
}

body.fullscreen-mode #main {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  padding: 0;
  overflow: hidden;
}

body.fullscreen-mode .webcam-container {
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.fullscreen-mode .webcam-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* Desktop: Limitar tamanho mas manter página em branco */
@media (min-width: 769px) {
  body.fullscreen-mode .camera-overlay {
    max-width: 500px;
    max-height: 90vh;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  }
}

/* Mobile: Ocupar toda a tela */
@media (max-width: 768px) {
  body.fullscreen-mode .camera-overlay {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  
  body.fullscreen-mode .webcam-video-container {
    width: 100vw !important;
    height: 100vh !important;
  }
}

/* Ocultar todos os elementos exceto a câmera no modo fullscreen */
body.fullscreen-mode .controls-panel,
body.fullscreen-mode .values-panel,
body.fullscreen-mode #distance-position-container,
body.fullscreen-mode #validation-status-container,
body.fullscreen-mode #realtime-debug-panel-container,
body.fullscreen-mode #debug-panel-container,
body.fullscreen-mode #confidence-summary-container,
body.fullscreen-mode #history-panel-container,
body.fullscreen-mode #advanced-status-panel-container,
body.fullscreen-mode #back-to-form {
  display: none !important;
}

/* Garantir que o botão fullscreen não seja ocultado */
body.fullscreen-mode .fullscreen-toggle-btn {
  display: flex !important;
  z-index: 10000 !important;
}

/* Botão sempre visível quando o webcam está renderizado */
.fullscreen-toggle-btn {
  display: flex;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.fullscreen-toggle-btn:hover {
  opacity: 1;
}

/* Garantir que o botão fique visível mesmo em fullscreen */
body.fullscreen-mode .fullscreen-toggle-btn {
  display: flex !important;
  opacity: 0.8;
}

body.fullscreen-mode .fullscreen-toggle-btn:hover {
  opacity: 1;
}

