/* ==========================================================================
   KundaliLens themed pickers (pickers.js) and app-wide scrollbars.
   The display input inherits each form's own input styles; this file adds
   the icon, the wheel panel (popover / phone bottom sheet) and scrollbars.
   ========================================================================== */

/* ---------- Field ---------- */

.kl-pick {
  position: relative;
  min-width: 0;
}

.kl-pick__input {
  width: 100%;
  padding-right: 38px !important;
  cursor: pointer;
  caret-color: transparent;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.kl-pick__input::placeholder {
  color: var(--dim);
  opacity: 1;
}

.kl-pick.is-open .kl-pick__input {
  border-color: var(--saffron) !important;
  box-shadow: var(--focus-ring);
}

.kl-pick__input[aria-invalid="true"] {
  border-color: rgba(239, 138, 122, 0.8) !important;
}

.kl-pick__icon {
  appearance: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--saffron);
  cursor: pointer;
  opacity: 0.85;
}

.kl-pick.is-open .kl-pick__icon,
.kl-pick__input:hover + .kl-pick__icon {
  opacity: 1;
}

/* ---------- Panel ---------- */

.kl-wheel {
  --kl-row: 40px;
  --kl-vis: 5;
  position: fixed;
  z-index: 1100;
  width: 300px;
  max-width: calc(100vw - 16px);
  padding: 16px 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(245, 154, 74, 0.28);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(205, 91, 19, 0.22) 0, rgba(205, 91, 19, 0) 60%),
    rgba(12, 10, 12, 0.94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font-sans);
  animation: klWheelIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.kl-wheel--time { width: 280px; }

@keyframes klWheelIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.kl-wheel__head {
  display: grid;
  gap: 2px;
  padding: 0 4px 12px;
}

.kl-wheel__k {
  font: 500 10px/1.2 var(--font-mono);
  letter-spacing: 0.16em;
  color: var(--dim);
}

.kl-wheel__v {
  font-family: "Barlow", var(--font-sans);
  font-weight: 300;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.kl-wheel__sub {
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--saffron);
}

/* ---------- Wheels ---------- */

.kl-wheel__cols {
  position: relative;
  display: grid;
  grid-template-columns: 0.8fr 1fr 1.2fr;
  gap: 4px;
  height: calc(var(--kl-row) * var(--kl-vis));
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.kl-wheel--time .kl-wheel__cols { grid-template-columns: 1fr 1fr 1fr; }

/* The selection band: hairlines and a soft saffron glow across all columns. */
.kl-wheel__band {
  position: absolute;
  left: 4px;
  right: 4px;
  top: calc(var(--kl-row) * 2);
  height: var(--kl-row);
  border-radius: 10px;
  border: 1px solid rgba(245, 154, 74, 0.45);
  background: linear-gradient(90deg, rgba(205, 91, 19, 0.1), rgba(245, 154, 74, 0.2), rgba(205, 91, 19, 0.1));
  box-shadow: 0 0 22px rgba(245, 154, 74, 0.18);
  pointer-events: none;
}

.kl-wheel__col {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  border-radius: 10px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 34%, #000 66%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 34%, #000 66%, transparent 100%);
  outline: none;
  touch-action: pan-y;
}

.kl-wheel__col::-webkit-scrollbar { display: none; }

.kl-wheel__col:focus-visible {
  -webkit-mask-image: none;
  mask-image: none;
  box-shadow: inset 0 0 0 2px rgba(245, 154, 74, 0.55);
}

.kl-wheel__list {
  margin: 0;
  padding: calc(var(--kl-row) * 2) 0;
  list-style: none;
}

.kl-wheel__opt {
  height: var(--kl-row);
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: 16px;
  color: rgba(245, 239, 233, 0.5);
  cursor: pointer;
  user-select: none;
  transition: color 120ms ease, transform 120ms ease;
}

.kl-wheel__col--num .kl-wheel__opt {
  font-family: "Barlow", var(--font-sans);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.kl-wheel__opt:hover { color: var(--text); }

.kl-wheel__opt.is-sel {
  color: #fff;
  font-weight: 600;
  transform: scale(1.08);
}

/* ---------- Footer ---------- */

.kl-wheel__foot {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.kl-wheel__chip {
  appearance: none;
  justify-self: start;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dashed rgba(245, 154, 74, 0.45);
  background: rgba(245, 154, 74, 0.06);
  color: var(--sand);
  font: 500 12px/1.2 var(--font-sans);
  cursor: pointer;
}

.kl-wheel__chip:hover { background: rgba(245, 154, 74, 0.16); color: #fff; }

.kl-wheel__actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}

.kl-wheel__btn {
  appearance: none;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid var(--control-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: 600 14px/1 var(--font-sans);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.kl-wheel__btn:hover { background: rgba(255, 255, 255, 0.09); }

.kl-wheel__btn--go {
  border-color: transparent;
  background: var(--mars);
  color: #fff;
  box-shadow: 0 8px 24px rgba(205, 91, 19, 0.3);
}

.kl-wheel__btn--go:hover { background: var(--mars-bright); }

.kl-wheel :focus-visible:not(.kl-wheel__col) {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 0 6px rgba(245, 154, 74, 0.45);
}

/* ---------- Phones and touch screens: bottom sheet ---------- */

.kl-wheel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1099;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: klFade 160ms ease;
}

@keyframes klFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.kl-wheel.is-sheet {
  left: 0 !important;
  right: 0;
  bottom: 0;
  top: auto !important;
  width: auto;
  max-width: none;
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  border-bottom: 0;
  animation: klSheetIn 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.kl-wheel.is-sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
}

.kl-wheel.is-sheet .kl-wheel__v { font-size: 30px; }
.kl-wheel.is-sheet .kl-wheel__opt { font-size: 18px; }
.kl-wheel.is-sheet .kl-wheel__col--num .kl-wheel__opt { font-size: 21px; }
.kl-wheel.is-sheet .kl-wheel__btn { min-height: 48px; font-size: 15px; }
.kl-wheel.is-sheet .kl-wheel__chip { padding: 9px 14px; font-size: 13px; }

@keyframes klSheetIn {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .kl-wheel,
  .kl-wheel.is-sheet,
  .kl-wheel-backdrop { animation: none; }
  .kl-wheel__opt { transition: none; }
}

/* ---------- Scrollbars, app-wide ---------- */

html,
body,
body * {
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 154, 74, 0.38) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(245, 154, 74, 0.55), rgba(205, 91, 19, 0.45)) padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(245, 154, 74, 0.85), rgba(205, 91, 19, 0.75)) padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::selection {
  background: rgba(205, 91, 19, 0.55);
  color: #fff;
}
