/* =========================================================================
   app-ui.css  - 공용 UI 스타일 (토스 스타일 알림/확인 다이얼로그, 날짜/시간 선택기)
   다른 페이지에서도 <link> 로 불러와 같이 쓸 수 있어요.
   짝꿍 스크립트: assets/js/app-dialog.js, assets/js/app-picker.js
   ========================================================================= */

/* =====================================================
   토스 스타일 커스텀 알림(alert) / 확인(confirm) 다이얼로그
   ===================================================== */
#appDialogOverlay {
  position: fixed; inset: 0; z-index: 100000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(25, 31, 40, 0.5);
}
#appDialogOverlay.is-open { display: flex; animation: dlgFade 0.18s ease forwards; }
@keyframes dlgFade { from { opacity: 0; } to { opacity: 1; } }
.app-dialog {
  width: 100%; max-width: 340px;
  background: #fff; border-radius: 28px;
  padding: 28px 22px 18px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(25, 31, 40, 0.3);
  animation: dlgPop 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes dlgPop {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.app-dialog__icon {
  width: 52px; height: 52px; border-radius: 999px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.app-dialog__icon svg { width: 26px; height: 26px; }
.app-dialog__icon.is-info { background: #E8F3FF; color: #3182F6; }
.app-dialog__icon.is-danger { background: #FFF0F1; color: #F04452; }
.app-dialog__title { font-size: 1.125rem; font-weight: 800; color: #191F28; line-height: 1.4; margin: 0; word-break: keep-all; }
.app-dialog__msg { margin: 8px 0 0; font-size: 0.875rem; font-weight: 500; color: #6B7684; line-height: 1.6; white-space: pre-line; word-break: keep-all; }
.app-dialog__btns { display: flex; gap: 8px; margin-top: 22px; }
.app-dialog__btn {
  flex: 1; height: 50px; border: 0; border-radius: 16px;
  font-size: 0.9375rem; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.app-dialog__btn:active { transform: scale(0.97); }
.app-dialog__btn.is-cancel { background: #F2F4F6; color: #4E5968; }
.app-dialog__btn.is-cancel:hover { background: #E5E8EB; }
.app-dialog__btn.is-primary { background: #3182F6; color: #fff; }
.app-dialog__btn.is-primary:hover { background: #1B64DA; }
.app-dialog__btn.is-danger { background: #F04452; color: #fff; }
.app-dialog__btn.is-danger:hover { background: #D93A47; }
.app-dialog__btn:focus-visible { outline: 3px solid rgba(49, 130, 246, 0.35); outline-offset: 2px; }

/* =====================================================
   토스 스타일 커스텀 날짜/시간 선택기
   ===================================================== */
.cp-trigger {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #F2F4F6;
  color: #191F28;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.cp-trigger:hover { background: #E5E8EB; }
.cp-trigger.is-open { background: #fff; border-color: #3182F6; }
.cp-trigger.is-empty .cp-text { color: #8B95A1; font-weight: 600; }
.cp-trigger .cp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-trigger svg { width: 16px; height: 16px; color: #8B95A1; flex-shrink: 0; }
.crm-date-range-box .cp-trigger { flex: 1; padding: 11px 10px; font-size: 0.8125rem; }

#cpOverlay { position: fixed; inset: 0; z-index: 99999; display: none; }
#cpOverlay.is-open { display: block; }
#cpDim { position: absolute; inset: 0; background: rgba(25, 31, 40, 0.38); }
#cpPanel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 40px rgba(25, 31, 40, 0.18);
  animation: cpUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes cpUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (min-width: 640px) {
  #cpDim { background: transparent; }
  #cpPanel {
    right: auto; bottom: auto;
    width: 320px;
    border-radius: 20px;
    border: 1px solid #E5E8EB;
    padding: 16px;
    box-shadow: 0 16px 48px rgba(25, 31, 40, 0.2);
  }
}
.cp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cp-title { font-size: 1rem; font-weight: 800; color: #191F28; }
.cp-nav {
  width: 36px; height: 36px; border-radius: 999px; border: 0;
  background: #F2F4F6; color: #4E5968; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.cp-nav:hover { background: #E5E8EB; }
.cp-nav:active { transform: scale(0.92); }
.cp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cp-week { text-align: center; font-size: 0.75rem; font-weight: 700; color: #8B95A1; padding: 6px 0; }
.cp-week.cp-sun, .cp-day.cp-sun { color: #F04452; }
.cp-week.cp-sat, .cp-day.cp-sat { color: #3182F6; }
.cp-day {
  height: 40px; border-radius: 999px; border: 0; background: transparent;
  font-size: 0.875rem; font-weight: 700; color: #191F28; cursor: pointer;
  transition: background-color 0.12s ease;
}
.cp-day:hover { background: #F2F4F6; }
.cp-day.is-other { opacity: 0.35; }
.cp-day.is-today { box-shadow: inset 0 0 0 1.5px #3182F6; }
.cp-day.is-selected, .cp-day.is-selected:hover { background: #3182F6; color: #fff !important; box-shadow: none; opacity: 1; }
.cp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid #F2F4F6; }
.cp-link { border: 0; background: transparent; color: #3182F6; font-size: 0.8125rem; font-weight: 800; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.cp-link:hover { background: #E8F3FF; }
.cp-time-cols { display: flex; gap: 8px; }
.cp-col { position: relative; flex: 1; max-height: 208px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 2px; scrollbar-width: thin; }
.cp-item {
  flex-shrink: 0; height: 40px; border-radius: 12px; border: 0; background: transparent;
  font-size: 0.9375rem; font-weight: 700; color: #4E5968; cursor: pointer;
  transition: background-color 0.12s ease;
}
.cp-item:hover { background: #F2F4F6; }
.cp-item.is-selected { background: #E8F3FF; color: #3182F6; font-weight: 800; }
.cp-confirm {
  width: 100%; margin-top: 12px; height: 48px; border: 0; border-radius: 14px;
  background: #3182F6; color: #fff; font-size: 0.9375rem; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.cp-confirm:hover { background: #1B64DA; }
.cp-confirm:active { transform: scale(0.98); }