/* ---------- 날짜 선택 ----------
   Trigger, popover and grid follow the shadcn DatePicker: an outline button
   with a leading calendar glyph, a plain card beneath it, square-cornered
   days, and the selected day filled with the site's own ink rather than a
   colour that appears nowhere else. The blue that used to run through this
   component (#2563eb) was the only blue on the page. */

.site-calendar-picker {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.site-calendar-picker.is-enhanced > input[data-site-calendar-ready="true"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* The outline button. font-normal, not bold: it holds a value the reader
   picked, not a label. */
.site-calendar-trigger {
  display: none;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--brand-border-strong);
  border-radius: var(--ui-radius, 8px);
  background: var(--brand-bg);
  color: var(--brand-text-primary);
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.site-calendar-picker.is-enhanced > .site-calendar-trigger { display: flex; }
.site-calendar-trigger.is-placeholder { color: var(--brand-text-muted); }
.site-calendar-trigger:hover { border-color: var(--brand-text-primary); }
.site-calendar-trigger:focus-visible,
.site-calendar-picker.is-open > .site-calendar-trigger {
  border-color: var(--brand-text-primary);
  outline: 0;
  box-shadow: var(--focus-ring);
}
.site-calendar-trigger-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: currentColor;
  -webkit-mask: var(--calendar-glyph) center / contain no-repeat;
  mask: var(--calendar-glyph) center / contain no-repeat;
  --calendar-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E");
}

/* ---------- 팝오버 ---------- */

.site-calendar-popover {
  position: fixed;
  z-index: 1800;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--brand-border);
  border-radius: var(--ui-radius, 8px);
  background: var(--brand-surface);
  color: var(--brand-text-primary);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  opacity: 0;
  transform: translateY(-4px) scale(.98);
  transform-origin: top center;
  transition: opacity 140ms ease, transform 140ms ease;
}
/* 모달 안에서는 popover(맨 위 층)로 뜬다 - 브라우저 기본 popover 자리(가운데)를 지우고 left/top 을 따른다 */
.site-calendar-popover[popover] { inset: auto; margin: 0; overflow: visible; }
html[data-theme="dark"] .site-calendar-popover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .5), 0 8px 20px -6px rgba(0, 0, 0, .5);
}
.site-calendar-popover[hidden] { display: none; }
.site-calendar-popover[data-state="open"] { opacity: 1; transform: translateY(0) scale(1); }
.site-calendar-popover button {
  min-height: 0 !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  transform: none !important;
}
.site-calendar-popover button:focus-visible {
  outline: 2px solid var(--brand-text-primary);
  outline-offset: 2px;
}

/* Caption between the two arrows, the way the month name sits in shadcn. */
.site-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.site-calendar-title {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-text-primary) !important;
  font-size: var(--text-sm) !important;
  font-weight: 600 !important;
}
.site-calendar-title::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 140ms ease;
}
.site-calendar-title[aria-expanded="true"]::after { transform: rotate(225deg) translate(-1px, -1px); }
.site-calendar-navs { display: flex; align-items: center; gap: 2px; }
.site-calendar-navs button,
.site-calendar-year-nav button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: var(--ui-radius, 8px) !important;
  color: var(--brand-text-secondary);
  font-size: 18px;
  line-height: 1;
}
.site-calendar-navs button:hover,
.site-calendar-year-nav button:hover {
  background: var(--brand-surface-muted);
  color: var(--brand-text-primary);
}

/* ---------- 연·월 빠른 선택 ---------- */

