/**
 * Formati AD nel widget frontend (stessi layout della tab Anteprima AD).
 */
.aaw-widget-ad-wrap {
    max-width: 100%;
}
.aaw-widget-ad-wrap.aaw-widget-ad-wide {
    overflow-x: auto;
}
.aaw-widget-ad-wrap .aaw-preview-frame {
    position: relative;
    overflow: hidden;
}
.aaw-ad-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    line-height: 1.2;
    pointer-events: none;
    max-width: calc(100% - 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Frame base (come anteprima admin) */
.aaw-preview-frame {
    box-sizing: border-box;
    border: 1px solid #8c8f94;
    background: #fff;
    overflow: visible;
    margin: 0 auto;
    --aaw-img-scale: 1;
}
.aaw-preview-link {
    display: block;
    width: 100%;
    height: 100%;
    color: #1d2327;
    text-decoration: none;
    box-sizing: border-box;
}
.aaw-preview-img {
    display: block;
    object-fit: contain;
    background: #f0f0f1;
    transform: scale(var(--aaw-img-scale, 1));
    transform-origin: center center;
}
.aaw-preview-img.aaw-img-shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.aaw-preview-img.aaw-img-shadow-md {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

/* Ordine: testo prima (colonna) */
.aaw-f-300x250 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-336x280 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-160x600 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-300x600 .aaw-preview-link.aaw-layout-text-first {
    flex-direction: column-reverse;
}
/* Ordine: testo prima (riga) */
.aaw-f-728x90 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-970x250 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-320x50 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-300x50 .aaw-preview-link.aaw-layout-text-first,
.aaw-f-320x100 .aaw-preview-link.aaw-layout-text-first {
    flex-direction: row-reverse;
}
.aaw-preview-title {
    margin: 0;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.25;
}
.aaw-preview-price {
    font-weight: 700;
    color: #c45500;
    white-space: nowrap;
}

/* --- Desktop --- */
.aaw-f-300x250 .aaw-preview-link {
    display: flex;
    flex-direction: column;
    padding: 8px;
    height: 100%;
}
.aaw-f-300x250 .aaw-preview-img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.aaw-f-300x250 .aaw-preview-text {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.aaw-f-300x250 .aaw-preview-title {
    font-size: 13px;
    max-height: 3.6em;
    overflow: hidden;
    margin-bottom: 6px;
}
.aaw-f-300x250 .aaw-preview-price {
    font-size: 15px;
}

.aaw-f-336x280 .aaw-preview-link {
    display: flex;
    flex-direction: column;
    padding: 8px;
    height: 100%;
}
.aaw-f-336x280 .aaw-preview-img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    margin-bottom: 8px;
}
.aaw-f-336x280 .aaw-preview-title {
    font-size: 13px;
    max-height: 3.6em;
    overflow: hidden;
    margin-bottom: 6px;
}
.aaw-f-336x280 .aaw-preview-price {
    font-size: 15px;
}

.aaw-f-728x90 .aaw-preview-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 4px 10px;
    gap: 12px;
    height: 100%;
}
.aaw-f-728x90 .aaw-preview-img {
    width: auto;
    height: 78px;
    max-width: 120px;
    flex-shrink: 0;
}
.aaw-f-728x90 .aaw-preview-text {
    flex: 1;
    min-width: 0;
}
.aaw-f-728x90 .aaw-preview-title {
    font-size: 13px;
    max-height: 2.5em;
    overflow: hidden;
    margin-bottom: 4px;
}
.aaw-f-728x90 .aaw-preview-price {
    font-size: 14px;
}

.aaw-f-970x250 .aaw-preview-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 14px;
    gap: 16px;
    height: 100%;
}
.aaw-f-970x250 .aaw-preview-img {
    width: auto;
    height: 210px;
    max-width: 240px;
    flex-shrink: 0;
}
.aaw-f-970x250 .aaw-preview-text {
    flex: 1;
    min-width: 0;
}
.aaw-f-970x250 .aaw-preview-title {
    font-size: 16px;
    max-height: 3em;
    overflow: hidden;
    margin-bottom: 8px;
}
.aaw-f-970x250 .aaw-preview-price {
    font-size: 20px;
}

