/* The mood boards (crm/views/mood.jsx, crm/public/app/mood.js). */

/* A board takes files anywhere on it: the target fills the pane below the
   Subnav on the master board, and a shoot's section body. */
.mood-drop {
  min-height: 180px;
}

.crm-split[data-mood-board] .mood-drop {
  min-height: calc(100vh - 120px);
}

.mood-wall {
  column-gap: 8px;
  padding: 12px 16px 0;
}

.mood-wall:not(:empty) {
  padding-bottom: 48px;
}

/* The browser's column count (crm/lib/columns-choice.js, the Columns slider). */
.mood-wall[data-cols="2"] { --mood-columns: 2; column-count: 2; }
.mood-wall[data-cols="3"] { --mood-columns: 3; column-count: 3; }
.mood-wall[data-cols="4"] { --mood-columns: 4; column-count: 4; }
.mood-wall[data-cols="5"] { --mood-columns: 5; column-count: 5; }
.mood-wall[data-cols="6"] { --mood-columns: 6; column-count: 6; }
.mood-wall[data-cols="7"] { --mood-columns: 7; column-count: 7; }
.mood-wall[data-cols="8"] { --mood-columns: 8; column-count: 8; }
.mood-wall[data-cols="9"] { --mood-columns: 9; column-count: 9; }
.mood-wall[data-cols="10"] { --mood-columns: 10; column-count: 10; }

/* Laid out (mood.js): thin rows, each tile spanning its height, so tiles
   read left to right, row by row, in the board's order. */
.mood-wall[data-mood-laid-out] {
  display: grid;
  grid-template-columns: repeat(var(--mood-columns), minmax(0, 1fr));
  grid-auto-rows: 4px;
  column-count: auto;
  align-items: start;
}

.mood-wall[data-mood-laid-out] > * {
  grid-row-end: span var(--mood-span, 50);
  margin: 0;
}

[data-mood-move] .mood-tile {
  cursor: grab;
}

.mood-tile.is-moving {
  opacity: 0.35;
}

.mood-wall:not(:empty) + .mood-empty {
  display: none;
}

.mood-tile,
.mood-wall > .upload-ghost {
  position: relative;
  display: block;
  margin: 0 0 8px;
  overflow: hidden;
  break-inside: avoid;
  border-radius: 4px;
  background: #e9ecef;
}

.mood-tile-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
}

.mood-tile-open img {
  display: block;
  width: 100%;
  height: auto;
}

.mood-tile-open:focus-visible {
  outline: 3px solid #0d6efd;
  outline-offset: -3px;
}

/* A file this browser could not draw: its name on the tile's ground. */
.mood-tile-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 4 / 3;
  padding: 12px;
  color: #6c757d;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.mood-tile-time {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  pointer-events: none;
}

.mood-tile-time svg {
  width: 9px;
  height: 9px;
  fill: currentColor;
}

/* Selected (a click; ⌘ or Shift adds): an outline around the tile. Its
   overflow is hidden for the picture's corners, so the ring sits outside it. */
.mood-tile.is-selected {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}

/* Dropped again on a board that already holds it: the tile flashes where
   it stands instead of a second copy (mood.js showAlready). */
.mood-tile.is-already {
  animation: mood-already 1.2s ease-out;
}

@keyframes mood-already {
  0%, 40% { outline: 3px solid #0d6efd; outline-offset: 2px; }
  100% { outline: 3px solid transparent; outline-offset: 2px; }
}

/* Already on the shoot being picked for. */
.mood-tile.is-on-board .mood-tile-open {
  opacity: 0.4;
  cursor: default;
}

.mood-tile-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
}

.mood-tile:hover .mood-tile-remove,
.mood-tile-remove:focus-visible {
  opacity: 1;
}

.mood-tile-remove svg {
  width: 12px;
  height: 12px;
}

/* The categories in the narrow list. */
.mood-cats a {
  display: flex;
  align-items: center;
}

.mood-cat-count {
  margin-left: auto;
  color: #6c757d;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* The row under a dragged tile carries the shared lit look (data-drop-lit,
   editor upload-queue.css) beside its Move / Copy / Trash word. */


