/* Rich, dynamic thumbnails (reusable). */
.rich-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.rich-thumb__main {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rich-thumb__crumbs {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: calc(100% - 20px);
  overflow: hidden;
  pointer-events: auto;
}

.rich-thumb__crumb {
  width: 43px;
  height: 43px;
  border-radius: 10px;
  border: 3px solid #ffffff;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.rich-thumb__crumb--image {
  object-fit: cover;
}

.rich-thumb__crumb--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  /* If not overridden inline, match the canvas card icon strip feel */
  background: linear-gradient(135deg, #8b3dff 0%, #6a1b9a 100%);
  color: #ffffff;
}

/* Canvas list + dashboard thumbnails */
.canvas-card-thumb {
  aspect-ratio: 16 / 10;
  border-radius: 0.75rem;
  background: #eef1f6;
  overflow: hidden;
  border: 1px solid rgba(28, 36, 51, 0.09);
}
.canvas-card-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}
.canvas-card-thumb.canvas-card-thumb--footer {
  aspect-ratio: auto;
  min-height: 0;
  border-radius: 0.35rem;
}
.canvas-card-name.text-muted {
  font-style: italic;
}

/* Maps list view toggle (match relational canvas toggle feel). */
.maps-view-toggle {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  border: 1px solid rgba(28, 36, 51, 0.18);
  background: #fff;
  overflow: hidden;
}

.maps-view-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: rgba(33, 37, 41, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.maps-view-btn + .maps-view-btn {
  border-left: 1px solid rgba(28, 36, 51, 0.18);
}

.maps-view-btn.is-active {
  background: #e2e8f0;
  color: rgba(33, 37, 41, 1);
}

.maps-list-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.maps-list-toolbar .maps-mechanisms-filter {
  justify-self: start;
}

.maps-list-display-summary {
  justify-self: center;
  text-align: center;
  white-space: nowrap;
}

.maps-list-toolbar .maps-view-toggle {
  justify-self: end;
}

.maps-mechanisms-filter {
  cursor: default;
}

.maps-mechanisms-filter .form-check-input {
  cursor: pointer;
}

.maps-list-item__stacked {
  display: none;
}

.maps-list.maps-list--stacked .maps-list-item__grid {
  display: none;
}

.maps-list.maps-list--stacked .maps-list-item__stacked {
  display: block;
}

/* Force full-width items in stacked mode (override Bootstrap col-*). */
.maps-list.maps-list--stacked > .maps-list-item {
  flex: 0 0 100%;
  max-width: 100%;
}

/* While dragging in stacked mode, collapse everything except name + progress. */
.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .maps-list-item__stacked-thumb,
.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked p,
.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .maps-focus-row,
.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .canvas-holding-ground-counts,
.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .canvas-field-of-view-counts,
.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .maps-caretakers-stack {
  display: none !important;
}

/* When sorting in stacked mode, collapse ALL items (not just the dragged one). */
body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked .maps-list-item__stacked-thumb,
body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked p,
body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked .maps-focus-row,
body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked .canvas-holding-ground-counts,
body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked .canvas-field-of-view-counts,
body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked .maps-caretakers-stack {
  display: none !important;
}

body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked .card-body {
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
}

body.maps-view--stacked.is-sorting .maps-list.maps-list--stacked .maps-list-item__stacked h4 {
  margin-bottom: 0 !important;
}

/* Mirror is appended to body; scope it using a global view class. */
body.maps-view--stacked .sortable-item.is-drag-mirror {
  width: min(1100px, calc(100vw - 2rem)) !important;
  max-width: calc(100vw - 2rem) !important;
}

body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__grid {
  display: none !important;
}

body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked {
  display: block !important;
}

/* Apply the same compact hide rules to the mirror in stacked mode. */
body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked .maps-list-item__stacked-thumb,
body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked p,
body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked .maps-focus-row,
body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked .canvas-holding-ground-counts,
body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked .canvas-field-of-view-counts,
body.maps-view--stacked .sortable-item.is-drag-mirror .maps-list-item__stacked .maps-caretakers-stack {
  display: none !important;
}

.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .card-body {
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
}

.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked h4 {
  margin-bottom: 0 !important;
}

.maps-list.maps-list--stacked .sortable-item.is-dragging .maps-list-item__stacked .maps-list-item__stacked-progress {
  align-items: center;
}

.maps-list-item__stacked-thumb {
  width: 220px;
}

.maps-list-item__stacked-thumb .canvas-card-thumb {
  width: 220px;
  aspect-ratio: 16 / 10;
}

.maps-list-item__stacked-progress {
  width: 220px;
  display: flex;
  align-items: center;
}

.maps-stacked-progress-wrap > .d-flex {
  margin-top: 0 !important;
}

.maps-stacked-progress-wrap .flex-grow-1 {
  min-width: 140px;
}

.maps-stacked-progress-wrap .progress {
  min-width: 140px;
}

.maps-focus-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.maps-focus-crumb {
  width: 43px;
  height: 43px;
  border-radius: 10px;
  border: 3px solid #ffffff;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.maps-focus-crumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Caretakers avatar stack (inline, list context). */
.maps-caretakers-stack {
  gap: 0;
}

.maps-caretaker-avatar {
  position: relative;
  flex-shrink: 0;
  border-radius: 999px;
  line-height: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.maps-caretaker-avatar + .maps-caretaker-avatar {
  margin-right: -10px;
}

.maps-caretaker-avatar img {
  object-fit: cover;
  vertical-align: middle;
}

