/*
 * Backend page-module preview styling.
 *
 * The auto-generated Content Block "backend-preview" templates dump every field
 * inline, including full-size <f:image> tags — which render enormous in the page
 * module. This constrains preview images to neat thumbnails and tidies the text.
 * Loaded for the whole backend via BE/stylesheets (see ext_localconf.php); it
 * targets the core preview wrapper, so it improves every content element preview.
 */

.element-preview-content {
    font-size: 0.8rem;
    line-height: 1.45;
}

/* Oversized preview images -> compact, tidy thumbnails */
.element-preview-content img {
    display: inline-block;
    width: auto;
    height: auto;
    max-width: 140px;
    max-height: 90px;
    margin: 4px 6px 4px 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    object-fit: cover;
    vertical-align: middle;
}

/* SVG icons (e.g. hero/services icons) tend to lack intrinsic size -> cap them */
.element-preview-content svg {
    max-width: 48px;
    max-height: 48px;
    height: auto;
    vertical-align: middle;
}

/* Keep long links/paths from blowing out the column width */
.element-preview-content a {
    word-break: break-word;
}

/* ---------------------------------------------------------------------------
 * Never restyle TYPO3's own backend icons.
 * Some elements inside container did not have visible edit buttons.
 * ------------------------------------------------------------------------- */
.element-preview-content .t3js-icon img,
.element-preview-content .t3js-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    object-fit: fill;
    vertical-align: baseline;
}

/* ---------------------------------------------------------------------------
 * Gallery (homepage) preview: each collection item as a title + thumbnail grid.
 * Markup: gallery-homepage/templates/backend-preview.html (.cb-gallery-preview)
 * ------------------------------------------------------------------------- */
.cb-gallery-preview__item {
    padding: 10px 0;
}

.cb-gallery-preview__item + .cb-gallery-preview__item {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.cb-gallery-preview__title {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

/* Items often have no title -> show a muted placeholder instead of nothing */
.cb-gallery-preview__title:empty::before {
    content: "(ohne Titel)";
    font-weight: 400;
    font-style: italic;
    color: rgba(0, 0, 0, 0.4);
}

.cb-gallery-preview__images {
    display: grid;
    grid-template-columns: repeat(auto-fill, 96px);
    gap: 6px;
}

/* Uniform thumbnails — overrides the generic preview-image rule above */
.cb-gallery-preview__images img {
    width: 96px;
    height: 64px;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    object-fit: cover;
}

/* ---------------------------------------------------------------------------
 * Logo container preview: grid of logo cards (logo + label).
 * Logos are usually transparent -> contained on a light tile, not cropped.
 * Markup: logo-container/templates/backend-preview.html (.cb-logo-grid)
 * ------------------------------------------------------------------------- */
.cb-logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.cb-logo-grid__cell {
    margin: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    text-align: center;
}

.cb-logo-grid__cell img {
    display: block;
    width: 100%;
    height: 70px;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 10px;
    border: 0;
    border-radius: 0;
    background: #f7f7f7;
    object-fit: contain;
}

.cb-logo-grid__cell figcaption {
    padding: 5px 8px;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.cb-logo-grid__cell figcaption:empty::before {
    content: "(ohne Label)";
    font-style: italic;
    color: rgba(0, 0, 0, 0.4);
}

/* ---------------------------------------------------------------------------
 * CTA preview: circular avatar + title + (tag-stripped) body + link label.
 * Markup: cta/templates/backend-preview.html (.cb-cta-preview)
 * ------------------------------------------------------------------------- */
.cb-cta-preview {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 6px;
}

/* Circular avatar — overrides the generic preview-image rule above */
.cb-cta-preview img {
    width: 64px;
    height: 64px;
    max-width: none;
    max-height: none;
    margin: 0;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.cb-cta-preview__body {
    min-width: 0;
}

.cb-cta-preview__title {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.cb-cta-preview__text {
    color: rgba(0, 0, 0, 0.65);
    margin-bottom: 8px;
}

.cb-cta-preview__link {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.06);
    font-weight: 600;
    font-size: 0.75rem;
}
