/* KNS 거래처 관리 시스템 커스텀 스타일 */
* { font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif; }

/* ───────── 한글 IME 기본화 ─────────
 * 한글 입력이 예상되는 필드에 lang="ko" 속성을 추가하면
 * 브라우저/OS가 한글 IME를 우선 활성화하도록 힌트를 줍니다.
 * - ime-mode: 구형 Edge/Firefox 한정 지원 (Chrome은 자체 IME 관리)
 * - lang="ko": 모든 브라우저가 인식하는 표준 속성
 * - Chrome/Edge: OS IME 상태 + lang 속성을 종합해 한글 IME 우선 활성화
 */
input[lang="ko"],
textarea[lang="ko"] {
  ime-mode: active; /* deprecated but still respected by some browsers */
}
input[lang="ko"]:focus,
textarea[lang="ko"]:focus {
  ime-mode: active;
}

/* 사이드바 활성 메뉴 */
.nav-item.active {
  background-color: rgb(37 99 235);
  color: white;
}
.nav-item:hover:not(.active) {
  background-color: rgb(241 245 249);
}

/* FullCalendar 커스텀 */
.fc-theme-standard .fc-scrollgrid { border-radius: 0.5rem; overflow: hidden; }
.fc .fc-toolbar-title { font-size: 1.25rem !important; font-weight: 600; }
.fc-day-sun .fc-daygrid-day-number { color: #dc2626; }
.fc-day-sat .fc-daygrid-day-number { color: #2563eb; }
.fc-day.holiday { background-color: #fef2f2 !important; }
.fc-day.holiday .fc-daygrid-day-number { color: #dc2626 !important; font-weight: 600; }
.holiday-label {
  font-size: 0.7rem;
  color: #dc2626;
  padding: 2px 4px;
  background: #fef2f2;
  border-radius: 4px;
  margin: 2px;
  display: inline-block;
}

/* 모달 */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 0.5rem;
}
.modal-content {
  background: white;
  border-radius: 1rem;
  max-width: 32rem;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* 모바일: 더 큰 모달, 더 적은 패딩 */
@media (max-width: 640px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-content {
    border-radius: 1rem 1rem 0 0;
    max-height: 95vh;
    max-width: 100%;
    /* iOS 안전영역 대응 */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* 모바일 터치 친화: 최소 44px 터치 타겟 */
@media (max-width: 640px) {
  button, .nav-item, input[type="checkbox"], input[type="radio"] {
    min-height: 36px;
  }
  /* FullCalendar 셀 모바일 최적화 */
  .fc .fc-toolbar.fc-header-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .fc .fc-toolbar-title { font-size: 1.1rem !important; }
  .fc .fc-button { padding: 0.35em 0.65em !important; font-size: 0.8rem !important; }
  .fc .fc-daygrid-day-number { font-size: 0.75rem !important; padding: 2px 4px !important; }
  .fc .fc-event { font-size: 0.65rem !important; }
  .day-manpower { font-size: 0.55rem !important; }
}

/* 가로 스크롤 표 (모바일에서 테이블을 부드럽게 스크롤) */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 600px; }

/* 갱신 임박 배지 */
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* 인력 부족 셀 (예정 > 가용) */
.fc-day.day-shortage {
  background: repeating-linear-gradient(
    -45deg,
    #fff7ed,
    #fff7ed 6px,
    #ffedd5 6px,
    #ffedd5 12px
  ) !important;
  box-shadow: inset 0 0 0 2px #fb923c;
}
.fc-day.day-shortage.holiday {
  background: repeating-linear-gradient(
    -45deg,
    #fef2f2,
    #fef2f2 6px,
    #fee2e2 6px,
    #fee2e2 12px
  ) !important;
}

/* 일별 인력 표시 줄 */
.day-manpower {
  font-variant-numeric: tabular-nums;
}
.day-manpower i {
  margin-right: 1px;
  opacity: 0.7;
}

/* 모달 보호 — 바깥 클릭 시 흔들림 애니메이션 (입력 보호 피드백) */
@keyframes modal-shake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-6px); }
  30%, 60%, 90% { transform: translateX(6px); }
}
.animate-shake {
  animation: modal-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* 스크롤바 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
