/* ClockIn: assets/tracker/timer-bar.css. Part of what was style.css (split in 1.42.2, rules moved as is). The load order in index.html matters: see CLAUDE.md */
/* ============================================================
   TIMER BAR
   ============================================================ */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Tracker color (1.36.0, Theme builder > Tracker); Raised when unset. */
  background: var(--tracker-bg, var(--paper-raised));
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px;
  flex-wrap: wrap;
  /* TRACKER STICKY GAP: floats over the entry list as the page
     scrolls, right below the now-also-sticky nav bar ("+ Add time
     manually" and the entries below it are deliberately NOT part of
     this, only the nav and timer bar stick). The gap between nav and
     timer bar is 20px before scrolling (that's .app's own top
     padding, see .app) and 10px once both are stuck — this sticky
     top offset (56px nav height + 10px gap) is what produces the
     10px figure; nothing here needs to change if .app's padding
     changes, or vice versa, they're independent. z-index above a
     hovered row's z-index: 1 (see .entry-row:hover) and below the
     nav's z-index: 10, so stacking stays nav > timer bar > rows. */
  position: sticky;
  top: 66px;
  z-index: 5;
  box-shadow: var(--shadow-card);
}

.timer-bar input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  height: var(--btn-h-md);
}

#timer-description { flex: 2; min-width: 160px; }

/* Billable is a plain toggle button, not a checkbox: the $ itself is
   the whole control, sized up so it reads clearly whether it's on
   (filled) or off (outlined) rather than disappearing when unchecked. */
.billable-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.billable-toggle:hover { border-color: var(--accent); color: var(--ink); }

.billable-toggle.active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: var(--on-accent);
}

.billable-toggle-labeled {
  width: auto;
  height: auto;
  gap: 6px;
  padding: 9px 14px;
  font-size: var(--font-size-md);
}

/* Row pairing the quick-task-modal's name field with its billable
   toggle, so setting the default takes no extra click beyond typing
   the name. */
.quick-task-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-task-name-row input { flex: 1; min-width: 0; }

/* Per-task billable-default toggle: same on/off (gold when active)
   language as .billable-toggle and .entry-billable, just small enough
   to sit inline in a task row/chip next to the name and delete "x". */
.task-billable-toggle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-xs);
  line-height: 1;
  cursor: pointer;
}

.task-billable-toggle:hover { border-color: var(--accent); color: var(--ink); }

.task-billable-toggle.active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: var(--on-accent);
}

/* Project / tag pickers (used in both the timer bar and the
   edit modal). A button that opens a small searchable panel,
   instead of a plain <select>. */
.picker {
  position: relative;
  flex: 1;
  min-width: 120px;
}

.picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--ink);
  text-align: left;
}

.picker-trigger:hover { border-color: var(--ink-light); }

.picker-trigger-icon {
  font-size: 11px;
  color: var(--accent-text);
  flex-shrink: 0;
}

.picker-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-pop);
  z-index: 15;
  padding: 8px;
}

.picker-panel.hidden { display: none; }

/* Project pickers (timer bar and edit modal) get extra width — a
   project row carries a dot, name, client, task-count pill, and a
   favorite star, which crowds the shared 260px panel width. */
.project-picker-panel { width: 360px; }

.picker-group-label {
  padding: 6px 6px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.picker-search {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-sizing: border-box;
}

.picker-list {
  max-height: 220px;
  overflow-y: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-base);
}

.picker-item:hover { background: var(--paper); }
.picker-item.selected { background: var(--paper); font-weight: 600; }

.picker-project-item { justify-content: space-between; }

.picker-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-count-pill {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.task-count-pill:hover { border-color: var(--accent-dark); color: var(--accent-text); }

/* Favorite star, per project row in the project picker. Favorited
   projects sort to the top of the list under their own heading, so
   the one or two used constantly don't need to be searched for. */
.picker-favorite-star {
  flex-shrink: 0;
  margin-left: 4px;
  padding: 0 2px;
  border: none;
  background: none;
  font-size: var(--font-size-md);
  line-height: 1;
  color: var(--line);
  cursor: pointer;
}

.picker-favorite-star:hover { color: var(--text-muted); }
.picker-favorite-star.active { color: var(--star-active); }

.picker-task-list {
  margin: 2px 0 4px 22px;
  padding-left: 8px;
  border-left: 2px solid var(--line);
}

.picker-task-item {
  padding: 6px;
  font-size: var(--font-size-sm);
  color: var(--ink-light);
}

.picker-task-item.selected { color: var(--ink); }

.picker-create.picker-create-task {
  border-top: none;
  padding: 6px;
  margin-top: 2px;
  font-size: var(--font-size-sm);
}

.picker-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.picker-item-client {
  color: var(--text-muted);
  font-weight: var(--font-weight-body);
}

.picker-item-create {
  color: var(--accent-text);
  font-weight: 600;
}

.picker-empty {
  padding: 8px 6px;
  color: var(--text-muted);
  font-size: var(--font-size-base);
}

.picker-create {
  width: 100%;
  margin-top: 6px;
  padding: 7px 6px;
  border: none;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--accent-text);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

/* Timer display + click-to-fix-the-start-time popover */
.timer-display-wrap { position: relative; }

.timer-display {
  font-family: var(--font-mono);
  font-size: var(--font-size-timer); /* Settings > Appearance > Fonts > Text sizes (1.36.0) */
  font-weight: 600;
  min-width: 96px;
  text-align: right;
  background: none;
  border: none;
  color: var(--ink);
  cursor: default;
}

.timer-display:not(:disabled) { cursor: pointer; }
.timer-display:not(:disabled):hover { color: var(--accent-text); }

.start-time-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-pop);
  padding: var(--space-4);
  z-index: 15;
  font-size: var(--font-size-base);
  white-space: nowrap;
}

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