.site-calendar-month-panel {
  position: absolute;
  z-index: 3;
  top: 46px;
  right: 10px;
  left: 10px;
  height: 214px;
  padding: 10px;
  border: 1px solid var(--brand-border);
  border-radius: var(--ui-radius, 8px);
  background: var(--brand-surface);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
}
.site-calendar-month-panel[hidden] { display: none; }
.site-calendar-year-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--brand-border);
}
.site-calendar-year-nav strong { font-size: var(--text-sm); font-weight: 600; }
.site-calendar-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 9px;
}
.site-calendar-months button {
  min-height: 30px !important;
  border-radius: var(--ui-radius, 8px) !important;
  font-size: var(--text-xs) !important;
  font-weight: 400 !important;
}
.site-calendar-months button:hover { background: var(--brand-surface-muted); }
.site-calendar-months button.is-selected {
  background: var(--brand-accent);
  color: var(--brand-on-accent, #fff);
  font-weight: 500 !important;
}

/* ---------- 날짜 격자 ---------- */

.site-calendar-weekdays,
.site-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  justify-items: center;
}
.site-calendar-weekdays { margin-bottom: 2px; }
.site-calendar-weekdays span {
  display: grid;
  width: 34px;
  height: 26px;
  place-items: center;
  color: var(--brand-text-muted);
  font-size: var(--text-xs);
  font-weight: 400;
}
.site-calendar-grid { min-height: 204px; }
.site-calendar-grid button {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--ui-radius, 8px) !important;
  color: var(--brand-text-primary);
  font-size: var(--text-sm) !important;
  font-weight: 400 !important;
  transition: background 120ms ease, color 120ms ease;
}
.site-calendar-grid button:hover { background: var(--brand-surface-muted); }
.site-calendar-grid button.is-outside { color: var(--brand-text-muted); opacity: .5; }
/* Today is marked by a filled cell, not a dot: at 13px a 3px dot below the
   numeral reads as a rendering artefact. */
.site-calendar-grid button.is-today { background: var(--brand-surface-muted); font-weight: 500 !important; }
.site-calendar-grid button.is-selected {
  z-index: 1;
  background: var(--brand-accent);
  color: var(--brand-on-accent, #fff);
  font-weight: 500 !important;
}
.site-calendar-grid button.is-selected:hover { background: var(--brand-accent-hover); }
.site-calendar-grid button:disabled { opacity: .24; cursor: not-allowed; }

/* ---------- 시간 · 하단 버튼 ---------- */

.site-calendar-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--brand-border);
}
.site-calendar-time > label { font-size: var(--text-sm); font-weight: 500; }
.site-calendar-time input {
  width: 126px !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 0 8px !important;
  border: 1px solid var(--brand-border-strong) !important;
  border-radius: var(--ui-radius, 8px) !important;
  background: var(--brand-bg) !important;
  color: var(--brand-text-primary) !important;
  font-size: var(--text-sm) !important;
  font-weight: 400 !important;
  text-align: center;
  box-shadow: none !important;
  color-scheme: light dark;
}
.site-calendar-time input:focus {
  border-color: var(--brand-text-primary) !important;
  outline: 0;
  box-shadow: var(--focus-ring) !important;
}
.site-calendar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.site-calendar-footer button {
  min-height: 32px !important;
  padding: 0 12px !important;
  border-radius: var(--ui-radius, 8px) !important;
  color: var(--brand-text-primary);
  font-size: var(--text-xs) !important;
  font-weight: 500 !important;
}
.site-calendar-footer button:hover { background: var(--brand-surface-muted); }
.site-calendar-footer button.is-primary {
  background: var(--brand-accent);
  color: var(--brand-on-accent, #fff);
}
.site-calendar-footer button.is-primary:hover { background: var(--brand-accent-hover); }

@media (max-width: 480px) {
  .site-calendar-popover { padding: 10px; }
  .site-calendar-grid button,
  .site-calendar-weekdays span { width: 32px; }
  .site-calendar-grid button { height: 32px; }
  .site-calendar-grid { min-height: 192px; }
}

/* 직접 입력 칸.  달력 위에 한 줄로 둔다 - 아는 날짜는 치는 것이 제일 빠르다. */
.site-calendar-typed { margin-bottom: 10px; }
.site-calendar-typed-input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--brand-border-strong);
  border-radius: var(--ui-radius, 8px);
  background: var(--brand-bg);
  color: var(--brand-text-primary);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.site-calendar-typed-input:focus { border-color: var(--brand-text-primary); outline: none; }
.site-calendar-typed-input.is-bad { border-color: var(--brand-danger); }
