/*
  Date and time pickers (behaviour in ui_pickers.js). The field stays a plain
  text input the same height as its neighbours; the popover floats above the
  dialog in the top layer. Colours come only from theme tokens.
*/

.sh-picker {
  position: relative;
  display: block;
  min-width: 0;
}

.sh-picker > .sh-picker__input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-overflow: ellipsis;
}

.sh-picker--date > .sh-picker__input {
  padding-right: 44px;
}

.sh-picker__button {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px !important;
  background: transparent;
  box-shadow: none;
  color: var(--ink-secondary);
  transform: translateY(-50%) !important;
  cursor: pointer;
}

.sh-picker__button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.sh-picker__button .material-symbols-outlined {
  font-size: 20px;
}

/* ---- Popover --------------------------------------------------------------- */

.sh-picker-pop {
  position: fixed;
  inset: auto;
  z-index: 2147483000;
  box-sizing: border-box;
  margin: 0;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.3;
  overscroll-behavior: contain;
}

.sh-picker-pop[hidden] {
  display: none;
}

.sh-picker-pop:popover-open {
  display: block;
}

.sh-picker-pop--time {
  width: max-content;
  max-width: 280px;
}

.sh-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.sh-picker-option:hover {
  background: var(--color-bg-hover);
}

.sh-picker-option.is-active {
  background: var(--surface-soft);
  box-shadow: inset 3px 0 0 var(--color-brand-accent);
}

.sh-picker-option[aria-selected="true"] {
  font-weight: 700;
}

.sh-picker-option__length {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.sh-picker-hint {
  position: sticky;
  bottom: -6px;
  margin: 4px -6px -6px;
  padding: 6px 16px 8px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ---- Date grid ------------------------------------------------------------- */

.sh-picker-pop--date {
  width: 296px;
  padding: 10px 12px 12px;
}

.sh-picker-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.sh-picker-pop button {
  transform: none !important;
  font-family: inherit;
}

.sh-picker-chip {
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 999px !important;
  background: var(--surface);
  box-shadow: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.sh-picker-chip:hover {
  background: var(--color-bg-hover);
  color: var(--ink);
}

.sh-picker-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.sh-picker-month h2 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.3;
}

.sh-picker-nav {
  display: flex;
  gap: 2px;
}

.sh-picker-step {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px !important;
  background: transparent;
  box-shadow: none;
  color: var(--ink-secondary);
  cursor: pointer;
}

.sh-picker-step:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.sh-picker-step .material-symbols-outlined {
  font-size: 20px;
}

.sh-picker-grid {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  background: transparent;
  table-layout: fixed;
}

.sh-picker-grid :is(th, td) {
  padding: 1px;
  border: 0;
  background: transparent;
  text-align: center;
}

.sh-picker-grid th {
  height: 28px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
}

.sh-picker-day {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px !important;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.sh-picker-day:hover {
  background: var(--color-bg-hover);
  color: var(--ink);
}

.sh-picker-day.is-today {
  box-shadow: inset 0 0 0 2px var(--current);
  font-weight: 800;
}

.sh-picker-day[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 800;
}

.sh-picker-day[aria-pressed="true"]:hover {
  background: var(--primary);
  color: var(--primary-ink);
}

.sh-picker-pop :is(.sh-picker-chip, .sh-picker-step, .sh-picker-day):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

@media (max-width: 900px) {
  .sh-picker__button {
    width: 44px;
    height: 44px;
    right: 0;
  }

  .sh-picker-option {
    min-height: 44px;
  }

  .sh-picker-pop--date {
    width: 336px;
  }

  .sh-picker-day {
    width: 44px;
    height: 44px;
  }

  .sh-picker-chip,
  .sh-picker-step {
    min-height: 44px;
  }

  .sh-picker-step {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .sh-picker-pop {
    animation: sh-picker-in 120ms ease-out;
  }
}

@keyframes sh-picker-in {
  from {
    opacity: 0;
  }
}