.start-time-popover label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-muted);
}

.start-time-popover input[type="time"],
.start-time-popover input[type="datetime-local"] {
  box-sizing: border-box;
  height: var(--btn-h-md);
  padding: 0 var(--space-3);
  font-size: var(--font-size-base);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.start-time-popover label { margin-bottom: var(--space-3); }
.start-time-popover label:last-of-type { margin-bottom: 0; }

.popover-quick-btn {
  display: block;
  background: none;
  border: none;
  color: var(--accent-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  /* 10px under the date field. (The label above is :last-of-type, so it
     has no bottom margin of its own.) */
  margin-top: 10px;
}

.popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* The entries-list quick time editor is anchored to whichever row was
   clicked (via JS-set top/left), not to a fixed corner of a parent. */
#entry-time-popover {
  position: fixed;
  right: auto;
}

/* "Anchored to whichever row/chip was clicked" popovers. */
#project-tasks-popover,
#entry-tags-popover,
#entryproj-project-panel {
  position: fixed;
  right: auto;
}

/* The project name on a finished entry is clickable (opens the same
   project and task picker as the timer bar). */
.entry-project[data-project-edit] { cursor: pointer; }

#project-tasks-popover {
  width: 195px;
}

/* Any popover that edits tags (currently just the entry tags
   popover, shared by the Tracker and Report tag chips) uses this
   class instead of a one-off width rule, so a new tag surface added
   later just needs the class to match — 250px, wide enough to read a
   handful of tag names comfortably. */
.tag-popover {
  width: 250px;
}

.picker-item-task-row { justify-content: space-between; }

.picker-rename-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--font-size-base);
  padding: 3px 5px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.btn-start {
  background: var(--accent);
  border: none;
  color: var(--on-accent-strong);
  font-weight: var(--weight-bold);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-start:hover { background: var(--accent-dark); }

.btn-start.running {
  background: var(--danger);
  color: var(--paper);
}

/* Play, Pause and Stop (1.43.0, merged Clock In 1.44.0). With nothing running
   (and no break) the two buttons are ONE wide "Clock In" button, as wide as both
   plus the gap; Clock In splits it: Stop slides out on the left and Play / Pause
   springs back to its square. Closing it again reverses the same motion.
   Transitions only run once the buttons are ready (is-ready), so the page
   never animates on load or when the switch is turned on. */
.timer-controls { --ctl: var(--btn-h-lg); --ctl-gap: var(--space-2); display: inline-flex; align-items: center; gap: var(--ctl-gap); }
.timer-controls.hidden, .timer-ctl.hidden, .timer-ctl svg.hidden, .timer-bar > .btn-start.hidden { display: none; } /* the last one beats core.css's .timer-bar > .btn-start */
.timer-ctl {
  box-sizing: border-box; width: var(--ctl); height: var(--ctl); padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--accent); color: var(--on-accent-strong);
}
.timer-ctl:hover { background: var(--accent-dark); }
/* 1.43.4: solid colors again. Stop is solid red (the theme's red), Pause
   and Back To Work are solid green (the theme's green). Hover darkens them. */
