/*!
 * Wheel Picker by @dorianbaffier, Kokonut UI — https://kokonutui.com
 * Adapted for CDMS from the component supplied via DesignBookmark.
 *
 * MIT License
 * Copyright (c) 2025 kokonutUI
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

.wheel-form-field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.wheel-field {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}
.wheel-field > input { min-width: 0; max-width: 100%; }
.wheel-field > .wheel-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 9px;
  border: 1px solid #dce0ed;
  border-radius: 8px;
  background: #f7f8fc;
  color: #4f4b9b;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}
.wheel-field > .wheel-trigger:enabled:hover { border-color: #bcb7ed; background: #efeffb; }
.wheel-dialog {
  --wheel-row-height: 36px;
  --wheel-viewport: 222px;
  --wheel-highlight: #f0f1f8;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: min(344px, calc(100vw - 24px));
  height: fit-content;
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 20px;
  border: 1px solid #dce0ec;
  border-radius: 18px;
  background: #fff;
  color: var(--ink, #252c46);
  font-size: 1rem;
  font-weight: 400;
  box-shadow: 0 16px 50px -18px #19284866;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: start;
  white-space: normal;
}
.wheel-dialog[open] { display: grid; gap: 14px; }
.wheel-dialog::backdrop { background: rgb(27 36 62 / 32%); }
.wheel-dialog .wheel-title {
  margin: 0;
  color: var(--ink, #252c46);
  font-size: 1.08rem;
  line-height: 1.4;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.wheel-dialog .wheel-group {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #e2e5ed;
  border-radius: 16px;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
}
.wheel-dialog .wheel-band {
  position: absolute;
  inset-inline: 7px;
  top: 50%;
  height: var(--wheel-row-height);
  transform: translateY(-50%);
  border-radius: 8px;
  background: var(--wheel-highlight);
  pointer-events: none;
}
.wheel-dialog .wheel-group::before, .wheel-dialog .wheel-group::after {
  content: "";
  position: absolute;
  top: calc(50% - .5px);
  width: 4px;
  height: 1px;
  background: #8992a6;
  pointer-events: none;
}
.wheel-dialog .wheel-group::before { inset-inline-start: 2px; }
.wheel-dialog .wheel-group::after { inset-inline-end: 2px; }
.wheel-dialog .wheel-column {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 90px;
  height: var(--wheel-viewport);
  margin: 0;
  padding: 0;
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}
.wheel-dialog .wheel-column[data-part="year"] { flex-grow: 1.18; max-width: 100px; }
.wheel-dialog .wheel-column:active { cursor: grabbing; }
.wheel-dialog .wheel-column:focus-visible {
  outline: 2px solid var(--accent, #5955db);
  outline-offset: -2px;
}
.wheel-dialog .wheel-mask, .wheel-dialog .wheel-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.wheel-dialog .wheel-mask {
  mask-image: linear-gradient(to bottom, transparent, #000 34%, #000 66%, transparent);
}
.wheel-dialog .wheel-layer { perspective: 1000px; color: #858b9d; }
.wheel-dialog .wheel-layer.is-selected {
  clip-path: inset(calc(50% - var(--wheel-row-height) / 2) 0);
  color: #20283c;
  font-weight: 620;
}
.wheel-dialog .wheel-drum {
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 0;
  transform-style: preserve-3d;
}
.wheel-dialog .wheel-row {
  position: absolute;
  inset-inline: 0;
  top: calc(var(--wheel-row-height) / -2);
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--wheel-row-height);
  padding: 0;
  backface-visibility: hidden;
  font-size: 1.25rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wheel-dialog .wheel-value {
  display: block;
  min-width: 0;
  color: var(--second, #56617b);
  font-size: .86rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.wheel-dialog .wheel-error { margin: 0; color: #a32c39; font-size: .84rem; line-height: 1.45; }
.wheel-dialog .wheel-error:empty { display: none; }
.wheel-dialog .wheel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.wheel-dialog .wheel-actions button {
  min-width: 60px;
  min-height: 36px;
  border: 1px solid #d9ddea;
  border-radius: 8px;
  padding: 6px 14px;
  background: #f7f8fc;
  color: var(--ink, #252c46);
  font-weight: 600;
}
.wheel-dialog .wheel-actions .wheel-apply { border-color: var(--accent, #5955db); background: var(--accent, #5955db); color: white; }
.wheel-dialog .wheel-cancel:enabled:hover { background: #eaeef6; }
.wheel-dialog .wheel-apply:enabled:hover { background: #4844bc; }

@media (pointer: coarse) {
  .wheel-field > .wheel-trigger, .wheel-dialog .wheel-actions button { min-width: 44px; min-height: 44px; }
}
@media (max-height: 540px) {
  .wheel-dialog { --wheel-viewport: 154px; padding: 14px; }
  .wheel-dialog[open] { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .wheel-dialog, .wheel-dialog[open]::backdrop { animation: none; transition: none; }
}
@media (forced-colors: active) {
  .wheel-dialog .wheel-band { border: 1px solid Highlight; }
  .wheel-dialog .wheel-mask { mask-image: none; overflow: hidden; }
  .wheel-dialog .wheel-column:focus-visible { outline-color: Highlight; }
}
