/* ══════════════════════════════════════════════════════
   BLOOM PICKER — Custom Date & Time Picker
   프리지아 웨딩 플랫폼 전용 날짜/시간 선택기
   Version: 1.0.0
   모바일 최적화 · 터치 친화 · 프리지아 디자인 토큰 기반
══════════════════════════════════════════════════════ */

/* ─── 공통 오버레이 ─── */
.bp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.bp-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ─── 트리거 인풋 스타일링 ─── */
.bp-trigger {
  position: relative;
  cursor: pointer;
}
.bp-trigger input {
  cursor: pointer !important;
  padding-right: 40px !important;
}
.bp-trigger-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--ink-60);
  pointer-events: none;
  transition: color .2s;
}
.bp-trigger:hover .bp-trigger-icon,
.bp-trigger:focus-within .bp-trigger-icon {
  color: var(--terracotta);
}

/* ═══════════════════════════════════════
   DATE PICKER — 달력
═══════════════════════════════════════ */
.bp-calendar {
  position: fixed;
  z-index: 9001;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.04);
  width: 340px;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.97);
  transition: all .25s var(--spring);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.bp-calendar.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* 헤더 */
.bp-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--ink-10);
}
.bp-cal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .2s;
  white-space: nowrap;
}
.bp-cal-title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.bp-cal-title:hover {
  background: var(--ink-10);
}
.bp-cal-title .bp-year {
  color: var(--ink-60);
  font-weight: 500;
  font-size: 14px;
  margin-left: 2px;
}
.bp-cal-nav {
  display: flex;
  gap: 4px;
}
.bp-cal-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-60);
  transition: all .2s;
  border: none;
  background: none;
  cursor: pointer;
}
.bp-cal-nav-btn:hover {
  background: var(--ink-10);
  color: var(--ink);
}
.bp-cal-nav-btn:active {
  transform: scale(.92);
}
.bp-cal-nav-btn svg {
  width: 18px;
  height: 18px;
}

/* 요일 헤더 */
.bp-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 12px 16px 6px;
}
.bp-cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-30);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.bp-cal-weekday:first-child { color: #EF4444; }  /* 일요일 빨강 */
.bp-cal-weekday:last-child  { color: #3B82F6; }  /* 토요일 파랑 */

/* 날짜 그리드 */
.bp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px 16px 16px;
  gap: 2px;
}
.bp-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s var(--ease);
  position: relative;
  border: none;
  background: none;
}
.bp-cal-day:hover {
  background: var(--ink-10);
}
.bp-cal-day:active {
  transform: scale(.9);
}

/* 일/토 색상 */
.bp-cal-day[data-dow="0"] { color: #EF4444; }
.bp-cal-day[data-dow="6"] { color: #3B82F6; }

/* 이전/다음달 날짜 */
.bp-cal-day.other-month {
  color: var(--ink-30);
  font-weight: 400;
}
.bp-cal-day.other-month[data-dow="0"] { color: rgba(239,68,68,.35); }
.bp-cal-day.other-month[data-dow="6"] { color: rgba(59,130,246,.35); }

/* 오늘 */
.bp-cal-day.today {
  font-weight: 700;
}
.bp-cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--terracotta);
}

/* 선택됨 */
.bp-cal-day.selected {
  background: var(--terracotta) !important;
  color: white !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}
.bp-cal-day.selected::after { display: none; }

/* 비활성 (과거 날짜 등) */
.bp-cal-day.disabled {
  color: var(--ink-30) !important;
  cursor: default;
  pointer-events: none;
}

/* 하단 */
.bp-cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--ink-10);
}
.bp-cal-today-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--terracotta);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background .2s;
  border: none;
  background: none;
}
.bp-cal-today-btn:hover {
  background: var(--terra-lt);
}
.bp-cal-clear-btn {
  font-size: 13px;
  color: var(--ink-60);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all .2s;
  border: none;
  background: none;
}
.bp-cal-clear-btn:hover {
  background: var(--ink-10);
  color: var(--ink);
}

/* 월 선택 뷰 */
.bp-cal-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px;
}
.bp-cal-month-btn {
  padding: 14px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
}
.bp-cal-month-btn:hover {
  background: var(--ink-10);
}
.bp-cal-month-btn.current {
  background: var(--terra-lt);
  color: var(--terracotta);
  font-weight: 700;
}
.bp-cal-month-btn.selected {
  background: var(--terracotta);
  color: white;
  font-weight: 700;
}

/* 년도 선택 뷰 */
.bp-cal-years {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 16px;
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bp-cal-year-btn {
  padding: 12px 6px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
}
.bp-cal-year-btn:hover {
  background: var(--ink-10);
}
.bp-cal-year-btn.current {
  background: var(--terra-lt);
  color: var(--terracotta);
  font-weight: 700;
}
.bp-cal-year-btn.selected {
  background: var(--terracotta);
  color: white;
  font-weight: 700;
}


/* ═══════════════════════════════════════
   TIME PICKER — 시간
═══════════════════════════════════════ */
.bp-time {
  position: fixed;
  z-index: 9001;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.04);
  width: 300px;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.97);
  transition: all .25s var(--spring);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.bp-time.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* 타임피커 헤더 */
