/* ============================================================
   Modal - Overlay, Toast, Confirm
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header .modal-title {
  font-weight: 800;
  font-size: var(--text-xl);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  cursor: pointer;
  font-size: var(--text-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-family: inherit;
}

.modal-close:hover { background: var(--bg-subtle); border-color: var(--text-muted); }
.modal-close:focus-visible { outline: none; border-color: var(--ad-primary); box-shadow: var(--focus-ring); }

.modal-body { padding: var(--space-5) var(--space-6); }

/* 알림 처리 모달 — 처리 유형 선택 카드 (Step 1) */
.alert-action-card {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: all 0.15s;
}
.alert-action-card:hover {
  border-color: var(--text-muted);
  background: var(--bg);
  transform: translateX(2px);
}

/* 알림 처리 모달 — 조치 유형 토글 칩 (Step 2) */
.sub-cat-btn {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--caution-border);
  border-radius: 20px;
  background: var(--white);
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  color: var(--caution);
  font-family: inherit;
  transition: all var(--transition-fast);
}
.sub-cat-btn:hover { background: var(--caution-light); }
.sub-cat-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.25); }
.sub-cat-btn.active {
  background: var(--caution);
  color: white;
  border-color: var(--caution);
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: var(--text-base);
  font-weight: 600;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 280px;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: currentColor;
  opacity: 0.3;
  width: 100%;
  animation: toastProgress linear forwards;
}

@keyframes toastProgress { from { width: 100%; } to { width: 0%; } }

.toast.leaving { animation: toastOut 0.25s ease forwards; }

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast.success { background: rgba(16, 185, 129, 0.9); color: white; border-color: rgba(16, 185, 129, 0.2); }
.toast.info { background: rgba(59, 130, 246, 0.9); color: white; border-color: rgba(59, 130, 246, 0.2); }
.toast.warning { background: rgba(234, 179, 8, 0.9); color: white; border-color: rgba(234, 179, 8, 0.2); }
.toast.error { background: rgba(239, 68, 68, 0.9); color: white; border-color: rgba(239, 68, 68, 0.2); }

.toast.success .toast-dot,
.toast.info .toast-dot,
.toast.warning .toast-dot,
.toast.error .toast-dot { background: rgba(255,255,255,0.5); }

.toast.success .toast-msg,
.toast.info .toast-msg,
.toast.warning .toast-msg,
.toast.error .toast-msg { color: white; }

.toast.success .toast-close,
.toast.info .toast-close,
.toast.warning .toast-close,
.toast.error .toast-close { color: rgba(255,255,255,0.7); }

.toast.success .toast-close:hover,
.toast.info .toast-close:hover,
.toast.warning .toast-close:hover,
.toast.error .toast-close:hover { color: white; }

.toast-msg { flex: 1; color: var(--text); }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-md);
  padding: 0 2px;
  flex-shrink: 0;
}

.toast-close:hover { color: var(--text); }

@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ---- Confirm dialog ---- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}

.confirm-overlay.active { opacity: 1; }

.confirm-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--space-6) var(--space-8) var(--space-6);
  min-width: 320px;
  max-width: 400px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.16);
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-overlay.active .confirm-box { transform: scale(1); }

.confirm-msg {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  margin-bottom: var(--space-6);
  color: var(--text);
}

.confirm-actions { display: flex; gap: var(--space-2); }

.confirm-cancel, .confirm-ok {
  flex: 1;
  padding: var(--space-3) 0;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity var(--transition);
}

.confirm-cancel {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.confirm-cancel:hover { background: var(--border-light); }
.confirm-cancel:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.confirm-ok { background: var(--danger); color: white; }
.confirm-ok:hover { opacity: 0.9; }
.confirm-ok:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3); }

/* ── 종 알림 드롭다운 — 한 줄 리스트 아이템 ───────────────── */
.notif-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-1);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-subtle); }

.notif-item .timeline-dot { width: 30px; height: 30px; font-size: var(--text-md); }

.notif-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  white-space: nowrap;
}
.notif-main .notif-name  { font-weight: 700; flex-shrink: 0; }
.notif-main .notif-title { color: var(--text-secondary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.notif-main .notif-zone  { color: var(--text-muted); font-size: var(--text-sm); flex-shrink: 0; }

.notif-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.notif-meta .notif-time { font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* 알림함(showNotifications) "더보기" 버튼 & 상태 메시지 */
.notif-more-btn {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.notif-more-btn:hover { background: var(--bg-subtle); }
.notif-more-btn--danger { color: var(--danger); }
.notif-more-btn .notif-more-count { color: var(--text-muted); font-weight: 500; }
.notif-list-msg { text-align: center; padding: 12px; color: var(--text-muted); font-size: 12px; }

/* 알림 카드 — 근로자 이름 / 칩(메시지·카테고리) 행 (반복 정적 스타일) */
.alert-worker-name { font-weight: 800; font-size: 15px; }
.modal-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* 알림 처리완료 정보 박스 */
.alert-done-box { background: var(--success-light); border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; }
.alert-done-title { font-size: 13px; font-weight: 700; color: var(--success); margin-bottom: 6px; }
.alert-done-body { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.alert-done-note { margin-top: 6px; padding: 10px; background: var(--white); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); font-style: italic; }

/* 알림 처리 메모 textarea (stg-form-input과 병행 — 비충돌 속성만 추가) */
.alert-note-textarea { min-height: 80px; resize: vertical; line-height: 1.5; }

/* 알림함 — 카운트 라벨 / 에러 메시지 */
.notif-count-label { font-size: 12px; color: var(--text-muted); font-weight: 700; padding: 2px 4px 10px; }
.notif-error-msg { text-align: center; padding: 20px; color: var(--danger); }

/* 알림 처리 — 뒤로가기 링크 / 처리유형 배지 / 카드 제목 */
.alert-back-link { cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--ad-primary); font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.alert-type-icon { font-size: 18px; }
.alert-type-label { font-weight: 700; font-size: 14px; }
.alert-card-title { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

/* 알림 처리 — 처리 방법 선택 */
.alert-process-q { font-size: 15px; font-weight: 800; margin-bottom: 14px; letter-spacing: -0.02em; }
.alert-action-list { display: flex; flex-direction: column; gap: 8px; }
.alert-action-textwrap { flex: 1; }
.alert-action-title { font-weight: 700; font-size: 14px; color: var(--text); }
.alert-action-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alert-action-chevron { color: var(--text-muted); font-size: 14px; }

/* 알림 상세 모달 — 부제 / 정보 그리드 / 시각 박스 / 미처리 안내 */
.alert-card-subtitle { font-size: 13px; color: var(--text-secondary); }
.alert-info-grid { display: flex; gap: 12px; margin-bottom: 16px; }
.alert-info-val { font-size: 14px; font-weight: 700; margin-top: 4px; }
.alert-time-box { background: var(--bg); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 16px; font-size: 13px; }
.alert-pending-notice { padding: 16px; background: var(--caution-light); border: 1px solid var(--caution-border); border-radius: var(--radius-sm); text-align: center; color: var(--caution); font-size: 13px; font-weight: 600; }
