/* ========================================================
   1. 카메라 전체 화면 (모바일 전체화면 및 하단바 잘림 방지)
   ======================================================== */
#camera-section { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100vw; 
  height: 100vh; /* 구형 브라우저 대비용 */
  height: 100dvh; /* 모바일 동적 뷰포트 (핵심) */
  background: #000; 
  z-index: 1000; 
  overflow: hidden; 
}

#videoView { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

/* ========================================================
   2. 상단 '돌아가기' 버튼
   ======================================================== */
.btn-back {
  position: absolute;
  top: 20px;
  top: calc(env(safe-area-inset-top, 0px) + 20px); /* 노치/상단바 영역 안전 계산 */
  left: 15px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.9); /* 글자가 배경에 묻히지 않게 */
  cursor: pointer;
  z-index: 20;
}

.btn-back svg { 
  width: 26px; 
  height: 26px; 
  fill: white; 
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.8)); 
}

/* ========================================================
   3. 번호판 인식 가이드 영역 (얇은 가로형)
   ======================================================== */
.guide-box { 
  position: absolute; 
  top: 35%; 
  left: 10%; 
  width: 80%; 
  height: 15%; 
  border: 2px solid #38a169; 
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.6); /* 영역 밖을 어둡게 처리 */
  border-radius: 4px; 
  z-index: 10; 
}

.guide-text { 
  position: absolute; 
  top: 25%; 
  width: 100%; 
  text-align: center; 
  color: white; 
  font-size: 16px; 
  font-weight: bold; 
  text-shadow: 1px 1px 4px rgba(0,0,0,0.8); 
  z-index: 10; 
}

/* ========================================================
   4. 하단 카메라 컨트롤 패널 (사진선택, 촬영, 직접입력)
   ======================================================== */
.bottom-panel-container { 
  position: absolute; 
  bottom: 30px; 
  bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); /* 하단바 안전 계산 */
  left: 5%; 
  width: 90%; 
  z-index: 20; 
}

.bottom-panel { 
  background: rgba(0, 0, 0, 0.85); 
  border-radius: 40px; 
  display: flex; 
  justify-content: space-around; 
  align-items: center; 
  padding: 15px 15px; 
  border: 1px solid rgba(255,255,255,0.2); 
}

.capture-btn { 
  width: 75px; 
  height: 75px; 
  background: #e53e3e; 
  border-radius: 50%; 
  border: 6px solid white; 
  cursor: pointer; 
  flex-shrink: 0; /* 화면이 좁아져도 버튼이 찌그러지지 않게 방어 */
  transition: transform 0.1s ease; 
}

.capture-btn:active { 
  transform: scale(0.9); 
}

.side-btn { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  color: white; 
  cursor: pointer; 
  gap: 8px; 
  width: 60px; 
}

.side-btn svg { 
  width: 32px; 
  height: 32px; 
  fill: white; 
}

.side-btn span { 
  font-size: 13px; 
  font-weight: bold; 
}

/* ========================================================
   5. 로딩 표시기
   ======================================================== */
#loading { 
  display: none; 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%); 
  color: white; 
  font-weight: bold; 
  z-index: 20; 
  background: rgba(0, 0, 0, 0.7);
  padding: 15px 20px;
  border-radius: 8px;
}

/* ========================================================
   6. 정보 입력 폼 화면 (인식 완료 또는 직접입력 시 노출)
   ======================================================== */
#form-section { 
  display: none; 
  padding: 20px; 
  background: #fff; 
  min-height: 100vh; 
}

.form-group { 
  margin-bottom: 15px; 
}

.form-group label { 
  display: block; 
  font-size: 14px; 
  font-weight: bold; 
  margin-bottom: 5px; 
  color: #555; 
}

.form-group input, 
.form-group select { 
  width: 100%; 
  padding: 12px; 
  border: 1px solid #ccc; 
  border-radius: 6px; 
  box-sizing: border-box; 
}

.btn-submit { 
  width: 100%; 
  background: #2b6cb0; 
  color: white; 
  padding: 15px; 
  border-radius: 8px; 
  font-weight: bold; 
  border: none; 
  margin-top: 20px;
  font-size: 16px;
}

/* ========================================================
   7. 폼 화면 헤더 (다시 촬영 버튼)
   ======================================================== */
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.form-header h2 {
  margin: 0;
  font-size: 20px;
  color: #1a202c;
}

.btn-back-camera {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.btn-back-camera svg {
  width: 16px;
  height: 16px;
  fill: #475569;
}

/* ========================================================
   8. 폼 상단 레이아웃 (수평 완벽 정렬)
   ======================================================== */
.form-top-row {
  display: flex;
  gap: 15px;
  align-items: stretch; /* 좌우 높이를 동일하게 강제 매칭 */
}

.photo-preview-box {
  width: 120px;
  height: auto; /* 고정 높이 제거! 오른쪽 높이에 알아서 맞춰짐 */
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.add-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #64748b;
  gap: 5px;
}

.add-photo-placeholder svg {
  width: 28px;
  height: 28px;
  fill: #94a3b8;
}

.add-photo-placeholder span {
  font-size: 12px;
  font-weight: bold;
}

/* 우측 인풋 영역 */
.form-top-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* 위아래 빈 공간을 동일하게 배분 */
  gap: 10px;
}

.form-top-inputs .form-group {
  margin-bottom: 0; /* 내부 마진을 없애서 좌우 어긋남 방지 */
}