/* ============================================================
   FotoLaudo — Câmera Técnica de Engenharia & Infraestrutura
   Estilização de Alta Precisão & Visibilidade de Campo
   ============================================================ */

:root {
  --bg-oled: #05080f;
  --bg-panel: rgba(11, 17, 29, 0.85);
  --bg-glass: rgba(18, 27, 45, 0.7);
  --border-glass: rgba(255, 255, 255, 0.1);
  --amber-tech: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.35);
  --cyan-tech: #00d2ff;
  --cyan-glow: rgba(0, 210, 255, 0.35);
  --emerald-tech: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --red-alert: #ef4444;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-oled);
  font-family: var(--font-sans);
  color: #f1f5f9;
}

/* Permitir seleção em campos de input e textarea */
input, textarea, select {
  user-select: text;
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
}

.glass-pill {
  background: rgba(8, 14, 26, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 210, 255, 0.2);
}

/* Monospace Telemetria */
.font-telemetry {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* Viewfinder & Video */
#cameraContainer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
}

/* Grades e Mira (HUD) */
.hud-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.grid-thirds {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  width: 100%;
  height: 100%;
}

.grid-thirds > div {
  border: 0.5px solid rgba(255, 255, 255, 0.15);
}

.hud-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 11;
}

.hud-crosshair::before,
.hud-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(0, 210, 255, 0.6);
  box-shadow: 0 0 6px var(--cyan-glow);
}

.hud-crosshair::before {
  top: 29px;
  left: 0;
  width: 60px;
  height: 2px;
}

.hud-crosshair::after {
  top: 0;
  left: 29px;
  width: 2px;
  height: 60px;
}

.hud-crosshair-center {
  position: absolute;
  top: 25px;
  left: 25px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #f59e0b;
  box-shadow: 0 0 6px var(--amber-glow);
}

/* Horizonte Virtual & Nível */
.horizon-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 180px;
  height: 2px;
  margin-left: -90px;
  margin-top: -1px;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 12;
  transition: transform 0.08s ease-out, background-color 0.2s ease;
}

.horizon-level {
  background-color: #10b981 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8) !important;
}

.level-indicator-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid #ffffff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 13;
  transition: transform 0.08s ease-out, background-color 0.2s;
}

.level-indicator-dot.level-perfect {
  background: #10b981;
  box-shadow: 0 0 12px #10b981;
}

/* Shutter Button */
.shutter-btn-outer {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shutter-btn-outer:active {
  transform: scale(0.92);
}

.shutter-btn-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
  transition: background 0.15s;
}

.shutter-btn-outer:active .shutter-btn-inner {
  background: #ffffff;
}

/* Flash de captura */
#shutterFlash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.05s ease-out;
}

#shutterFlash.flash-active {
  opacity: 0.9;
  transition: none;
}

/* Quick Tag Chips */
.quick-chip {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-chip:hover, .quick-chip.active {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fef3c7;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, 0.5);
}

/* Editor de Anotações Técnicas (Markup) */
#markupCanvasContainer {
  touch-action: none;
  overscroll-behavior: none;
}

#markupCanvas {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Utilitário para ocultar scrollbar visual com rolagem suave por toque */
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* Barra de Ferramentas Superior com Rolagem Horizontal Suave */
#topToolsBar {
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}

/* Luz de Preenchimento de Tela (Screen Torch) */
#screenTorchOverlay {
  position: fixed;
  inset: 0;
  background-color: #ffffff;
  pointer-events: none;
  z-index: 25;
  opacity: 0.95;
  transition: opacity 0.2s ease-in-out;
}

/* Rolagem vertical fluida para o Modal de Revisão Técnica */
#modalReviewPhoto .overflow-y-auto {
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}

/* Rolagem horizontal dos botões do editor de anotações */
#markupToolsBar {
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Botões de Cores e Contêiner do Editor */
.markup-color-btn {
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#modalMarkupEditor {
  overscroll-behavior: contain;
}

/* ============================================================
   MODO PAISAGEM (LANDSCAPE) OTIMIZADO PARA DISPARO ERGONÔMICO
   ============================================================ */
@media (orientation: landscape) {
  body {
    flex-direction: row !important;
  }

  /* Visor da Câmera em Tela Ampla / Panorâmica */
  #cameraContainer {
    height: 100vh !important;
    flex: 1 1 0% !important;
    width: auto !important;
    position: relative !important;
  }

  /* Dock de Disparo Lateral na Direita (sob o polegar direito) */
  #cameraControlsDock {
    position: relative !important;
    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
    height: 100vh !important;
    border-top: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 14px 6px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0 !important;
    z-index: 30 !important;
    background-color: #060913 !important;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.6) !important;
  }

  #shutterBarInner {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    height: 100% !important;
    width: 100% !important;
    max-width: none !important;
    padding: 6px 0 !important;
    margin: 0 !important;
  }

  /* Botão da Galeria no topo do dock direito */
  #btnOpenGallery {
    order: 1 !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  /* Botão de Disparo (Shutter) centralizado exatamente onde o polegar direito repousa */
  #btnShutter {
    order: 2 !important;
    width: 68px !important;
    height: 68px !important;
    margin: auto 0 !important;
  }

  .shutter-btn-inner {
    width: 52px !important;
    height: 52px !important;
  }

  /* Botão do PDF na base do dock direito */
  #btnOpenPdfModal {
    order: 3 !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  /* Chips Rápidos Flutuantes na base do visor (sem comprimir a câmera) */
  #quickChipsContainer {
    position: fixed !important;
    bottom: 12px !important;
    left: 12px !important;
    right: 104px !important;
    max-width: calc(100vw - 116px) !important;
    z-index: 25 !important;
    background: rgba(6, 10, 20, 0.7) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 9999px !important;
    padding: 4px 10px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  }

  /* Tarja de Telemetria (HUD) Compacta no topo-esquerdo */
  #hudCardContainer {
    top: 48px !important;
    bottom: auto !important;
    left: 12px !important;
    right: auto !important;
    max-width: 270px !important;
    z-index: 20 !important;
  }

  #hudCardContainer .glass-panel {
    padding: 6px 10px !important;
    border-radius: 12px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    background: rgba(8, 14, 26, 0.7) !important;
  }

  /* Modal de Revisão da Foto em Paisagem */
  #modalReviewPhoto .max-h-\[46vh\] {
    max-height: 65vh !important;
  }
}



