@charset "UTF-8";

/* ARLGGL 모바일 최적화 스타일 */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-dark: #0f172a;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", Roboto, sans-serif;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden; /* 가로 스크롤/삐져나옴 원천 차단 */
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: calc(85px + var(--safe-bottom));
  min-height: 100vh;
}

/* 상단 헤더 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  width: 100%;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 6px;
}

/* 상단 전송 실패 알림 배지 */
.failure-alert-banner {
  background: #fee2e2;
  border-bottom: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  width: 100%;
}

/* 폼 컨테이너 (모바일 너비 100% 최적화) */
.form-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
}

.section-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  width: 100%;
}

.label-title {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 인풋 기본 스타일 (모바일 너비 100% 꼭 맞춤) */
.input-base {
  width: 100%;
  max-width: 100%;
  height: 50px;
  font-size: 16px; /* iOS 자동 줌 방지 */
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}

.input-base:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 차량번호 직접 입력 전용 인풋 (크고 시원하게) */
.plate-input-direct {
  height: 54px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  border: 2px solid var(--border);
  background: #ffffff;
}

.plate-input-direct:focus {
  border-color: var(--primary);
  background: #f0f7ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* 호수 직접 입력 전용 인풋 */
.ho-input-direct {
  height: 52px;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  border: 2px solid var(--border);
}

.ho-input-direct:focus {
  border-color: var(--primary);
  background: #f0f7ff;
}

/* 칩 그룹 (가로 랩핑 및 터치 최적화) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.chip-btn {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 68px;
  padding: 12px 6px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #f8fafc;
  color: #334155;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  user-select: none;
  text-align: center;
}

.chip-btn:active {
  transform: scale(0.96);
}

.chip-btn.selected {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3);
}

/* 방문 목적 칩 (가로 배치) */
.note-chip {
  flex: 1 1 calc(33.333% - 8px);
  font-size: 14px;
}

/* 하단 고정 등록 버튼 (Sticky Bottom) */
.sticky-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 35;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}

.btn-submit {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 56px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: all 0.15s;
}

.btn-submit:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* 등록 완료 & 5초 실행취소 배너 */
.undo-banner {
  position: fixed;
  top: 65px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4);
  z-index: 50;
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.undo-progress-bar {
  height: 4px;
  background: #3b82f6;
  border-radius: 2px;
  margin-top: 10px;
  width: 100%;
  transform-origin: left;
  animation: progressDrain 5s linear forwards;
}

@keyframes progressDrain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* 모달 */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
}

.hidden { display: none !important; }