/* Notes and sections: the board's own words (mood.jsx TextTile). A note is a
   card the size of the words in it; a section runs across the whole wall. */
.mood-tile.mood-text {
  background: #fff;
  border: 1px solid #dee2e6;
}

.mood-text-body {
  display: block;
  width: 100%;
  padding: 16px 16px 20px;
  border: 0;
  background: none;
  color: #212529;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: default;
  font-family: inherit;
}

.mood-tile.mood-text-section {
  column-span: all;
  border-width: 0 0 1px;
  border-radius: 0;
  background: none;
}

.mood-wall[data-mood-laid-out] > .mood-text-section {
  grid-column: 1 / -1;
}

.mood-text-section .mood-text-body {
  padding: 14px 2px 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
}

/* A note's or section's bin (mood.jsx BinButton): the ×'s disc, shown under
   the pointer; not while it is typed, and not in the Trash. */
.mood-text-section .mood-tile-bin {
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
}

.mood-tile.is-editing .mood-tile-bin,
.mood-text-draft .mood-tile-bin,
[data-mood-trash-view] .mood-tile-bin {
  display: none;
}

.mood-tile.mood-text.is-editing {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}

/* While a tile is dragged the places it can go are outlined, and the one
   under the pointer says what a drop does there (mood.js). */
.is-dragging-tiles [data-mood-category-drop],
.is-dragging-tiles [data-mood-shoot-drop],
.is-dragging-tiles [data-mood-person-drop],
.is-dragging-tiles [data-mood-trash-drop] {
  box-shadow: inset 0 0 0 1px #cfe2ff;
}

[data-mood-drop-hint] .mood-cat-count {
  display: none;
}

[data-mood-drop-hint]::after {
  content: attr(data-mood-drop-hint);
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: #0d6efd;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-mood-drop-hint="Copy"]::after {
  background: #198754;
}

[data-mood-drop-hint="Trash"]::after {
  background: #b42318;
}

