/* ──────────────────────────────────────────
   CareNara 모바일 앱 전용 스타일
   요양보호사 앱 / 보호자 앱 공통
   ────────────────────────────────────────── */

/* ── 모바일 앱 래퍼 ── */
.mobile-app {
  min-height: 100vh;
  background: #f0f4ff;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ── 모바일 앱 헤더 ── */
.app-header {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #fff;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.app-header-title {
  font-size: 1.0625rem;
  font-weight: 700;
}

.app-header-sub {
  font-size: 0.75rem;
  opacity: .8;
  margin-top: 2px;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 하단 탭 네비게이션 ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}

.tab-btn-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  gap: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.6875rem;
  font-weight: 500;
  transition: color .15s;
}
.tab-btn-nav.active { color: #2563eb; }
.tab-btn-nav:hover  { color: #475569; }
.tab-icon { font-size: 1.25rem; line-height: 1; }

/* ── 앱 콘텐츠 영역 (하단 탭 높이만큼 패딩) ── */
.app-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

/* ── 섹션 카드 ── */
.app-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.app-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── 방문 일정 카드 ── */
.visit-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid #2563eb;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: relative;
}
.visit-card.completed  { border-left-color: #16a34a; opacity: .85; }
.visit-card.in_progress { border-left-color: #d97706; }
.visit-card.cancelled  { border-left-color: #94a3b8; opacity: .6; }

.visit-time {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 4px;
}
.visit-client {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}
.visit-address {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.visit-badge {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge-scheduled   { background: #eff6ff; color: #2563eb; }
.badge-in_progress { background: #fef3c7; color: #d97706; }
.badge-completed   { background: #dcfce7; color: #16a34a; }
.badge-cancelled   { background: #f1f5f9; color: #64748b; }

/* ── GPS 버튼 ── */
.gps-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.gps-btn {
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity .15s, transform .1s;
}
.gps-btn:active { transform: scale(.97); }
.gps-btn:disabled { opacity: .45; cursor: not-allowed; }
.gps-btn-checkin  { background: #2563eb; color: #fff; }
.gps-btn-checkout { background: #16a34a; color: #fff; }
.gps-btn-log      { background: #7c3aed; color: #fff; grid-column: 1 / -1; }

/* ── 케어일지 체크리스트 ── */
.care-section {
  margin-bottom: 16px;
}

.care-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #f1f5f9;
}

.care-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.care-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s, background .15s;
}
.care-check-item.checked {
  background: #eff6ff;
  border-color: #93c5fd;
}
.care-check-item input[type="checkbox"] {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}
.care-check-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
}

/* ── 통계 요약 카드 ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-mini {
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.stat-mini-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}
.stat-mini-label {
  font-size: 0.6875rem;
  color: #64748b;
  margin-top: 4px;
}

/* ── 보호자 달력 ── */
.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 8px;
}

.cal-day-header {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: default;
  position: relative;
}
.cal-day.today { background: #2563eb; color: #fff; font-weight: 700; }
.cal-day.has-visit { background: #eff6ff; color: #2563eb; font-weight: 600; }
.cal-day.completed-visit { background: #dcfce7; color: #16a34a; font-weight: 600; }
.cal-day.other-month { color: #cbd5e1; }

.cal-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  position: absolute;
  bottom: 3px;
}

/* ── 실시간 모니터링 ── */
.monitor-header {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  padding: 20px 24px 16px;
  border-radius: 14px;
  margin-bottom: 20px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.monitor-stat {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border-top: 3px solid;
}
.monitor-stat.blue   { border-top-color: #2563eb; }
.monitor-stat.green  { border-top-color: #16a34a; }
.monitor-stat.orange { border-top-color: #d97706; }
.monitor-stat.red    { border-top-color: #dc2626; }

/* ── 전자계약서 서명 캔버스 ── */
.signature-wrap {
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.signature-canvas {
  width: 100%;
  height: 200px;
  touch-action: none;  /* 스크롤 방지 */
  cursor: crosshair;
  display: block;
}

.signature-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8125rem;
  color: #cbd5e1;
  pointer-events: none;
  text-align: center;
}
.signature-canvas.signed + .signature-label { display: none; }

.signature-clear-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.12);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* ── EIS 리포트 프린트 스타일 ── */
@media print {
  .bottom-nav, .app-header, .no-print { display: none !important; }
  .app-content { padding: 0 !important; }
  .app-card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  body { background: #fff !important; }
}

/* ── 알림 배지 ── */
.notification-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: #dc2626;
  color: #fff;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── 빈 상태 ── */
.app-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
}
.app-empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.app-empty-text { font-size: 0.875rem; }

/* ── 로딩 스피너 ── */
.app-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
