/* Production search/date controls. Existing selector names are intentionally
   retained so the approved filters and popup layouts keep their behavior. */
body[data-calendar-prototype="true"] #directoryDate {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

body[data-calendar-prototype="true"] .qr-directory-date-controls {
  display: none !important;
}

body[data-calendar-prototype="true"] .coco-search-query-row {
  display: none !important;
}

body[data-calendar-prototype="true"] .qr-directory-search > span {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body[data-calendar-prototype="true"] .coco-search-submit-field {
  display: none !important;
}

.search-filter-prototype-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  margin-top: 0;
}

.search-filter-prototype-field {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.search-filter-prototype-field > span {
  color: #445f59;
  font-size: 0.68rem;
  font-weight: 800;
}

.search-filter-prototype-button,
.search-filter-prototype-row > .search-filter-prototype-submit {
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  font: inherit;
  border: 1px solid rgba(173, 137, 80, 0.5);
}

.search-filter-prototype-button {
  display: grid;
  align-content: center;
  gap: 3px;
  color: #0f4e43;
  background: #f1f8f5;
  border-color: #bfded6;
  outline: 1px solid rgba(173, 137, 80, 0.36);
  outline-offset: -4px;
  box-shadow:
    inset 4px 4px 8px rgba(31, 70, 62, 0.13),
    inset -4px -4px 8px rgba(255, 255, 255, 0.92);
}

.search-filter-prototype-button strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-filter-prototype-submit {
  width: 100% !important;
  height: auto !important;
  color: #fff !important;
  background: #ef7457 !important;
}

/* 検索後は、固定検索欄の下に「戻る」とガイド見出しが収まる位置で止める。 */
body.cocoicotto-results[data-calendar-prototype="true"] #cocoSearchTypeGuide {
  scroll-margin-top: 280px;
}

.calendar-prototype-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(11, 31, 28, 0.52);
  backdrop-filter: blur(4px);
}

.calendar-prototype-backdrop[hidden],
.calendar-prototype-dialog[hidden],
.calendar-prototype-choice-dialog[hidden] {
  display: none !important;
}

.calendar-prototype-choice-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9002;
  box-sizing: border-box;
  width: min(620px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 48px));
  overflow: auto;
  padding: 24px;
  color: #0f4e43;
  background: #f8fbfa;
  box-shadow: 0 26px 80px rgba(7, 33, 29, 0.28);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px));
  transition: opacity 150ms ease, transform 150ms ease;
}

.calendar-prototype-choice-dialog.is-open {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.calendar-prototype-choice-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  margin: 0 0 18px;
  padding: 0 0 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(173, 137, 80, 0.42);
  box-shadow: none;
}

.calendar-prototype-choice-dialog header small {
  color: #0f4e43;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.calendar-prototype-choice-dialog header h2 {
  margin: 3px 0 0;
  font-size: 1.25rem;
}

.calendar-prototype-choice-dialog header button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: #0f4e43;
  font: inherit;
  font-size: 1.5rem;
  background: #fff;
  border: 1px solid rgba(173, 137, 80, 0.42);
}

.calendar-prototype-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.calendar-prototype-choice-grid button {
  min-height: 48px;
  padding: 8px 10px;
  color: #0f4e43;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  background: #fff;
  border: 1px solid rgba(173, 137, 80, 0.42);
}

.calendar-prototype-choice-grid button.is-selected {
  color: #fff;
  background: #0f4e43;
  border-color: #0f4e43;
}

.calendar-prototype-dialog {
  --prototype-accent: #0f4e43;
  --prototype-ink: #0f4e43;
  position: fixed;
  z-index: 9001;
  box-sizing: border-box;
  color: var(--prototype-ink);
  background: #edf3f1;
  border: 0;
  outline: 1px solid rgba(173, 137, 80, 0.52);
  outline-offset: -6px;
  box-shadow:
    0 26px 80px rgba(7, 33, 29, 0.28),
    inset 7px 7px 14px rgba(31, 70, 62, 0.13),
    inset -7px -7px 14px rgba(255, 255, 255, 0.94);
  opacity: 0;
  transition: opacity 150ms ease, transform 150ms ease;
}

.calendar-prototype-dialog.is-open { opacity: 1; }

.calendar-prototype-main { padding: 24px; }

.calendar-prototype-dialog header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: 0;
}

.calendar-prototype-dialog header h2 {
  margin: 0;
  font-size: 1.1rem;
  text-align: center;
}

.calendar-prototype-dialog header button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #6f5838;
  font: inherit;
  font-size: 1.6rem;
  background: #edf3f1;
  border: 0;
  outline: 1px solid rgba(173, 137, 80, 0.42);
  outline-offset: -4px;
  box-shadow:
    inset 4px 4px 8px rgba(31, 70, 62, 0.13),
    inset -4px -4px 8px rgba(255, 255, 255, 0.94);
}

.calendar-prototype-week,
.calendar-prototype-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-prototype-week { margin-top: 18px; }

.calendar-prototype-grid {
  padding: 8px;
  background: #edf3f1;
  outline: 1px solid rgba(173, 137, 80, 0.36);
  outline-offset: -4px;
  box-shadow:
    inset 5px 5px 10px rgba(31, 70, 62, 0.12),
    inset -5px -5px 10px rgba(255, 255, 255, 0.92);
}