/* A shoot's days, under its title in the narrow list. */
.mood-rail-days {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mood-rail-days a {
  padding-left: 26px;
  color: #5b6472;
  font-size: 13px;
}

/* A picture's text: the icon at its bottom right on hover, the words under it. */
.mood-tile-media {
  position: relative;
}

.mood-tile-note {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.mood-tile:hover .mood-tile-note,
.mood-tile-note:focus-visible {
  opacity: 1;
}

.mood-tile-note:hover {
  background: rgba(0, 0, 0, 0.8);
}

.mood-tile-note svg {
  width: 14px;
  height: 14px;
}

.mood-tile-caption {
  padding: 8px 10px 10px;
  background: #fff;
  color: #212529;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mood-tile.is-editing {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}

/* ---- Words typed in place (mood.js typeInPlace): the element that shows
   them takes the caret, so nothing around it moves. ---- */
.is-typing {
  outline: none;
  cursor: text;
  user-select: text;
}

.is-typing:empty::before {
  content: attr(data-placeholder);
  color: #9aa3af;
}

.mood-tile.is-editing,
.mood-tile.mood-text-draft {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}

/* A drag over a wall: the dragged tiles stand where a drop will leave them,
   as empty slots, the others gliding out of the way (mood.js landAt). */
.mood-wall {
  position: relative;
}

.mood-wall.is-landing > .mood-tile.is-moving,
.mood-wall.is-landing > .mood-tile.mood-text.is-moving {
  opacity: 1;
  border-color: transparent;
  background: rgba(13, 110, 253, 0.1);
  outline: 2px dashed #0d6efd;
  outline-offset: -2px;
}

.mood-wall.is-landing > .mood-tile.is-moving > * {
  visibility: hidden;
}

/* What follows the pointer when several tiles are dragged (mood.js
   dragPicture): drawn off the page, copied by the browser as the drag starts. */
.mood-drag-picture {
  position: fixed;
  top: -2000px;
  left: 0;
  padding: 0 10px 10px 0;
}

.mood-drag-picture > .mood-tile {
  max-height: 240px;
  margin: 0;
  box-shadow: 5px 5px 0 -1px #fff, 5px 5px 0 0 #adb5bd, 10px 10px 0 -1px #fff, 10px 10px 0 0 #adb5bd;
}

.mood-drag-count {
  position: absolute;
  top: -8px;
  left: -8px;
  min-width: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: #0d6efd;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 24px;
  text-align: center;
}

/* ---- The Subnav: one row while it fits, wrapping as a row (never the
   editor's narrow-window column) when it does not. ---- */
.crm-split[data-mood-board] .subnav-inner {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.crm-split[data-mood-board] .subnav-title {
  flex: 0 1 auto;
}

.crm-split[data-mood-board] .subnav-actions {
  margin-left: auto;
}

/* The selection's own row under the Subnav (mood.jsx SelectionBar): the
   pressed blue of the editor's second rows. */
.mood-selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 7px 16px;
  border-top: 1px solid #a9bcdf;
  background: #e2eafa;
  color: #244b99;
  font-size: 13px;
}

/* Nothing selected: the row stays, greyed. */
.mood-selection-bar.is-empty {
  border-top-color: #d6dbe3;
  background: #f3f5f8;
  color: #8a94a6;
}

.mood-selection-bar.is-empty select,
.mood-selection-bar.is-empty .btn:not([data-mood-select-all]) {
  opacity: 0.55;
}

.mood-selection-count {
  min-width: 82px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

body.editor-shell .mood-selection-bar select.mood-bulk {
  width: auto;
  min-width: 160px;
  height: 30px;
  padding: 3px 28px 3px 9px;
  font-size: 13px;
}

.mood-selection-end {
  display: inline-flex;
  gap: 7px;
  margin-left: auto;
}

/* ---- The narrow list: one scrolling column of bands, the Trash pinned at
   its foot. ---- */
.mood-rail {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mood-rail .crm-name-list {
  flex: none;
  overflow: visible;
}

/* A band heading a part of the list (Categories, Shoots, People). */
.mood-rail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 3px 6px 3px 10px;
  border-top: 1px solid #c9d3df;
  border-bottom: 1px solid #c9d3df;
  background: linear-gradient(#f3f6fa, #e6ecf4);
  color: #566a82;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mood-rail > .mood-rail-head:first-child {
  border-top: 0;
}

.mood-rail-head .mood-cat-tool {
  opacity: 1;
}

/* A row's own tools (rename, remove, empty): shown on hover. */
.mood-cat-row {
  position: relative;
}

.mood-cat-row.is-moving {
  opacity: 0.4;
}

.mood-cat-row[draggable="true"] > a {
  cursor: grab;
}

.mood-cat-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mood-cat-name.is-typing {
  flex: 1;
  margin: -2px -4px;
  padding: 1px 3px;
  border: 1px solid #0d6efd;
  border-radius: 4px;
  background: #fff;
  font-weight: 500;
  text-overflow: clip;
}

.mood-cat-tools {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  gap: 2px;
  transform: translateY(-50%);
  background: inherit;
}

.mood-cat-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #566a82;
  opacity: 0;
}

.mood-cat-tool svg {
  width: 14px;
  height: 14px;
}

.mood-cat-tool:hover {
  border-color: #b5c1d0;
  background: #fff;
  color: #18181b;
}

.mood-cat-tool.is-danger:hover {
  color: #b42318;
}

.mood-cat-row:hover .mood-cat-tool,
.mood-cat-tool:focus-visible,
.mood-cat-tool.is-armed {
  opacity: 1;
}

.mood-cat-row:hover .mood-cat-count,
.mood-cat-row:has(.is-typing) .mood-cat-count,
.mood-cat-row:has(.is-armed) .mood-cat-count {
  visibility: hidden;
}

.mood-cat-row:has(.is-typing) .mood-cat-tools {
  display: none;
}

/* Where a dragged category will land. */
.mood-cat-row.is-drop-before {
  box-shadow: inset 0 3px 0 #0d6efd;
}

.mood-cat-row.is-drop-after {
  box-shadow: inset 0 -3px 0 #0d6efd;
}

.mood-cat-loose a {
  color: #5b6472;
}

.mood-rail-people {
  padding: 8px 0 0;
}

body.editor-shell .mood-rail-people > input[type="search"] {
  width: calc(100% - 16px);
  height: 30px;
  margin: 0 8px 6px;
  padding: 3px 9px;
  font-size: 13px;
}

/* The Trash, pinned under the list. */
.mood-rail-trash {
  flex: none;
  border-top: 1px solid #b5c1d0;
  background: #fff;
}

.mood-rail-trash .crm-name-list a {
  border-bottom: 0;
}

.mood-rail-trash a svg {
  width: 15px;
  height: 15px;
  color: #6c757d;
}

/* ---- An item, opened, in the editor's modal shell (editor-modals.css):
   the media as large as the window allows, its fields beside it. ---- */
dialog.mood-viewer.editor-modal:modal {
  --editor-modal-top: 2vh;
  width: 96vw;
  max-width: 1800px;
  height: 96vh;
  max-height: 96vh;
}

.mood-viewer-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

/* The shell's title rule names a direct child of the header; this one sits
   beside the item's facts. */
.mood-viewer-heading .editor-modal-title {
  min-width: 0;
  margin: 0;
  color: #263b55;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mood-viewer-facts {
  flex: none;
  color: #627185;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.mood-viewer-main {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}

.mood-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  background: #0b0b0c;
}

/* The small picture and the full file share the stage's one cell. */
.mood-stage > .mood-stage-media {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.mood-stage-full {
  opacity: 0;
  transition: opacity 0.18s ease;
}

.mood-stage-full.is-loaded {
  opacity: 1;
}

.mood-stage-step {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  transform: translateY(-50%);
}

.mood-stage-step:hover {
  background: rgba(0, 0, 0, 0.75);
}

.mood-stage-step.is-prev { left: 14px; }
.mood-stage-step.is-next { right: 14px; }

/* A clip's own controls sit at its foot: the steps keep clear of them. */
.mood-stage:has(video) .mood-stage-step {
  top: calc(50% - 24px);
}

.mood-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  border-left: 1px solid #b5c1d0;
  background: #f6f8fb;
}

.mood-side-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mood-side-label {
  color: #566a82;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mood-shoots {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
}

.mood-side-note textarea {
  min-height: 140px;
  resize: vertical;
}

.mood-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.mood-viewer .editor-modal-footer {
  justify-content: space-between;
}

.mood-viewer-footer-gap {
  flex: 1;
}

/* The dialog's first frame, before its fields arrive. */
.mood-side.is-loading {
  background: linear-gradient(90deg, #f6f8fb, #edf1f6, #f6f8fb);
  background-size: 200% 100%;
  animation: mood-side-wait 1.2s ease-in-out infinite;
}

@keyframes mood-side-wait {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---- A photo's crop (crm/public/app/mood-crop.js) ----
 * On the wall the tile takes the crop's shape and the whole picture sits
 * behind it, scaled and shifted so only the crop shows. The script sets the
 * fractions (the CSP allows no style attribute in the markup). */
.mood-tile-open.is-cropped {
  overflow: hidden;
  aspect-ratio: var(--mood-crop-aspect);
}

.mood-tile-open.is-cropped img {
  position: absolute;
  top: calc(-100% * var(--mood-crop-y) / var(--mood-crop-h));
  left: calc(-100% * var(--mood-crop-x) / var(--mood-crop-w));
  width: calc(100% / var(--mood-crop-w));
  max-width: none;
  height: calc(100% / var(--mood-crop-h));
}

/* In the opened photo: the editor's crop box over the picture as drawn. */
.mood-crop-frame {
  position: absolute;
  z-index: 2;
  overflow: hidden;
}

/* While cropping, the crop's own panel and footer stand in for the item's. */
.mood-viewer.is-cropping .mood-stage-step,
.mood-viewer.is-cropping .mood-side > :not(.mood-crop-panel),
.mood-viewer.is-cropping .editor-modal-footer > :not(.mood-crop-footer) {
  display: none;
}

.mood-crop-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mood-crop-footer {
  display: flex;
  flex: 1;
  align-items: center;
}
