/* Universal clock time picker. Inherits theme tokens when present. */
.time-picker {
  --tp-bg: var(--el-bg, #ffffff);
  --tp-fg: var(--el-fg, #111827);
  --tp-muted: var(--el-muted, #6b7280);
  --tp-line: var(--el-line, #d1d5db);
  --tp-accent: var(--el-accent, #2563eb);
  --tp-face-bg: var(--el-cell-bg, #f3f4f6);
  --tp-trigger-bg: var(--el-cell-bg, #ffffff);
  position: relative;
}

.time-picker-trigger {
  appearance: none;
  width: 100%;
  min-width: 84px;
  background: var(--tp-trigger-bg);
  border: 1px solid var(--tp-line);
  color: var(--tp-fg);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.time-picker-trigger:hover {
  border-color: var(--tp-accent);
}

.time-picker-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: 260px;
  padding: 14px 14px 12px;
  border: 1px solid var(--tp-line);
  border-radius: 12px;
  background: var(--tp-bg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.time-picker-popover--fixed {
  position: fixed;
  top: auto;
  left: auto;
  z-index: 1100;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
}

.time-picker-popover--hidden {
  display: none;
}

.time-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.time-picker-display {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.time-picker-display-part {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--tp-muted);
  font-size: 42px;
  line-height: 1;
  font-weight: 400;
  padding: 0 2px;
  cursor: pointer;
}

.time-picker-display-part.is-active {
  color: var(--tp-accent);
}

.time-picker-display-sep {
  color: var(--tp-fg);
  font-size: 42px;
  line-height: 1;
}

.time-picker-period {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.time-picker-period-btn {
  appearance: none;
  border: 1px solid var(--tp-line);
  background: transparent;
  color: var(--tp-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 40px;
}

.time-picker-period-btn.is-active {
  border-color: var(--tp-accent);
  color: var(--tp-accent);
}

.time-picker-face {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--tp-face-bg);
  touch-action: none;
}

.time-picker-face--interactive {
  cursor: grab;
}

.time-picker-face--dragging {
  cursor: grabbing;
}

.time-picker-face--dragging .time-picker-knob {
  transform: translate(calc(-50% + var(--tp-knob-x, 0px)), calc(-50% + var(--tp-knob-y, 0px)))
    scale(1.08);
  transition: none;
}

.time-picker-face--dragging .time-picker-hand {
  transition: none;
}

.time-picker-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2px;
  height: 38%;
  background: var(--tp-accent);
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(0deg);
  pointer-events: none;
  z-index: 2;
}

.time-picker-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tp-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(calc(-50% + var(--tp-knob-x, 0px)), calc(-50% + var(--tp-knob-y, 0px)));
  pointer-events: none;
  z-index: 3;
  transition: transform 0.08s ease;
}

.time-picker-dial {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.time-picker-dial-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--tp-fg);
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, -50%) translate(var(--tp-x), var(--tp-y));
}

.time-picker-dial-btn:hover:not(:disabled) {
  background: transparent;
}

.time-picker-dial-btn.is-selected {
  background: transparent;
  color: var(--tp-accent);
  font-weight: 600;
}

.time-picker-dial-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.time-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.time-picker-action-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--tp-accent);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
}

.time-picker-action-btn--primary {
  font-weight: 600;
}
