/*
 * entry.css — Entry card styling: day-view entries, week-view compact
 * blocks, resize handles, and the quick-create inline input.
 *
 * Mirrors the split in entry.js (DOM + interactions). Load after calendar.css.
 */

/* ---- Entry cards (absolutely positioned in timeline) ------------------ */
.entry {
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--entry-color, var(--accent)) 10%, var(--surface));
  border: 1px solid var(--border);
  border-left: 3px solid var(--entry-color, var(--accent));
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text);
  cursor: grab;
  z-index: 1;
  user-select: none;
  overflow: hidden;
  touch-action: none; /* let pointer events drive touch drag-to-move, not scroll */
}

.entry:hover {
  border-color: var(--entry-color, var(--accent));
  box-shadow: var(--shadow-sm);
}

.entry--done {
  opacity: 0.45;
  cursor: default;
}

.entry--done .entry__title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Missed: not done and already in the past → warning emoji replaces checkbox. */
.entry--missed {
}

.entry__warn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
}

/* Missed: hide checkbox, show emoji. On hover: reverse. */
.entry--missed .entry__done { display: none; }
.entry--missed .entry__warn { display: inline-flex; }
.entry--missed:hover .entry__done { display: flex; }
.entry--missed:hover .entry__warn { display: none; }

.entry--dragging {
  opacity: 0.5;
  cursor: grabbing;
}

/* Grabbed (long-press armed, before the move starts): lift the card so the
   user gets clear feedback that the entry is now "held". */
.entry--grabbed {
  z-index: 5;
  cursor: grabbing;
  box-shadow: var(--shadow-md);
}

.entry--resizing {
  z-index: 5;
  cursor: ns-resize;
  box-shadow: var(--shadow-md);
}

.entry__header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.entry__title {
  flex: 1;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry__time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.entry__done {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: transparent;
  background: transparent;
  border: 2px solid var(--entry-color, var(--accent));
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}

.entry__done:hover {
  background: color-mix(in srgb, var(--entry-color, var(--accent)) 15%, transparent);
}

.entry--done .entry__done {
  color: #fff;
  background: var(--entry-color, var(--accent));
}

.entry__done:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.entry__remove {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.entry:hover .entry__remove {
  opacity: 1;
}

.entry__remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.entry__upgrade {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
}

.entry:hover .entry__upgrade {
  display: inline-flex;
}

.entry__upgrade-arrow {
  font-size: 0.8125rem;
  line-height: 1;
}

.entry__upgrade:hover {
  color: var(--accent);
  background: var(--bg);
}

.entry__modules {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* ---- Ghost entries (visual-only future habit previews) ------------------ */
.entry--ghost {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--entry-color, var(--accent)) 40%, transparent);
  opacity: 0.5;
  cursor: pointer;
  z-index: 0;
}

.entry--ghost:hover {
  opacity: 0.75;
  border-color: var(--entry-color, var(--accent));
  box-shadow: none;
}

.entry--ghost .entry__title {
  color: var(--text-muted);
}

.entry--ghost .entry__time {
  color: var(--text-muted);
}

/* Ghosts don't show resize handles */
.entry--ghost .entry__resize {
  display: none;
}

.week-entry--ghost {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--entry-color, var(--accent)) 40%, transparent);
  opacity: 0.5;
  cursor: pointer;
}

.week-entry--ghost:hover {
  opacity: 0.75;
  border-color: var(--entry-color, var(--accent));
}

.week-entry--ghost .week-entry__title {
  color: var(--text-muted);
  padding: 0 4px;
}

.week-entry--ghost .week-entry__resize {
  display: none;
}

/* ---- Skipped (suppressed) ghosts ---------------------------------------
 * A deliberately-skipped upcoming slot. Dashed like a ghost but with a muted,
 * "held" tint + a restore glyph, so it stays visible and can be brought back
 * by tapping (restore = un-suppress). Distinct from a normal ghost (which is
 * a neutral "up next" preview). */
.entry--skipped,
.week-entry--skipped {
  border-color: var(--text-muted);
  background: color-mix(in srgb, var(--entry-color, var(--accent)) 6%, var(--surface));
  opacity: 0.65;
  cursor: pointer;
}

.entry--skipped:hover,
.week-entry--skipped:hover {
  opacity: 0.85;
}

/* Restore glyph on a skipped ghost's done button (accent, not the done fill). */
.entry__done--restore,
.week-entry__done--restore {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---- Resize handle (bottom edge) -------------------------------------- */
.entry__resize {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 2;
  touch-action: none; /* let pointer events drive touch resize, not scroll */
}

.entry__resize::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--entry-color, var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
}

.entry:hover .entry__resize::after {
  opacity: 0.5;
}

.entry--resizing .entry__resize::after {
  opacity: 1;
}

/* ---- All-day chips (in the .calendar__allday strip) -------------------- */
.allday-entry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  background: color-mix(in srgb, var(--entry-color, var(--accent)) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--entry-color, var(--accent)) 30%, var(--border));
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

.allday-entry:hover {
  border-color: var(--entry-color, var(--accent));
  box-shadow: var(--shadow-sm);
}

.allday-entry__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.allday-entry--done {
  opacity: 0.45;
}

.allday-entry--done .allday-entry__title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Checkbox on all-day chips */
.allday-entry__done {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--entry-color, var(--accent));
  border-radius: 3px;
  background: transparent;
  color: transparent;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.allday-entry__done:hover {
  background: color-mix(in srgb, var(--entry-color, var(--accent)) 15%, transparent);
}

.allday-entry--done .allday-entry__done {
  color: #fff;
  background: var(--entry-color, var(--accent));
}

.allday-entry__done:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Add button in the all-day strip */
.allday-entry__add {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
}

.allday-entry__add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.allday-entry__add:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Inline input for new all-day entries */
.allday-entry__input {
  flex: 0 1 140px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  outline: none;
}

.allday-entry__input:focus {
  border-color: var(--accent);
}

.allday-entry__input::placeholder {
  color: var(--text-muted);
}

