/* AMOSHA date/time picker — Monday-first calendar and 24h slot popovers. */

.amosha-date-control,
.amosha-time-control {
  position: relative;
  width: 100%;
}

/* The wrapper, not the browser-native segmented date UI, is the visual field.
 * The real input remains present and interactive for form semantics, keyboard
 * handling and value/change events, but is visually transparent in every
 * engine (including Firefox). */
.amosha-date-control {
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-solid);
  transition: border-color .16s, box-shadow .16s, background .16s;
}

.amosha-date-control:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border-strong));
}

.amosha-date-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.amosha-date-control > input[type="date"] {
  position: relative;
  z-index: 1;
  height: 38px;
  min-height: 38px;
  border: 0 !important;
  border-radius: inherit;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0;
  cursor: pointer;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: transparent;
  padding-right: 42px;
  user-select: none;
  -moz-user-select: none;
  font-variant-numeric: tabular-nums;
}

.amosha-date-control:has(> input[type="date"]:disabled) {
  opacity: .55;
}

/* Keep Chromium shadow-DOM segments transparent as a defense in depth if a
 * future style makes the real date input visible again. Firefox is covered by
 * the engine-independent input opacity above. */
.amosha-date-control > input[type="date"]::-webkit-datetime-edit,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-text,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-month-field,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-day-field,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-year-field {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  background: transparent !important;
}

.amosha-date-control > input[type="date"]::-webkit-datetime-edit-month-field:focus,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-day-field:focus,
.amosha-date-control > input[type="date"]::-webkit-datetime-edit-year-field:focus {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  background: transparent !important;
  outline: none !important;
}

.amosha-date-control > input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 28px;
  cursor: pointer;
}

.amosha-date-display {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 42px;
  bottom: 0;
  left: 12px;
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amosha-date-display.is-placeholder {
  color: var(--muted);
}

.amosha-field-icon,
.amosha-time-open {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 7px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.amosha-date-control .amosha-field-icon {
  pointer-events: none;
}

.amosha-time-open {
  cursor: pointer;
}

.amosha-time-open:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.amosha-time-control > input[data-eu-time="24h"] {
  padding-right: 43px;
}

.amosha-picker-popover {
  position: fixed;
  z-index: 260;
  width: min(326px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.amosha-picker-popover[hidden] {
  display: none !important;
}

.amosha-picker-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.amosha-picker-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amosha-picker-nav {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-solid);
  color: var(--text-secondary, var(--muted));
  cursor: pointer;
}

.amosha-picker-nav:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.amosha-calendar-weekdays,
.amosha-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.amosha-calendar-weekdays {
  margin-bottom: 4px;
}

.amosha-calendar-weekdays span {
  min-height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.amosha-calendar-day {
  position: relative;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.amosha-calendar-day:hover {
  background: var(--surface-2);
}

.amosha-calendar-day.is-outside {
  color: color-mix(in srgb, var(--muted) 64%, transparent);
}

.amosha-calendar-day.is-today {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, var(--border));
}

.amosha-calendar-day.is-selected {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 20%, transparent);
  font-weight: 700;
}

.amosha-picker-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.amosha-picker-today {
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.amosha-picker-today:hover {
  background: var(--accent-soft);
}

.amosha-time-popover {
  width: min(354px, calc(100vw - 24px));
}

.amosha-time-popover .amosha-picker-head {
  grid-template-columns: 1fr;
}

.amosha-time-grid {
  max-height: 286px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  overflow: auto;
  padding: 2px 3px 2px 0;
  scrollbar-width: thin;
}

.amosha-time-option {
  min-height: 34px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.amosha-time-option:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.amosha-time-option.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.amosha-time-option.is-day-end {
  grid-column: 1 / -1;
  background: color-mix(in srgb, var(--gold-soft, var(--surface-2)) 70%, var(--surface-solid));
  color: var(--gold, var(--text));
}

@media (max-width: 520px) {
  .amosha-picker-popover,
  .amosha-time-popover {
    width: calc(100vw - 20px);
  }

  .amosha-time-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 641px) {
  .amosha-picker-popover {
    padding: 10px;
    border-color: color-mix(in srgb, var(--border) 78%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
    box-shadow:
      0 16px 42px rgb(15 23 42 / 16%),
      0 2px 8px rgb(15 23 42 / 7%),
      inset 0 1px 0 rgb(255 255 255 / 66%);
    backdrop-filter: blur(20px) saturate(145%);
    -webkit-backdrop-filter: blur(20px) saturate(145%);
  }

  .amosha-picker-nav,
  .amosha-calendar-day,
  .amosha-time-option,
  .amosha-picker-today {
    border-radius: 10px;
  }

  .amosha-picker-nav {
    background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  }

  .amosha-picker-footer {
    border-top-color: color-mix(in srgb, var(--border) 72%, transparent);
  }
}