.calendar-prototype-week span {
  padding: 5px 0;
  color: #6b7d77;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.calendar-prototype-week span:nth-child(6) { color: #2aaee4; }
.calendar-prototype-week span:last-child { color: #d95f49; }

.calendar-prototype-grid button,
.calendar-prototype-grid > span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
}

.calendar-prototype-grid button {
  color: #0f4e43;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.calendar-prototype-grid button.is-saturday { color: #168fbe; }
.calendar-prototype-grid button.is-sunday { color: #d95f49; }
.calendar-prototype-grid button.is-today { box-shadow: inset 0 0 0 1px #a6bbb5; }
.calendar-prototype-grid button.is-selected {
  color: #fff;
  background: var(--prototype-accent);
  box-shadow:
    inset 3px 3px 6px rgba(7, 66, 56, 0.3),
    inset -2px -2px 5px rgba(102, 220, 197, 0.22);
}

.calendar-prototype-dialog footer {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 8px;
  min-height: 0;
  margin-top: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: 0;
}

.calendar-prototype-dialog footer button {
  min-height: 45px;
  padding: 9px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  border: 0;
  outline: 1px solid rgba(173, 137, 80, 0.56);
  outline-offset: -4px;
}

.calendar-prototype-dialog footer .is-secondary {
  color: #6f5838;
  background: #edf3f1;
  box-shadow:
    inset 4px 4px 8px rgba(31, 70, 62, 0.13),
    inset -4px -4px 8px rgba(255, 255, 255, 0.94);
}

.calendar-prototype-dialog footer .is-primary {
  color: #fff;
  background: var(--prototype-accent);
  box-shadow:
    inset 4px 4px 8px rgba(7, 66, 56, 0.3),
    inset -3px -3px 7px rgba(102, 220, 197, 0.22);
}

.calendar-prototype-summary {
  display: none;
  color: #fff;
  background: #0f4e43;
}

.calendar-prototype-summary small,
.calendar-prototype-summary span { font-weight: 800; letter-spacing: 0.08em; }
.calendar-prototype-summary strong { font-size: 1.9rem; }

.calendar-prototype-switcher {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 9010;
  display: grid;
  grid-template-columns: 42px minmax(150px, auto) 42px;
  align-items: center;
  gap: 4px;
  padding: 6px;
  color: #fff;
  background: #0f4e43;
  border-radius: 999px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}

.calendar-prototype-switcher button {
  width: 42px;
  height: 38px;
  padding: 0;
  color: #fff;
  font: inherit;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 999px;
}

.calendar-prototype-switcher strong {
  padding: 0 8px;
  font-size: 0.7rem;
  text-align: center;
  white-space: nowrap;
}

/* A: compact, centred modal. */
body[data-calendar-prototype-variant="A"] .calendar-prototype-dialog {
  top: 50%;
  left: 50%;
  width: min(360px, calc(100vw - 32px));
  transform: translate(-50%, calc(-50% + 12px));
  outline: 1px solid rgba(173, 137, 80, 0.5);
  outline-offset: -6px;
}

body[data-calendar-prototype-variant="A"] .calendar-prototype-dialog.is-open {
  transform: translate(-50%, -50%);
}

/* B: mobile bottom sheet with a clear selected-date band. */
body[data-calendar-prototype-variant="B"] .calendar-prototype-dialog {
  --prototype-accent: #ef7457;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(300px, 1fr);
  width: min(760px, 100%);
  margin: auto;
  border-radius: 24px 24px 0 0;
  transform: translateY(24px);
}

body[data-calendar-prototype-variant="B"] .calendar-prototype-dialog.is-open { transform: translateY(0); }
body[data-calendar-prototype-variant="B"] .calendar-prototype-summary {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 30px;
  background: #ef7457;
}

/* C: split card, chosen date is the visual anchor. */
body[data-calendar-prototype-variant="C"] .calendar-prototype-dialog {
  --prototype-accent: #d99116;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: 230px minmax(340px, 1fr);
  width: min(700px, calc(100vw - 32px));
  overflow: hidden;
  transform: translate(-50%, calc(-50% + 12px));
}

body[data-calendar-prototype-variant="C"] .calendar-prototype-dialog.is-open {
  transform: translate(-50%, -50%);
}

body[data-calendar-prototype-variant="C"] .calendar-prototype-summary {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 30px;
  background: #d99116;
}

@media (max-width: 600px) {
  body[data-calendar-prototype-variant="B"] .calendar-prototype-dialog,
  body[data-calendar-prototype-variant="C"] .calendar-prototype-dialog {
    grid-template-columns: 1fr;
  }

  body[data-calendar-prototype-variant="B"] .calendar-prototype-summary,
  body[data-calendar-prototype-variant="C"] .calendar-prototype-summary {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 12px;
    padding: 18px 24px;
  }

  body[data-calendar-prototype-variant="B"] .calendar-prototype-summary strong,
  body[data-calendar-prototype-variant="C"] .calendar-prototype-summary strong {
    grid-row: 1 / 3;
    grid-column: 2;
    font-size: 1.35rem;
  }

  body[data-calendar-prototype-variant="C"] .calendar-prototype-dialog {
    top: 50%;
    width: min(380px, calc(100vw - 28px));
  }

  .calendar-prototype-main { padding: 20px; }
  .calendar-prototype-switcher { bottom: 12px; }
  .calendar-prototype-choice-dialog { padding: 20px; }
  .calendar-prototype-choice-grid { grid-template-columns: 1fr 1fr; }
  .search-filter-prototype-row { gap: 6px; }
  .search-filter-prototype-button,
  .search-filter-prototype-row > .search-filter-prototype-submit {
    min-height: 40px;
    padding: 6px 5px;
  }
}