.bp-time-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--ink-10);
}
.bp-time-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.bp-time-header p {
  font-size: 12px;
  color: var(--ink-60);
  margin-top: 2px;
}

/* 시간 디스플레이 (드럼 롤러) */
.bp-time-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 20px;
}
.bp-time-col {
  position: relative;
  width: 80px;
  height: 160px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--ink-10);
}
/* 중앙 하이라이트 */
.bp-time-col::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 44px;
  transform: translateY(-50%);
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  z-index: 1;
  pointer-events: none;
}
/* 그라데이션 마스크 */
.bp-time-col::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(243,244,246,.95) 0%,
    rgba(243,244,246,0) 30%,
    rgba(243,244,246,0) 70%,
    rgba(243,244,246,.95) 100%
  );
  z-index: 2;
  pointer-events: none;
}

.bp-time-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: y mandatory;
  z-index: 3;
}
.bp-time-scroll::-webkit-scrollbar { display: none; }

.bp-time-scroll-pad {
  /* 상하 여백 = (컨테이너높이 - 아이템높이) / 2 */
  height: 58px;
}
.bp-time-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-30);
  scroll-snap-align: center;
  transition: color .15s, transform .15s;
  cursor: pointer;
}
.bp-time-item.active {
  color: var(--ink);
  font-weight: 700;
  transform: scale(1.05);
}

.bp-time-sep {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-30);
  padding: 0 2px;
  margin-top: -4px;
}

/* AM/PM 선택 */
.bp-time-ampm {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 8px;
}
.bp-ampm-btn {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-60);
  background: var(--ink-10);
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.bp-ampm-btn.active {
  background: var(--terracotta);
  color: white;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}

/* 빠른 시간 선택 */
.bp-time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 16px;
  justify-content: center;
}
.bp-time-preset {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-60);
  background: var(--ink-10);
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.bp-time-preset:hover {
  background: var(--terra-lt);
  color: var(--terracotta);
}
.bp-time-preset.active {
  background: var(--terracotta);
  color: white;
}

/* 타임피커 하단 */
.bp-time-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--ink-10);
}
.bp-time-confirm {
  padding: 9px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: var(--terracotta);
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.bp-time-confirm:hover {
  background: var(--terra-dk);
}
.bp-time-confirm:active {
  transform: scale(.96);
}


/* ═══════════════════════════════════════
   MOBILE — 모바일 최적화
═══════════════════════════════════════ */
@media (max-width: 768px) {
  /* 달력 - 하단 시트 모드 */
  .bp-calendar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    box-shadow: 0 -10px 40px rgba(0,0,0,.15);
  }
  .bp-calendar.show {
    transform: translateY(0);
  }

  /* 모바일 드래그 핸들 */
  .bp-cal-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--ink-30);
    margin: 10px auto 0;
  }

  .bp-cal-header {
    padding: 14px 20px 12px;
  }
  .bp-cal-title {
    font-size: 17px;
  }
  .bp-cal-nav-btn {
    width: 40px;
    height: 40px;
  }
  .bp-cal-weekday {
    font-size: 12px;
  }
  .bp-cal-day {
    font-size: 15px;
    border-radius: 14px;
  }

  /* 타임피커 - 하단 시트 */
  .bp-time {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 80vh;
    transform: translateY(100%);
    box-shadow: 0 -10px 40px rgba(0,0,0,.15);
  }
  .bp-time.show {
    transform: translateY(0);
  }
  .bp-time-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--ink-30);
    margin: 10px auto 0;
  }

  .bp-time-col {
    width: 90px;
    height: 180px;
  }
  .bp-time-item {
    height: 48px;
    font-size: 24px;
  }
  .bp-time-col::before {
    height: 48px;
  }
  .bp-time-scroll-pad {
    height: 66px;
  }
  .bp-time-preset {
    padding: 9px 16px;
    font-size: 13px;
  }
  .bp-time-confirm {
    padding: 12px 28px;
    font-size: 15px;
  }
}

/* 초소형 모바일 */
@media (max-width: 360px) {
  .bp-calendar {
    border-radius: 20px 20px 0 0;
  }
  .bp-cal-grid {
    padding: 4px 12px 14px;
  }
  .bp-cal-day {
    font-size: 14px;
    border-radius: 10px;
  }
  .bp-time-col {
    width: 76px;
  }
}

/* 데스크톱에서 핸들 숨김 */
@media (min-width: 769px) {
  .bp-cal-handle,
  .bp-time-handle {
    display: none;
  }
}

/* ─── 트랜지션 ─── */
.bp-cal-grid {
  animation: bpFadeIn .2s var(--ease);
}
.bp-cal-months,
.bp-cal-years {
  animation: bpFadeIn .2s var(--ease);
}
@keyframes bpFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
