/* ==========================================================================
   Apple-Style Drum-Roll / Wheel Time Picker Popover
   Anchored directly beneath the clicked time field with transparent backdrop
   ========================================================================== */

/* ── Trigger Button (Visual replacement or companion for time inputs) ───── */
.time-trigger-btn {
  height: 38px;
  min-width: 90px;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid var(--border, #dbe5e0);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, background 140ms ease;
  white-space: nowrap;
  box-sizing: border-box;
  user-select: none;
}

.time-trigger-btn:hover {
  border-color: var(--brand-600, #2d6a58);
  color: var(--brand-700, #1f4f41);
  background: #fafbfc;
}

.time-trigger-btn:focus,
.time-trigger-btn:focus-visible {
  outline: none;
  border-color: var(--brand-600, #2d6a58);
  box-shadow: 0 0 0 3px rgba(45, 106, 88, 0.14);
}

.time-trigger-btn.has-value {
  color: var(--brand-700, #1f4f41);
  border-color: var(--brand-200, #a9d4c4);
  background: var(--brand-50, #edf6f2);
  font-weight: 700;
}

.time-trigger-btn svg {
  opacity: 0.65;
  flex-shrink: 0;
  transition: opacity 140ms ease;
}

.time-trigger-btn:hover svg,
.time-trigger-btn.has-value svg {
  opacity: 0.95;
}

/* ── Enhanced Native Time Input ─────────────────────────────────────────── */
input[type="time"].wheel-time-enabled,
input[type="time"] {
  cursor: pointer !important;
  font-weight: 600;
  user-select: none;
}

/* ── Transparent Click-Away Backdrop (No Dark Blur, Page Stays Clear) ──── */
dialog#wtp-backdrop,
#wtp-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  z-index: 2147483647;
  background: transparent;
  display: block;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease, visibility 120ms ease;
  pointer-events: none;
  box-sizing: border-box;
}

dialog#wtp-backdrop::backdrop {
  background: transparent !important;
}

dialog#wtp-backdrop[open],
#wtp-backdrop.wtp-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  display: block;
}

/* ── Popover Card (Anchored Under Input) ─────────────────────────────────── */
#wtp-modal {
  position: fixed;
  z-index: 2147483647;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 14px 38px -4px rgba(15, 23, 42, 0.2), 0 4px 14px -2px rgba(15, 23, 42, 0.08);
  width: 270px;
  max-width: calc(100vw - 16px);
  padding: 12px 14px 10px;
  transform: translateY(-4px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), opacity 150ms ease, visibility 150ms ease;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid #cbd5e1;
  pointer-events: none;
}

dialog#wtp-backdrop[open] #wtp-modal,
#wtp-backdrop.wtp-open #wtp-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Header Title ───────────────────────────────────────────────────────── */
#wtp-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-600, #2d6a58);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 8px;
  padding-bottom: 4px;
}

/* ── Columns Wrapper ────────────────────────────────────────────────────── */
#wtp-columns-wrap {
  position: relative;
  height: 160px;
  display: flex;
  gap: 0;
  overflow: hidden;
  background: #ffffff;
}

/* Top & bottom soft fade gradient masks */
#wtp-columns-wrap::before,
#wtp-columns-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 54px;
  z-index: 5;
  pointer-events: none;
}

#wtp-columns-wrap::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98) 10%, rgba(255, 255, 255, 0.6) 65%, transparent);
}

#wtp-columns-wrap::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 10%, rgba(255, 255, 255, 0.6) 65%, transparent);
}

/* ── Center Selection Highlight Band ────────────────────────────────────── */
#wtp-selection-band {
  position: absolute;
  top: 50%;
  left: 6px;
  right: 6px;
  height: 40px;
  transform: translateY(-50%);
  background: #f1f5f9;
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
  border: 1px solid rgba(203, 213, 225, 0.6);
}

/* ── Individual Drum Columns ────────────────────────────────────────────── */
.wtp-col {
  flex: 1;
  height: 160px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  z-index: 6;
  padding: 60px 0; /* (160px - 40px) / 2 = 60px padding to center exactly */
  box-sizing: border-box;
  cursor: grab;
}

.wtp-col:active {
  cursor: grabbing;
}

.wtp-col::-webkit-scrollbar {
  display: none;
}

#wtp-ampm {
  flex: 0 0 72px;
}

