/* Ledger A - a commitment's schedule windows: the week of 7 day columns you click and drag in
   (js/ui/commitments/commitment-windows.js). The tab bars above it are in commitments.css.
   Loaded after settings.css. */

/* ---------- the week ---------- */
/* The day names and the day columns share these columns: hour labels, then the 7 days with a
   small gap between them. */
.windows-grid__row {
  display: grid;
  grid-template-columns: var(--size-34) repeat(7, minmax(0, 1fr));
  column-gap: var(--space-6);
}
/* a day's name with its "Copy" button under it */
.windows-grid__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
}
.windows-grid__day-name {
  font-weight: var(--font-weight-medium);
}
.windows-grid__hours {
  position: relative;
  height: calc(24 * var(--window-hour-height));
}
.windows-grid__hour {
  position: absolute;
  right: var(--space-4);
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-none);
}

/* ---------- the "copy to..." menu (js/ui/commitments/copy-menu.js) ---------- */
.copy-menu {
  position: relative;
}
.copy-menu__button {
  padding: var(--space-2) var(--space-8);
  border: 0;
  border-radius: var(--radius-6);
  background: var(--colour-surface-control);
  font-size: var(--font-size-xs);
}
.copy-menu__button:hover {
  background: var(--colour-surface-strong);
}
.copy-menu__panel {
  position: absolute;
  top: calc(100% + var(--space-4));
  left: 0;
  z-index: var(--layer-menu);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: var(--size-170);
  padding: var(--space-8);
  border: var(--border-thin) solid var(--colour-line-strong);
  border-radius: var(--radius-8);
  background: var(--colour-surface-stage);
  box-shadow: var(--shadow-menu);
  text-align: left;
  font-size: var(--font-size-md);
}
.copy-menu__panel[hidden] {
  display: none;
}
/* the panels of the last day columns open towards the left, so they stay on the page */
.copy-menu__panel--right {
  left: auto;
  right: 0;
}
.copy-menu__title {
  margin: 0 0 var(--space-4);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}
/* a domain's row ticks every commitment under it; those are shifted to the right */
.copy-menu__option--group {
  font-weight: var(--font-weight-medium);
}
.copy-menu__option--indented {
  padding-left: var(--space-22);
}
.copy-menu__option {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-6);
  white-space: nowrap;
  cursor: pointer;
}
.copy-menu__option:hover {
  background: var(--colour-accent-soft);
}
.copy-menu__copy {
  align-self: flex-end;
  margin-top: var(--space-4);
}
.copy-menu__copy:disabled {
  opacity: var(--opacity-50);
}

/* ---------- one day column ---------- */
/* A faint line at every hour; windows and the drag preview are placed on top by their times. */
.windows-column {
  position: relative;
  height: calc(24 * var(--window-hour-height));
  border-radius: var(--radius-6);
  background-color: var(--colour-surface-stage);
  background-image: repeating-linear-gradient(
    to bottom,
    var(--colour-line) 0,
    var(--colour-line) var(--border-thin),
    transparent var(--border-thin),
    transparent var(--window-hour-height)
  );
  user-select: none;
}
/* A window: the commitment's colour, see-through and dashed so it can't be mistaken for an event
   (SPEC D.v.1: a different colour/tone/shape). */
.windows-column__window,
.windows-column__preview {
  position: absolute;
  left: 0;
  right: 0;
  min-height: var(--min-block-height);
  overflow: hidden;
  border: var(--border-medium) dashed var(--window-colour);
  border-radius: var(--radius-6);
  background: color-mix(in srgb, var(--window-colour) 30%, transparent);
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-tight);
}
.windows-column__window {
  padding: var(--space-2) var(--space-4);
  cursor: grab;
}
/* being moved or resized: above its neighbours, and the whole page keeps the grab hand */
.windows-column__window--dragging {
  z-index: var(--layer-lifted);
  cursor: grabbing;
  box-shadow: var(--shadow-block);
}
/* the top and bottom edges you drag to change the length */
.windows-column__edge {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--size-6);
  cursor: ns-resize;
}
.windows-column__edge--top {
  top: 0;
}
.windows-column__edge--bottom {
  bottom: 0;
}
/* the block shown while dragging, before it becomes a window */
.windows-column__preview {
  padding: var(--space-2) var(--space-4);
  background: var(--colour-accent-soft);
  border-color: var(--colour-accent);
  pointer-events: none;
  z-index: var(--layer-lifted);
}
.windows-column__time {
  display: block;
  padding-right: var(--space-14);
}
.windows-column__remove {
  position: absolute;
  z-index: var(--layer-block); /* above the resize edges */
  top: 0;
  right: 0;
  width: var(--size-14);
  height: var(--size-14);
  padding: 0;
  border: 0;
  border-radius: var(--radius-3);
  background: none;
  color: var(--colour-text-muted);
  font-size: var(--font-size-md);
  line-height: var(--line-height-none);
}
.windows-column__remove:hover {
  background: var(--colour-surface-strong);
  color: var(--colour-text);
}
