/* =============================================
   HCE-DMS 공통 CSS
   - 다크 테마
   - 태블릿/폰 모두 핸드폰처럼 고정폭 표시
   ============================================= */

*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* 스크롤바 숨김 — 스크롤은 되지만 막대는 보이지 않게(앱 WebView + 시연 웹 공통).
   모든 스크롤 영역(body·.content·#aheadList·.yard-list 등)에 일괄 적용. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* iOS Safari/WebView의 자동 글자 확대(text inflation) 차단 — 애니메이션·스크롤 중 글자 크기 변동 방지 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ── 페이지 전환 스무스 (MPA View Transitions) ──
   같은 도메인 내 페이지 이동 시 흰색 번쩍임 없이 부드럽게 크로스페이드.
   미지원 브라우저는 자동으로 기존(즉시 이동) 동작으로 폴백. */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .22s;
  animation-timing-function: ease;
}

html, body {
  height: 100%;
  background: #02080f;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  color: #e2e8f0;
  overflow: hidden;
  /* 핀치줌 비활성화 */
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

/* ── 앱 래퍼: 폰·태블릿 모두 전체 화면 채우기 ── */
.app-wrapper {
  width: 100%;
  height: 100dvh;
  margin: 0;
  background: #07111f;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  /* 페이지 진입 시 fade-in (모든 WebView 버전에서 동작).
     View Transitions 미지원 환경에서도 폰에서 부드러운 전환 보장. */
  animation: pageFadeIn .22s ease both;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── 상단 앱바 ── */
.app-bar {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 52px;
  background: #0a1628;
  border-bottom: 1px solid #1e2d45;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.app-bar-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -.3px;
}

.back-btn {
  font-size: 22px;
  color: #90caf9;
  padding: 8px;
  cursor: pointer;
  margin-left: -8px;
}

.app-bar-action {
  font-size: 22px;
  color: #90caf9;
  padding: 8px;
  margin-right: -8px;
  cursor: pointer;
}

/* ── 스크롤 콘텐츠 영역 ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 0;
  -webkit-overflow-scrolling: touch;
}

.content::-webkit-scrollbar { display: none; }

/* ── 하단 네비게이션 ── */
.bottom-nav {
  display: flex;
  height: 78px;
  background: #0a1628;
  border-top: 1px solid #1e2d45;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  color: #78909c;
  font-size: 13px;
  font-weight: 700;
}

.nav-item.active { color: #29b6f6; }

.nav-icon {
  font-size: 28px;
  line-height: 1;
  /* 미선택 메뉴 아이콘은 흑백, 선택(active)만 컬러 */
  filter: grayscale(1);
  opacity: .55;
}

.nav-item.active .nav-icon {
  filter: none;
  opacity: 1;
}

/* ── 카드 ── */
.card {
  background: #1a2840;
  border-radius: 14px;
  padding: 4px 16px;
  margin-bottom: 12px;
  border: 1px solid #1e2d45;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid #1e2d45;
}

.card-row:last-child { border-bottom: none; }

.card-label {
  font-size: 14px;
  color: #90a4ae;
  font-weight: 500;
}

.card-value {
  font-size: 16px;
  color: #e2e8f0;
  font-weight: 700;
  text-align: right;
}

/* ── 버튼 ── */
.btn-primary {
  width: 100%;
  padding: 20px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(21,101,192,.4);
  letter-spacing: .5px;
  transition: opacity .15s;
}

.btn-primary:active { opacity: .85; }

.btn-secondary {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: 1.5px solid #37474f;
  background: #1a2840;
  color: #90caf9;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
  transition: opacity .15s;
}

.btn-secondary:active { opacity: .8; }

/* ── 알림 박스 ── */
.alert-box {
  background: #1a2840;
  border-left: 4px solid #1565c0;
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #90caf9;
  line-height: 1.6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* ── 섹션 패딩 ── */
.section { margin-bottom: 14px; }

/* ── 입력 ── */
.form-input {
  width: 100%;
  background: #0f1e32;
  border: 1.5px solid #37474f;
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 16px;
  color: #e2e8f0;
  font-family: inherit;
  outline: none;
}

.form-input:focus { border-color: #1565c0; }

/* ── 로딩 스피너 ── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid #1e2d45;
  border-top-color: #29b6f6;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 스크롤 허용 (touch-action 재정의) */
.content, .ob-body, .ob-form {
  touch-action: pan-y;
}

/* =============================================================
   화이트(라이트) 테마 — html[data-theme="light"] 일 때만 적용.
   · 레이아웃/구조/내용은 그대로, "색상만" 화이트풍으로 치환.
   · 다크(블랙풍) 기본값은 위에서 그대로 유지 → 회귀 없음.
   · 테마 주입은 각 페이지 <head>의 인라인 스크립트가 localStorage('hcedms_theme')로 결정.
   · 적용 페이지: 로그인 / 출발 준비 / 안전 점검 / 운송 중 (그 외 페이지는 속성 미설정 → 영향 없음)
   ============================================================= */
html[data-theme="light"],
html[data-theme="light"] body {
  background: #e9eef5;
  color: #1f2a37;
}
html[data-theme="light"] .app-wrapper { background: #f4f7fb; }

html[data-theme="light"] .app-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}
html[data-theme="light"] .app-bar-title { color: #1f2a37; }
html[data-theme="light"] .back-btn,
html[data-theme="light"] .app-bar-action { color: #1565c0; }

html[data-theme="light"] .card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(16,42,80,.06);
}
html[data-theme="light"] .card-row { border-bottom-color: #eef2f7; }
html[data-theme="light"] .card-label { color: #64748b; }
html[data-theme="light"] .card-value { color: #1f2a37; }

html[data-theme="light"] .btn-secondary {
  background: #ffffff; border-color: #cbd5e1; color: #1565c0;
}
html[data-theme="light"] .alert-box {
  background: #eef4ff; color: #1d4ed8; border-left-color: #1565c0;
}
html[data-theme="light"] .form-input {
  background: #ffffff; border-color: #cbd5e1; color: #1f2a37;
}
/* 하단 탭 네비게이션(하역 담당자 등) */
html[data-theme="light"] .bottom-nav {
  background: #ffffff; border-top: 1px solid #e2e8f0;
}
html[data-theme="light"] .nav-item { color: #64748b; }
html[data-theme="light"] .nav-item.active { color: #1565c0; }
/* .btn-primary(블루 그라데이션)는 양쪽 테마 모두 그대로 사용 — 변경 없음 */