.timer-ctl-stop { background: var(--danger); color: var(--on-success); } /* the square matches Pause's bars: white, dark in dark mode */
.timer-ctl-stop:hover { background: var(--danger); filter: brightness(0.92); }
.timer-ctl-play.is-running, .timer-ctl-play.is-break { background: var(--success); color: var(--on-success); } /* Pause, Back To Work */
.timer-ctl-play.is-running:hover, .timer-ctl-play.is-break:hover { background: var(--success); filter: brightness(0.92); }
.timer-ctl-label { display: none; font-weight: var(--weight-bold); font-size: var(--font-size-md); }
/* Merged: one Clock In button. */
.timer-controls.is-merged .timer-ctl-play { width: calc(var(--ctl) * 2 + var(--ctl-gap)); }
.timer-controls.is-merged .timer-ctl-play .timer-ctl-label { display: inline; }
.timer-controls.is-merged .timer-ctl-play svg { display: none; }
.timer-controls.is-merged .timer-ctl-stop { width: 0; margin-right: calc(var(--ctl-gap) * -1); opacity: 0; visibility: hidden; pointer-events: none; }
.timer-controls.is-merged .timer-ctl-stop svg { transform: scale(0) rotate(-180deg); }
.timer-ctl-stop svg { transition: none; }
.timer-controls.is-ready .timer-ctl { transition: width 0.45s cubic-bezier(0.34, 1.45, 0.64, 1), margin-right 0.45s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.25s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, visibility 0s linear 0s; }
.timer-controls.is-ready.is-merged .timer-ctl-stop { transition: width 0.4s ease, margin-right 0.4s ease, opacity 0.2s ease, visibility 0s linear 0.4s; }
.timer-controls.is-ready .timer-ctl-stop svg { transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s; }
.timer-controls.is-ready .timer-ctl-play.is-splitting { animation: timer-split-pop 0.5s ease; }
@keyframes timer-split-pop { 0% { transform: scale(1); } 40% { transform: scale(0.9); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .timer-controls.is-ready .timer-ctl, .timer-controls.is-ready.is-merged .timer-ctl-stop, .timer-controls.is-ready .timer-ctl-stop svg { transition: none; }
  .timer-controls.is-ready .timer-ctl-play.is-splitting { animation: none; }
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-text);
  font-weight: var(--weight-medium);
  padding: var(--space-1) 0;
  /* Bottom doubled from --space-3 (12px) to --space-5 (24px) — this
     is the actual gap down to "This week", since .week-heading's own
     top margin is zeroed by :first-child. Top margin left alone. */
  margin: var(--space-3) 0 var(--space-5) 0;
  cursor: pointer;
  text-decoration: underline;
}

.btn-secondary {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover { border-color: var(--ink-light); }

.btn-danger {
  background: var(--danger);
  border: none;
  color: var(--on-danger);
  font-weight: var(--weight-bold);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-danger:hover { opacity: 0.88; }
.btn-danger:disabled { opacity: 0.4; cursor: default; }

.danger-zone-block {
  border: 1px solid var(--danger);
  border-radius: var(--radius-xs);
  padding: 14px 16px;
  margin: 10px 0 18px;
}

.danger-zone-block h3 { margin: 0 0 4px; font-size: var(--font-size-base); }
.danger-zone-block .section-note { margin: 0 0 10px; }

.wipe-presets { display: flex; gap: 14px; margin-bottom: 6px; }
.wipe-presets .link-btn { margin: 0; }

.wipe-range-fields {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  font-size: var(--font-size-base);
  color: var(--text-muted);
}

.wipe-range-fields input[type="date"] {
  margin-left: 6px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}

/* ============================================================
   PHONE LAYOUT (1.44.0), 700px and below
   The timer bar is three rows instead of one long line, in the desktop's
   order (Project and Tags first, then the description, then the rest):
     Project                 | # Tags
     What are you working on?           (full width)
     $   0:10:01             | Start (or Stop, Pause) | More
   The budget pill, when it shows, gets a row of its own under them
   (auto-placed, so no empty row while it is hidden). ID selectors so these
   beat the desktop rules here and in budgets.css, which loads later.
   ============================================================ */
@media (max-width: 700px) {
  #timer-form.timer-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "proj proj tags tags"
      "desc desc desc desc"
      "bill time ctl  more";
    align-items: center;
    gap: 8px;
  }
  #timer-form #timer-description { grid-area: desc; min-width: 0; width: 100%; box-sizing: border-box; }
  #timer-form #timer-project-picker { grid-area: proj; min-width: 0; }
  #timer-form #timer-tags-picker { grid-area: tags; min-width: 0; }
  #timer-form #timer-billable { grid-area: bill; }
  #timer-form .timer-display-wrap { grid-area: time; min-width: 0; }
  #timer-form .timer-display { min-width: 0; text-align: left; padding-left: 4px; }
  #timer-form #timer-toggle-btn, #timer-form #timer-controls { grid-area: ctl; justify-self: end; }
  #timer-form #timer-more-btn { grid-area: more; }
  #timer-form #budget-pill-wrap { grid-column: 1 / -1; justify-self: start; }
  /* The tags panel opens from the right half, so it lines up on the right;
     both panels stay inside the screen. */
  #timer-tags-panel { left: auto; right: 0; }
  #timer-project-panel, #timer-tags-panel { max-width: calc(100vw - 32px - 22px); }
  /* The start time popover opens under the time, on the left. */
  #timer-form .start-time-popover { right: auto; left: 0; }
}

/* Phone duration editor (2.9.2), anchored like #entry-time-popover. */
#entry-duration-popover { position: fixed; right: auto; }
#entry-duration-popover .dur-fields { display: flex; gap: var(--space-2); }
#entry-duration-popover .dur-fields label { margin-bottom: 0; }
#entry-duration-popover .dur-fields input {
  box-sizing: border-box;
  width: 64px;
  height: var(--btn-h-md);
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 16px; /* 16px keeps iOS from zooming in on focus */
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
#entry-duration-popover .dur-nudges {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
#entry-duration-popover .dur-nudges button { flex: 1; padding: 0 var(--space-2); min-width: 0; }
