/* backend/app/static/css/mobile_app_styles.css */
/* 모바일 PWA 입출고 화면의 공통 레이아웃과 컴포넌트 스타일을 담당하는 CSS 파일. */

:root {
  --bg: #f8fafc;

  --card: #ffffff;

  --text: #111827;

  --muted: #6b7280;

  --line: #e5e7eb;

  --primary: #2563eb;

  --primary-soft: #1d4ed8;

  --success: #16a34a;

  --danger: #dc2626;

  --warning: #d97706;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  padding: 12px 14px;

  background: rgba(255,255,255,0.92);

  color: var(--text);

  backdrop-filter: blur(12px);

  border-bottom: 1px solid var(--line);

  box-shadow:
    0 2px 10px rgba(0,0,0,0.04);
}

.app-title { font-size: 17px; font-weight: 800; }
.user-line { font-size: 12px; opacity: 0.78; margin-top: 2px; }

.nav-tabs {
  position: sticky;
  top: 58px;
  z-index: 9;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.nav-tabs a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.page-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 12px;
}

.card, .login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 26px rgba(17, 24, 39, 0.05);
  margin-bottom: 12px;
}
.login-card { margin: 42px auto 0; max-width: 420px; }
.action-card { border-top: 4px solid var(--primary); }

h1, h2 { margin: 0 0 12px; }
h1 { font-size: 23px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.45; }

.stack-form { display: grid; gap: 9px; }
label { font-size: 13px; font-weight: 800; color: #374151; }
input, button, select {
  font: inherit;
  border-radius: 12px;
}
input, select {
  width: 100%;
  border: 1px solid #d1d5db;
  background: white;
  padding: 13px 12px;
  font-size: 16px;
}

button {
  border: none;
  font-weight: 800;
  cursor: pointer;
  padding: 12px 14px;
}
.primary-button {
  background:
    linear-gradient(
      135deg,
      #2563eb,
      #1d4ed8
    );

  color: white;

  box-shadow:
    0 8px 18px rgba(37,99,235,0.24);

  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.primary-button:active {
  transform: scale(0.98);

  box-shadow:
    0 4px 10px rgba(37,99,235,0.20);
}
.secondary-button {
  background: #f3f4f6;

  color: var(--text);

  border: 1px solid #d1d5db;
}
.ghost-button {
  background: #f3f4f6;

  color: var(--text);

  border: 1px solid #d1d5db;
}
.full { width: 100%; margin-top: 8px; }

.scan-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.qty-row {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}
.qty-row input { font-size: 22px; font-weight: 800; text-align: right; }

.candidate-list, .history-list { display: grid; gap: 8px; margin-top: 12px; }
.candidate-card, .history-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
}
.candidate-card { cursor: pointer; }
.candidate-card:hover { background: #f9fafb; }
.item-name { font-weight: 850; font-size: 15px; line-height: 1.35; }
.item-meta { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.5; }
.qty-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f3f4f6;
  font-size: 12px;
  font-weight: 800;
}
.status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 12px;
  font-weight: 800;
}

.selected-product {
  margin-top: 12px;

  border: 2px solid #93c5fd;

  background: #eff6ff;

  border-radius: 18px;

  padding: 14px;

  box-shadow:
    0 4px 14px rgba(59,130,246,0.10);
}

/* 카메라 스캔창 완전 고정 */
.scanner-panel {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 999999 !important;

  width: 100vw !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;

  overflow: hidden !important;
  background: #000 !important;
  padding: 12px !important;

  display: grid !important;
  grid-template-rows: minmax(0, 1fr) 68px !important;
  gap: 10px !important;
}

.scanner-panel.hidden {
  display: none !important;
}

.scanner-panel video,
#scannerVideo {
  display: block !important;

  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;

  object-fit: contain !important;
  background: #000 !important;
  border-radius: 16px !important;
}

#stopScanButton {
  width: 100% !important;
  height: 68px !important;
  min-height: 68px !important;
  max-height: 68px !important;

  margin: 0 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  border-radius: 16px !important;
}
.hidden { display: none !important; }

