/* =========================================================
   MAAU — Banner Media
   Rasio tetap, gambar mengisi bingkai dengan crop tengah.
   ========================================================= */

.banner-media {
    --banner-ratio: 8 / 3;

    width: 100%;
    min-width: 0;
}

/* Desktop */
.banner-media[data-banner-placement='announcement'] {
    --banner-ratio: 24 / 1;
}

.banner-media[data-banner-placement='hero'] {
    --banner-ratio: 8 / 3;
}

.banner-media[data-banner-placement='popup'] {
    --banner-ratio: 4 / 5;
}

.banner-media[data-banner-placement='inline'] {
    --banner-ratio: 4 / 1;
}

.banner-media[data-banner-placement='category'] {
    --banner-ratio: 10 / 3;
}

/* Mobile preview */
.banner-media[data-banner-placement='announcement'][data-banner-device='mobile'] {
    --banner-ratio: 25 / 4;
}

.banner-media[data-banner-placement='hero'][data-banner-device='mobile'] {
    --banner-ratio: 3 / 4;
}

.banner-media[data-banner-placement='popup'][data-banner-device='mobile'] {
    --banner-ratio: 4 / 5;
}

.banner-media[data-banner-placement='inline'][data-banner-device='mobile'] {
    --banner-ratio: 2 / 1;
}

.banner-media[data-banner-placement='category'][data-banner-device='mobile'] {
    --banner-ratio: 4 / 3;
}

/* =========================================================
   Preview di ilustrasi website
   Picture menjadi bingkai; ukuran asli gambar tidak
   menentukan ukuran banner.
   ========================================================= */

.maau-banners .banner-media > picture {
    position: relative;
    display: block;

    width: 100%;
    max-width: 100%;
    height: auto;
    min-width: 0;
    margin: 0;

    aspect-ratio: var(--banner-ratio);
    overflow: hidden;

    border-radius: 7px;
    background: #f7f2e9;
}

.maau-banners .banner-media > picture > img {
    position: absolute;
    inset: 0;
    display: block;

    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;

    object-fit: cover;
    object-position: center center;

    border: 0;
    border-radius: 0;
}

/* Mencegah isi preview melebar keluar dari kartu. */
.maau-banners .banner-preview-panel,
.maau-banners .banner-map-slot,
.maau-banners .banner-map-popup {
    min-width: 0;
}

.maau-banners .banner-preview-panel {
    width: 100%;
    max-width: 100%;
}

/* =========================================================
   Preview gambar pada form upload
   ========================================================= */

.maau-banners .banner-editor-preview-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.maau-banners .banner-editor-preview-canvas {
    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding: 20px;

    border: 1px solid #ead7c0;
    border-radius: 12px;
    background: #f7f2e9;
}

.maau-banners .banner-editor-frame {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.maau-banners .banner-editor-frame[data-banner-device='mobile'] {
    max-width: 360px;
}

.maau-banners .banner-editor-frame[data-banner-placement='popup'] {
    max-width: 320px;
}

.maau-banners .banner-editor-frame > .banner-media-image {
    display: block;

    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    margin: 0;

    aspect-ratio: var(--banner-ratio);
    object-fit: cover;
    object-position: center center;

    border: 1px solid #ead7c0;
    border-radius: 7px;
    background: #f7f2e9;
}

/* Tetap menyembunyikan elemen saat mode preview berubah. */
.maau-banners .banner-media [hidden] {
    display: none !important;
}

.maau-banners .banner-editor-preview-empty {
    display: grid;
    place-items: center;

    min-height: 150px;
    padding: 24px;

    border: 1px dashed #a67c52;
    border-radius: 7px;
    background: #ffffff;

    color: #6a402d;
    font-size: 13px;
    line-height: 1.7;
    text-align: center;
}

.maau-banners .banner-editor-preview-text {
    padding: 12px 16px;

    border-radius: 7px;
    background: #6a402d;

    color: #ffffff;
    font-size: 13px;
    line-height: 1.7;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.maau-banners .banner-editor-preview-size {
    margin: 0 0 14px;

    color: #6a402d;
    font-size: 12px;
    line-height: 1.7;
}

.maau-banners .banner-editor-preview-note {
    margin: 14px 0 0;

    color: #6a402d;
    font-size: 12px;
    line-height: 1.7;
}

/* =========================================================
   Responsive preview
   ========================================================= */

@media (max-width: 640px) {
    .banner-media[data-banner-placement='announcement'][data-banner-device='responsive'] {
        --banner-ratio: 25 / 4;
    }

    .banner-media[data-banner-placement='hero'][data-banner-device='responsive'] {
        --banner-ratio: 3 / 4;
    }

    .banner-media[data-banner-placement='popup'][data-banner-device='responsive'] {
        --banner-ratio: 4 / 5;
    }

    .banner-media[data-banner-placement='inline'][data-banner-device='responsive'] {
        --banner-ratio: 2 / 1;
    }

    .banner-media[data-banner-placement='category'][data-banner-device='responsive'] {
        --banner-ratio: 4 / 3;
    }

    .maau-banners .banner-editor-preview-canvas {
        padding: 12px;
    }
}
