/*
 * Publicidade do sistema:
 * - Laterais: somente computadores com mouse e área suficiente (nunca no mobile).
 * - Capa: exclusivamente no dashboard, abaixo dos atalhos; responsiva.
 */
.anuncios-widget[hidden], .anuncios-widget .anuncios-rail[hidden], .anuncios-capa[hidden] {
    display: none !important;
}

/* Padrão seguro: NUNCA exibir anúncios laterais em celular/tablet ou tela estreita. */
.anuncios-widget { display: none !important; box-sizing: border-box; }
.anuncios-widget .anuncios-rail { min-width: 0; }

.anuncios-widget .anuncio-card,
.anuncios-capa .anuncio-card {
    display: block;
    overflow: hidden;
    border-radius: 17px;
    text-decoration: none;
    background: #fff;
    color: #1e293b;
    border: 1px solid rgba(148,163,184,.25);
    box-shadow: 0 12px 34px rgba(0,0,0,.17);
    transition: box-shadow .2s, transform .2s;
}
.anuncios-widget a.anuncio-card:hover,
.anuncios-capa a.anuncio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0,0,0,.22);
}
.anuncios-widget a.anuncio-card:focus-visible,
.anuncios-capa a.anuncio-card:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
}
.anuncios-widget .anuncio-etiqueta {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    background: #e7eef9;
    color: #315778;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .065em;
    text-transform: uppercase;
}
.anuncios-widget .anuncio-imagem {
    display: block;
    width: 100%;
    height: 225px;
    object-fit: contain;
    background: #f1f5f9;
}
.anuncios-widget .anuncio-titulo {
    display: block;
    padding: 9px 10px 11px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-align: center;
}
.anuncios-widget .anuncio-sinal-link {
    display: block;
    padding: 0 9px 8px;
    text-align: center;
    font-size: 10px;
    color: #2563eb;
}

/* Só habilita os espaços laterais em desktop (ponteiro preciso e espaço real). */
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
    .anuncios-widget[data-tela="login"]:not([hidden]) {
        display: block !important;
        position: fixed;
        inset: 0;
        z-index: 5;
        pointer-events: none;
    }
    .anuncios-widget[data-tela="login"] .anuncios-rail {
        width: 190px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: auto;
    }
    /* Posição horizontal é calculada em JS conforme espaço livre real.
       Se faltar espaço, o banner desaparece em vez de subir para o topo. */
}
@media (min-width: 1520px) and (hover: hover) and (pointer: fine) {
    .anuncios-widget[data-tela="dashboard"]:not([hidden]) {
        display: block !important;
        position: fixed;
        inset: 0;
        z-index: 9;
        pointer-events: none;
    }
    .anuncios-widget[data-tela="dashboard"] .anuncios-rail {
        width: 190px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: auto;
    }
    /* Nada de fallback para uma faixa horizontal junto aos ícones. */
}

/* Capa horizontal, encaixada no fluxo da página logo abaixo dos cinco blocos.
   A altura agora acompanha a própria arte, evitando faixas brancas acima/abaixo.
   Se a arte for mais alta que o padrão 1000x300, a altura máxima é limitada. */
.anuncios-capa {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 28px;
    box-sizing: border-box;
}
.anuncios-capa .anuncios-conteudo {
    width: 100%;
    display: flex;
    justify-content: center;
}
.anuncios-capa .anuncio-card--capa {
    display: block;
    position: relative;
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 7px 18px rgba(0,0,0,.09);
}
.anuncios-capa .anuncio-imagem {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(300px, 30vw);
    display: block;
    margin: 0 auto;
    object-fit: contain;
    background: transparent;
}
.anuncios-capa .anuncio-etiqueta {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    border-radius: 5px;
    padding: 3px 7px;
    background: rgba(15,23,42,.76);
    color: #fff;
    pointer-events: none;
}
@media (max-width: 576px) {
    .anuncios-capa { margin-bottom: 22px; }
    .anuncios-capa .anuncio-card--capa { border-radius: 10px; }
    .anuncios-capa .anuncio-etiqueta { top: 5px; left: 5px; font-size: 9px; padding: 2px 5px; }
}
@media (prefers-reduced-motion: reduce) {
    .anuncios-widget .anuncio-card, .anuncios-capa .anuncio-card { transition: none; }
}