.message-box { min-height: 22px; margin-top: 10px; font-size: 14px; font-weight: 700; }
.message-box.success { color: var(--success); }
.message-box.error { color: var(--danger); }
.alert { padding: 11px; border-radius: 12px; margin: 10px 0; font-size: 14px; font-weight: 700; }
.alert.success { background: #ecfdf5; color: var(--success); }
.alert.error { background: #fef2f2; color: var(--danger); }
.hint-box { background: #f9fafb; border: 1px dashed #d1d5db; border-radius: 12px; padding: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.section-header input { max-width: 170px; padding: 9px 10px; font-size: 14px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary-grid div { background: #f9fafb; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.summary-grid b { display: block; font-size: 22px; }
.summary-grid span { color: var(--muted); font-size: 12px; }
.summary-line { color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 8px; }

@media (max-width: 640px) {
  .scan-actions { grid-template-columns: 1fr; }
  .section-header { align-items: stretch; flex-direction: column; }
  .section-header input { max-width: none; }
  .summary-grid { grid-template-columns: 1fr; }
}

/* 모바일/HTTPS 바코드 스캔 개선 영역 */
.camera-notice {
  margin: 10px 0 12px;
  padding: 12px 13px;
  border-radius: 14px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}
.camera-notice.success {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.disabled-button,
button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.scan-big-button,
.save-big-button {
  min-height: 58px;

  font-size: 19px;

  border-radius: 18px;

  background:
    linear-gradient(
      135deg,
      #2563eb,
      #1d4ed8
    );

  color: white;

  box-shadow:
    0 8px 18px rgba(37,99,235,0.24);
}
.mobile-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.mobile-only-text { margin: -6px 0 8px; }
.history-actions { margin-top: 8px; }
.small-danger-button {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 13px;
}

@media (max-width: 640px) {
  body {
  background: #f8fafc;
}
  .topbar { padding: 14px 14px; }
  .app-title { font-size: 20px; }
  .user-line { font-size: 13px; }
  .nav-tabs { top: 64px; padding: 10px 12px; }
  .nav-tabs a { font-size: 16px; padding: 10px 14px; }
  .page-shell { padding: 10px; }
  .card,
.login-card {
  background: var(--card);

  border: 1px solid var(--line);

  border-radius: 22px;

  padding: 16px;

  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 10px 28px rgba(0,0,0,0.05);

  margin-bottom: 14px;
}
  h1 { font-size: 30px; letter-spacing: -0.03em; }
  h2 { font-size: 22px; }
  .muted { font-size: 16px; }
  label { font-size: 16px; }
  input, select {
    min-height: 56px;
    font-size: 20px;
    border-radius: 16px;
  }
  button {
    min-height: 52px;
    font-size: 17px;
    border-radius: 16px;
  }
  .mobile-scan-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .search-row { grid-template-columns: 1fr 82px; }
  .scan-big-button,
  .save-big-button {
    min-height: 68px;
    font-size: 22px;
  }
  .mobile-qty-row input {
    min-height: 72px;
    font-size: 36px;
    font-weight: 900;
  }
  .candidate-card, .history-card, .selected-product {
    border-radius: 18px;
    padding: 15px;
  }
  .item-name { font-size: 19px; line-height: 1.35; }
  .item-meta { font-size: 15px; line-height: 1.55; }
  .qty-badge, .status-badge {
    font-size: 14px;
    padding: 6px 10px;
    margin-top: 3px;
  }
  
  .message-box { font-size: 16px; min-height: 28px; }
  .summary-line { font-size: 15px; }
}

/* 20260510-scan-tune-1: 후면 카메라 스캔 가이드/고정 영역 */
.scanner-panel {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  width: 100vw !important;
  height: 100dvh !important;
  overflow: hidden !important;
  background: #000 !important;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)) !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) 68px !important;
  gap: 10px !important;
}
.scanner-panel.hidden { display: none !important; }
.scanner-panel video,
#scannerVideo {
  grid-row: 1 !important;
  grid-column: 1 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  object-fit: contain !important;
  background: #000 !important;
  border-radius: 16px !important;
}
.scan-guide-layer {
  grid-row: 1 !important;
  grid-column: 1 !important;
  position: relative !important;
  z-index: 2 !important;
  pointer-events: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 14px !important;
}
.scan-guide-box {
  width: min(86vw, 520px) !important;
  height: min(30vh, 210px) !important;
  border: 4px solid rgba(34, 197, 94, 0.95) !important;
  border-radius: 18px !important;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.28), 0 0 18px rgba(34,197,94,0.55) inset !important;
  position: relative !important;
}
.scan-guide-line {
  position: absolute !important;
  left: 7% !important;
  right: 7% !important;
  top: 50% !important;
  height: 3px !important;
  background: rgba(239, 68, 68, 0.92) !important;
  transform: translateY(-50%) !important;
  box-shadow: 0 0 8px rgba(239,68,68,0.8) !important;
}
.scan-guide-text {
  color: #fff !important;
  background: rgba(0,0,0,0.65) !important;
  border: 1px solid rgba(255,255,255,0.28) !important;
  border-radius: 999px !important;
  padding: 9px 13px !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  text-align: center !important;
}
#stopScanButton {
  grid-row: 2 !important;
  width: 100% !important;
  height: 68px !important;
  min-height: 68px !important;
  max-height: 68px !important;
  margin: 0 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  border-radius: 16px !important;
  position: relative !important;
  z-index: 3 !important;
}