/* ── Wheel Drum Items (Fixed 40px Height - No Font-Size Shifts) ────────── */
.wtp-item {
  height: 40px;
  line-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px !important;
  font-weight: 500;
  color: #94a3b8;
  scroll-snap-align: center;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: transform 90ms ease, opacity 90ms ease, color 90ms ease;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

/* Depth classes: strictly GPU transform and opacity without reflowing layout */
.wtp-item.wtp-active {
  color: #0f172a;
  font-weight: 700;
  opacity: 1;
  transform: scale(1.05);
}

.wtp-item.wtp-near {
  color: #64748b;
  font-weight: 500;
  opacity: 0.62;
  transform: scale(0.92);
}

.wtp-item.wtp-far {
  color: #94a3b8;
  font-weight: 400;
  opacity: 0.32;
  transform: scale(0.82);
}

.wtp-item.wtp-hidden {
  color: #cbd5e1;
  font-weight: 400;
  opacity: 0.12;
  transform: scale(0.72);
}

/* ── Popover Footer Actions ─────────────────────────────────────────────── */
#wtp-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid #f1f5f9;
}

#wtp-cancel-btn,
#wtp-ok-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  transition: opacity 120ms ease, background 120ms ease, transform 100ms ease;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#wtp-cancel-btn:active,
#wtp-ok-btn:active {
  transform: scale(0.96);
}

#wtp-cancel-btn {
  color: #64748b;
}

#wtp-ok-btn {
  color: var(--brand-600, #2d6a58);
}

#wtp-cancel-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

#wtp-ok-btn:hover {
  background: var(--brand-50, #edf6f2);
  color: var(--brand-700, #1f4f41);
}

/* ==========================================================================
   12-Hour Analog Clock Dial Picker (Hours 1-12 & Minutes 00-55)
   Anchored directly beneath the clicked Total Time field with transparent backdrop
   ========================================================================== */

/* ── Clean Time Input with Clock Icon in Task Card Row ────────────────── */
.time-clock-input {
  cursor: pointer !important;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  height: 38px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  box-sizing: border-box;
}

.time-clock-input:hover {
  border-color: var(--brand-600, #2d6a58);
}

.time-clock-input:focus-visible {
  outline: none;
  border-color: var(--brand-600, #2d6a58);
  box-shadow: 0 0 0 3px rgba(45, 106, 88, 0.14);
}

.time-clock-input.has-value {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

/* ── Nearby Add-on Minute Buttons (+5m, +10m, +15m, +30m) ─────────────── */
.btn-addon-min {
  height: 38px;
  padding: 0 9px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms ease;
  user-select: none;
  box-sizing: border-box;
  line-height: 1;
}

.btn-addon-min:hover {
  background: #ffffff;
  border-color: var(--brand-600, #2d6a58);
  color: var(--brand-700, #1f4f41);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-addon-min:active {
  transform: scale(0.95);
  background: #ecfdf5;
}

/* ── Transparent Click-Away Backdrop ───────────────────────────────────── */
#acp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: transparent;
  display: block;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease, visibility 120ms ease;
  pointer-events: none;
}

#acp-backdrop.acp-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Popover Modal ─────────────────────────────────────────────────────── */
#acp-modal {
  position: fixed;
  z-index: 99999;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 46px -4px rgba(15, 23, 42, 0.22), 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  width: 280px;
  max-width: calc(100vw - 16px);
  padding: 14px 14px 10px;
  transform: translateY(-4px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), opacity 150ms ease, visibility 150ms ease;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid #cbd5e1;
  pointer-events: none;
  box-sizing: border-box;
}

#acp-backdrop.acp-open #acp-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Modal Header & Time Display ───────────────────────────────────────── */
#acp-header {
  margin-bottom: 2px;
  text-align: center;
}

#acp-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-600, #2d6a58);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.acp-time-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto;
}

.acp-time-tab {
  background: #f1f5f9;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 26px;
  font-weight: 800;
  color: #64748b;
  padding: 2px 12px;
  cursor: pointer;
  line-height: 1.1;
  transition: all 120ms ease;
  font-family: inherit;
}

.acp-time-tab:hover {
  background: #e2e8f0;
  color: #334155;
}

.acp-time-tab.is-active {
  background: #ecfdf5;
  border-color: var(--brand-600, #2d6a58);
  color: var(--brand-700, #1f4f41);
}

.acp-time-colon {
  font-size: 24px;
  font-weight: 800;
  color: #94a3b8;
  line-height: 1;
}

/* ── Dial Container ────────────────────────────────────────────────────── */
#acp-dial-wrap {
  position: relative;
  height: 214px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 6px;
}

#acp-clock-face {
  position: relative;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.04);
  touch-action: none;
  cursor: pointer;
  user-select: none;
}

/* ── Center Pin / Zero Hour Interactive Center ─────────────────────────── */
#acp-center-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  box-sizing: border-box;
}

