/* RM Task — dynamisk cover (HTML/CSS + Lucide). Kun tasks. */

.rm-task-cover {
  --rm-task-cover-radius: 10px;
  --rm-task-cover-type-size: clamp(17px, 13cqi, 32px);
  --rm-task-cover-type-lh: 1.08;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 4 / 5;
  max-width: 100%;
  max-height: 100%;
  background: #ffffff;
  border-radius: var(--rm-task-cover-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  color: #000000;
  font-family: Raleway, system-ui, sans-serif;
}

.rm-task-cover__inner {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* hele gruppen midt på coveret */
  gap: clamp(8px, 3.2cqi, 14px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  padding: clamp(16px, 8cqi, 32px) clamp(12px, 7cqi, 28px);
  text-align: center;
}

.rm-task-cover__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  padding: 0.5em 1em;
  border-radius: 999px;
  font-size: clamp(12px, 7cqi, 16px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  color: #000000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-task-cover__type {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* titel vokser nedad i fast 2-linjers felt */
  gap: 0;
  box-sizing: border-box;
  flex: 0 0 auto;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: var(--rm-task-cover-type-size);
  line-height: var(--rm-task-cover-type-lh);
  /* Lås præcis 2 linjer — 1-linje-titler efterlader tom plads, ikon står fast */
  height: calc(2 * var(--rm-task-cover-type-lh) * 1em);
  min-height: calc(2 * var(--rm-task-cover-type-lh) * 1em);
  max-height: calc(2 * var(--rm-task-cover-type-lh) * 1em);
  overflow: hidden;
}

.rm-task-cover__type-line {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: calc(var(--rm-task-cover-type-lh) * 1em);
  font-size: 1em;
  font-weight: 900;
  line-height: var(--rm-task-cover-type-lh);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #000000;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.rm-task-cover__type-line:empty::before {
  content: '\00a0'; /* tom anden linje beholder højde */
}

.rm-task-cover__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  color: #000000;
  line-height: 0;
}

.rm-task-cover__icon-svg {
  width: clamp(56px, 44cqi, 140px);
  max-width: 82%;
  height: auto;
  display: block;
}

/* Container query root for indlejrede covers */
.h5g-rm-task-card__visual-cover-wrap,
.rm-task-media-preview-box,
.rm-modal-event-image.rm-modal-event-image--task,
.rm-overview-card-image-crop {
  container-type: inline-size;
  container-name: rm-task-cover;
}

/* Indlejret: hvid cover fylder feltet (ingen pink ramme omkring) */
.h5g-rm-task-card__visual .rm-task-cover,
.rm-task-media-preview-box .rm-task-cover,
.rm-modal-event-image .rm-task-cover,
.rm-overview-card-image-crop .rm-task-cover {
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: none;
  box-shadow: none;
  border-radius: 0;
}

/* Toolbox: pink felt væk — cover fylder top/bund/venstre absolut */
.h5g-rm-task-card__visual:has(.h5g-rm-task-card__visual-cover-wrap) {
  background: #ffffff !important;
  justify-content: stretch !important;
  align-items: stretch !important;
  padding: 0 !important;
  position: relative;
}

.h5g-rm-task-card__visual-cover-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  margin: 0 !important;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
}

.h5g-rm-task-card__visual-cover-wrap .rm-task-cover {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0 !important;
  aspect-ratio: unset !important;
}

/* Flow / RM Events oversigt: cover fylder hele billede-crop */
.rm-overview-card-image-crop .rm-task-cover {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
  position: absolute;
  inset: 0;
  aspect-ratio: unset;
}

.rm-overview-card-image-crop:has(.rm-task-cover) {
  position: relative;
  background: #ffffff;
}

/* Admin form preview */
.rm-task-media-preview-box .rm-task-cover--preview {
  max-width: 280px;
  min-height: 320px;
  margin: 0 auto;
}

/* Admin settings: cover matrix */
.rm-task-cover-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin: 1em 0 2em;
}

.rm-task-cover-admin-grid__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  container-type: inline-size;
  container-name: rm-task-cover;
}

.rm-task-cover-admin-grid__item .rm-task-cover {
  min-height: 200px;
}

.rm-task-cover-admin-grid__caption {
  font-size: 12px;
  color: #555;
  text-align: center;
}

.rm-task-cover-admin-table input[type="text"],
.rm-task-cover-admin-table input[type="color"] {
  max-width: 100%;
}

/* Fallback når container queries ikke understøttes (sjældent) */
@supports not (container-type: inline-size) {
  .rm-task-cover {
    --rm-task-cover-type-size: clamp(17px, 3.2vw, 30px);
  }
  .rm-task-cover__icon-svg {
    width: clamp(56px, 12vw, 130px);
  }
  .rm-task-cover__badge {
    font-size: clamp(12px, 2vw, 15px);
  }
}