.aaw-f-160x600 .aaw-preview-link {
    display: flex;
    flex-direction: column;
    padding: 8px;
    height: 100%;
    text-align: center;
}
.aaw-f-160x600 .aaw-preview-img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 10px;
}
.aaw-f-160x600 .aaw-preview-title {
    font-size: 12px;
    max-height: 6em;
    overflow: hidden;
    margin-bottom: 8px;
}
.aaw-f-160x600 .aaw-preview-price {
    font-size: 15px;
}

.aaw-f-300x600 .aaw-preview-link {
    display: flex;
    flex-direction: column;
    padding: 10px;
    height: 100%;
}
.aaw-f-300x600 .aaw-preview-img {
    width: 100%;
    height: 280px;
    object-fit: contain;
    margin-bottom: 12px;
}
.aaw-f-300x600 .aaw-preview-title {
    font-size: 14px;
    max-height: 5em;
    overflow: hidden;
    margin-bottom: 10px;
}
.aaw-f-300x600 .aaw-preview-price {
    font-size: 17px;
}

/* --- Mobile --- */
.aaw-f-320x50 .aaw-preview-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 4px 6px;
    gap: 8px;
    height: 100%;
}
.aaw-f-320x50 .aaw-preview-img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.aaw-f-320x50 .aaw-preview-title {
    display: none;
}
.aaw-f-320x50 .aaw-preview-text {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.aaw-f-320x50 .aaw-preview-price {
    font-size: 12px;
}

.aaw-f-300x50 .aaw-preview-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 4px 6px;
    gap: 8px;
    height: 100%;
}
.aaw-f-300x50 .aaw-preview-img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.aaw-f-300x50 .aaw-preview-title {
    display: none;
}
.aaw-f-300x50 .aaw-preview-text {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.aaw-f-300x50 .aaw-preview-price {
    font-size: 12px;
}

.aaw-f-320x100 .aaw-preview-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    gap: 10px;
    height: 100%;
}
.aaw-f-320x100 .aaw-preview-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.aaw-f-320x100 .aaw-preview-text {
    flex: 1;
    min-width: 0;
}
.aaw-f-320x100 .aaw-preview-title {
    font-size: 11px;
    max-height: 2.6em;
    overflow: hidden;
    margin-bottom: 4px;
}
.aaw-f-320x100 .aaw-preview-price {
    font-size: 13px;
}

@media (max-width: 1100px) {
    .aaw-widget-ad-wrap.aaw-widget-ad-wide {
        overflow-x: auto;
    }
}

/* Effetti leggibilità su foto */
.aaw-tfx-soft.aaw-preview-title,
.aaw-tfx-soft.aaw-preview-price {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 1px rgba(0, 0, 0, 0.75);
}
.aaw-tfx-strong.aaw-preview-title,
.aaw-tfx-strong.aaw-preview-price {
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.95),
        0 0 2px #000,
        0 1px 8px rgba(0, 0, 0, 0.85);
}
.aaw-tfx-glow.aaw-preview-title,
.aaw-tfx-glow.aaw-preview-price {
    text-shadow:
        0 0 8px rgba(255, 255, 255, 0.95),
        0 0 2px rgba(255, 255, 255, 0.6),
        0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Banner: testo sopra immagine (z-index), immagine sotto */
.aaw-layout-overlay .aaw-preview-link.aaw-layout-overlay-link {
    display: block;
    position: relative;
    height: 100%;
    padding: 0;
}
.aaw-layout-overlay .aaw-preview-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    z-index: 0;
}
.aaw-layout-overlay .aaw-preview-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 10px 12px 12px;
    box-sizing: border-box;
    min-height: 38%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 4px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
}
.aaw-layout-overlay .aaw-ad-badge {
    z-index: 4;
}
/* In overlay mostra il titolo anche sui micro-banner (il formato di default lo nasconde) */
.aaw-layout-overlay .aaw-f-320x50 .aaw-preview-title,
.aaw-layout-overlay .aaw-f-300x50 .aaw-preview-title {
    display: block !important;
    font-size: 10px;
    max-height: 2.4em;
    line-height: 1.2;
}
.aaw-layout-overlay .aaw-f-320x50 .aaw-preview-text,
.aaw-layout-overlay .aaw-f-300x50 .aaw-preview-text {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: auto;
    padding: 4px 8px;
}
.aaw-widget-single {
    display: block;
    max-width: 100%;
}