/* In hours mode: interactive 0h center badge */
.acp-zero-center-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px dashed #94a3b8;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: all 130ms ease;
  line-height: 1;
  padding: 0;
  font-family: inherit;
}

.acp-zero-center-btn::after {
  content: 'mins only';
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-top: 1px;
  letter-spacing: -0.01em;
}

.acp-zero-center-btn:hover {
  background: #f0fdf4;
  border-color: var(--brand-600, #2d6a58);
  border-style: solid;
  color: var(--brand-700, #1f4f41);
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 3px 8px rgba(45, 106, 88, 0.2);
}

.acp-zero-center-btn.is-selected {
  background: var(--brand-600, #2d6a58) !important;
  border-color: var(--brand-600, #2d6a58) !important;
  border-style: solid !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(45, 106, 88, 0.42);
}

.acp-zero-center-btn.is-selected::after {
  color: #bbf7d0;
}

/* In minutes mode: minimal pin dot */
.acp-center-pin-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-600, #2d6a58);
  border: 2px solid #ffffff;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  padding: 0;
  overflow: hidden;
  text-indent: -9999px;
  border: none;
}

/* ── Clock Hand ────────────────────────────────────────────────────────── */
#acp-hand {
  position: absolute;
  top: 29px;
  left: 104px;
  width: 2px;
  height: 76px;
  transform-origin: 50% 100%;
  z-index: 4;
  pointer-events: none;
  transition: transform 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

#acp-hand-line {
  width: 2px;
  height: 100%;
  background: var(--brand-600, #2d6a58);
}

#acp-hand-pointer {
  position: absolute;
  top: -17px;
  left: -16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-600, #2d6a58);
  box-shadow: 0 3px 10px rgba(45, 106, 88, 0.38);
}

/* ── Dial Numbers (Hours 1-12 or Minutes 00-55) ────────────────────────── */
.acp-dial-number {
  position: absolute;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  border-radius: 50%;
  cursor: pointer;
  z-index: 6;
  transition: color 100ms ease, transform 100ms ease;
  user-select: none;
  -webkit-user-select: none;
}

.acp-dial-number:hover {
  color: var(--brand-600, #2d6a58);
  transform: scale(1.1);
}

.acp-dial-number.is-selected {
  color: #ffffff !important;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* ── Nearby Add-on Minute Bar Inside Modal (+5m, +10m, +15m, +30m) ─────── */
#acp-addon-bar {
  margin: 8px 0 10px;
  padding: 0;
  background: transparent;
  border: none;
  width: 100%;
  box-sizing: border-box;
}

.acp-addon-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.acp-addon-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 120ms ease;
  font-family: inherit;
  user-select: none;
  box-sizing: border-box;
  width: 100%;
  line-height: 1;
}

.acp-addon-pill:hover {
  background: #f0fdf4;
  border-color: var(--brand-600, #2d6a58);
  color: var(--brand-700, #1f4f41);
  box-shadow: 0 1px 3px rgba(45, 106, 88, 0.12);
}

.acp-addon-pill:active {
  transform: scale(0.96);
  background: #dcfce7;
}

/* ── Modal Footer ──────────────────────────────────────────────────────── */
#acp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid #f1f5f9;
}

#acp-clear-btn,
#acp-cancel-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  color: #64748b;
  transition: all 120ms ease;
}

#acp-clear-btn:hover,
#acp-cancel-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

#acp-apply-btn {
  background: var(--brand-600, #2d6a58);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(45, 106, 88, 0.25);
  transition: all 120ms ease;
}

#acp-apply-btn:hover {
  background: var(--brand-700, #1f4f41);
  box-shadow: 0 2px 6px rgba(45, 106, 88, 0.35);
}

#acp-apply-btn:active,
#acp-cancel-btn:active,
#acp-clear-btn:active {
  transform: scale(0.96);
}
