/* 발자국(현장 영업 동선) — 선택자는 #btnFootRoute / .fr-* 로 한정 */

/* 지도 우상단: '지도 표시' 버튼 바로 아래, 동일 크기 */
#mapZoomControl #btnFootRoute {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #4b5563;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#mapZoomControl #btnFootRoute svg {
  display: block;
  width: 17px;
  height: 17px;
}

#mapZoomControl #btnFootRoute:hover {
  background: #f8f9fb;
  color: #111827;
}

#mapZoomControl #btnFootRoute:active {
  background: #f0f2f5;
  transform: scale(0.96);
}

#mapZoomControl #btnFootRoute.is-active {
  background: #2b6cff;
  border-color: #2b6cff;
  color: #fff;
}

#mapZoomControl #btnFootRoute.is-active:hover {
  background: #2563eb;
  border-color: #2563eb;
}

#mapZoomControl #btnFootRoute .fr-btn-dot {
  display: none;
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ef4444;
  animation: fr-pulse 1.4s ease-in-out infinite;
}

#mapZoomControl #btnFootRoute.is-recording .fr-btn-dot {
  display: block;
}

@keyframes fr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 900px) {
  #mapZoomControl #btnFootRoute {
    height: 32px;
    border-radius: 8px;
  }
  #mapZoomControl #btnFootRoute svg {
    width: 16px;
    height: 16px;
  }
}

/* 패널 */
.fr-panel {
  position: fixed;
  z-index: 2150;
  left: 12px;
  bottom: 12px;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  overflow: hidden;
}

.fr-panel.fr-hidden {
  display: none;
}

.fr-panel * {
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .fr-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 62vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

.fr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #f0f2f5;
}

.fr-title {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
}

.fr-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.fr-icon-btn:active {
  background: #f0f2f5;
}

.fr-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 14px;
}

.fr-panel.fr-collapsed .fr-body {
  display: none;
}

.fr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fr-btn:active {
  transform: scale(0.98);
}

.fr-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fr-btn--block {
  display: flex;
  width: 100%;
}

.fr-btn--big {
  min-height: 54px;
  font-size: 17px;
}

.fr-btn--primary {
  border-color: #2b6cff;
  background: #2b6cff;
  color: #fff;
}

.fr-btn--danger {
  border-color: #ef4444;
  background: #ef4444;
  color: #fff;
}

.fr-btn--ghost-danger {
  border-color: #fecaca;
  color: #dc2626;
}

.fr-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fr-gap {
  height: 12px;
}

.fr-muted {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}

.fr-warn {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.5;
}

.fr-error {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.5;
}

/* 기록 중 상태 */
.fr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.fr-stat {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8f9fb;
}

.fr-stat__label {
  color: #6b7280;
  font-size: 12px;
}

.fr-stat__value {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fr-signal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
}

.fr-signal__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9ca3af;
}

.fr-signal--good .fr-signal__dot { background: #22c55e; }
.fr-signal--weak .fr-signal__dot { background: #f59e0b; }
.fr-signal--none .fr-signal__dot { background: #ef4444; }

.fr-head-rec {
  display: none;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fr-panel.fr-collapsed .fr-head-rec.is-on {
  display: inline;
}

/* 폼 */
.fr-field {
  margin-bottom: 12px;
}

.fr-label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.fr-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 15px;
}

.fr-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fr-color {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #d1d5db;
  cursor: pointer;
}

.fr-color.is-selected {
  box-shadow: 0 0 0 2px #111827;
}

/* 지난 동선 */
.fr-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 8px;
}

.fr-section-title {
  font-weight: 700;
  font-size: 14px;
}

.fr-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}

.fr-switch input {
  width: 18px;
  height: 18px;
}

.fr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.fr-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
}

.fr-chip.is-selected {
  border-color: #2b6cff;
  background: #eef3ff;
  color: #1d4ed8;
  font-weight: 600;
}

.fr-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.fr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f0f2f5;
}

.fr-item__check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.fr-item__color {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
}

.fr-item__main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.fr-item__title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fr-item__sub {
  margin-top: 2px;
  color: #6b7280;
  font-size: 12px;
}

.fr-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.fr-item__edit {
  flex-shrink: 0;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  cursor: pointer;
}

.fr-empty {
  padding: 16px 0;
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
}

/* 지도 위 말풍선 */
.fr-tip {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, calc(-100% - 10px));
  pointer-events: none;
}

/* 주머니 모드: 화면 전체 검정 + 터치 차단, 길게 눌러 해제 */
.fr-pocket {
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: #000;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.fr-pocket.fr-hidden {
  display: none;
}

.fr-pocket__info {
  position: absolute;
  top: 45%;
  left: 25%;
  color: #3f3f46;
  font-size: 13px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.fr-pocket__hint {
  color: #27272a;
  font-size: 12px;
}

.fr-pocket__bar {
  width: 120px;
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: #18181b;
  overflow: hidden;
}

.fr-pocket__bar span {
  display: block;
  width: 0;
  height: 100%;
  background: #52525b;
}

.fr-pocket.is-holding .fr-pocket__bar span {
  width: 100%;
  transition: width 1.2s linear;
}

/* 기록 중 현재 위치 */
.fr-me {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35), 0 1px 4px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
}
