/**
 * Contenuti AT: nelle liste, l’icona del tipo file sostituisce il pallino/numero
 * se la riga è un link a un allegato. Vale sul portale e nell’iframe TinyMCE.
 */

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-link,
    .ta-allegato-ext-badge,
    a[href$=".pdf" i], a[href*=".pdf?" i], a[href*=".pdf#" i],
    a[href$=".p7m" i], a[href*=".p7m?" i],
    a[href$=".doc" i], a[href*=".doc?" i], a[href$=".docx" i], a[href*=".docx?" i],
    a[href$=".odt" i], a[href*=".odt?" i], a[href$=".rtf" i], a[href*=".rtf?" i],
    a[href$=".xls" i], a[href*=".xls?" i], a[href$=".xlsx" i], a[href*=".xlsx?" i],
    a[href$=".ods" i], a[href*=".ods?" i], a[href$=".csv" i], a[href*=".csv?" i],
    a[href$=".ppt" i], a[href*=".ppt?" i], a[href$=".pptx" i], a[href*=".pptx?" i],
    a[href$=".odp" i], a[href*=".odp?" i],
    a[href$=".zip" i], a[href*=".zip?" i], a[href$=".rar" i], a[href*=".rar?" i], a[href$=".7z" i], a[href*=".7z?" i]
)) {
    list-style: none;
    position: relative;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-link,
    .ta-allegato-ext-badge,
    a[href$=".pdf" i], a[href*=".pdf?" i], a[href*=".pdf#" i],
    a[href$=".p7m" i], a[href*=".p7m?" i],
    a[href$=".doc" i], a[href*=".doc?" i], a[href$=".docx" i], a[href*=".docx?" i],
    a[href$=".odt" i], a[href*=".odt?" i], a[href$=".rtf" i], a[href*=".rtf?" i],
    a[href$=".xls" i], a[href*=".xls?" i], a[href$=".xlsx" i], a[href*=".xlsx?" i],
    a[href$=".ods" i], a[href*=".ods?" i], a[href$=".csv" i], a[href*=".csv?" i],
    a[href$=".ppt" i], a[href*=".ppt?" i], a[href$=".pptx" i], a[href*=".pptx?" i],
    a[href$=".odp" i], a[href*=".odp?" i],
    a[href$=".zip" i], a[href*=".zip?" i], a[href$=".rar" i], a[href*=".rar?" i], a[href$=".7z" i], a[href*=".7z?" i]
))::marker {
    content: none;
    font-size: 0;
    color: transparent;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-link,
    .ta-allegato-ext-badge,
    a[href$=".pdf" i], a[href*=".pdf?" i], a[href*=".pdf#" i],
    a[href$=".p7m" i], a[href*=".p7m?" i],
    a[href$=".doc" i], a[href*=".doc?" i], a[href$=".docx" i], a[href*=".docx?" i],
    a[href$=".odt" i], a[href*=".odt?" i], a[href$=".rtf" i], a[href*=".rtf?" i],
    a[href$=".xls" i], a[href*=".xls?" i], a[href$=".xlsx" i], a[href*=".xlsx?" i],
    a[href$=".ods" i], a[href*=".ods?" i], a[href$=".csv" i], a[href*=".csv?" i],
    a[href$=".ppt" i], a[href*=".ppt?" i], a[href$=".pptx" i], a[href*=".pptx?" i],
    a[href$=".odp" i], a[href*=".odp?" i],
    a[href$=".zip" i], a[href*=".zip?" i], a[href$=".rar" i], a[href*=".rar?" i], a[href$=".7z" i], a[href*=".7z?" i]
))::before {
    content: "";
    position: absolute;
    left: -1.55em;
    top: 0.12em;
    width: var(--ta-at-file-icon-size, 1.35em);
    height: var(--ta-at-file-icon-size, 1.35em);
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236c757d' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-pdf,
    a[href$=".pdf" i], a[href*=".pdf?" i], a[href*=".pdf#" i]
))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23dc3545' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-p7m,
    a[href$=".p7m" i], a[href*=".p7m?" i]
))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236f42c1' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-word,
    a[href$=".doc" i], a[href*=".doc?" i],
    a[href$=".docx" i], a[href*=".docx?" i],
    a[href$=".odt" i], a[href*=".odt?" i],
    a[href$=".rtf" i], a[href*=".rtf?" i]
))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%230d6efd' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-excel,
    a[href$=".xls" i], a[href*=".xls?" i],
    a[href$=".xlsx" i], a[href*=".xlsx?" i],
    a[href$=".ods" i], a[href*=".ods?" i],
    a[href$=".csv" i], a[href*=".csv?" i]
))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23198754' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-ppt,
    a[href$=".ppt" i], a[href*=".ppt?" i],
    a[href$=".pptx" i], a[href*=".pptx?" i],
    a[href$=".odp" i], a[href*=".odp?" i]
))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23d24726' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol) > li:has(:is(
    a.ta-at-file-zip,
    a[href$=".zip" i], a[href*=".zip?" i],
    a[href$=".rar" i], a[href*=".rar?" i],
    a[href$=".7z" i], a[href*=".7z?" i]
))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23ca8a04' d='M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707z'/%3E%3Cpath fill='%23fff' fill-opacity='.4' d='M9.5 0v3.5a1 1 0 0 0 1 1H14z'/%3E%3C/svg%3E");
}

/**
 * Opzioni di presentazione (menu Formati nell’editor Contenuti AT).
 * Classi: ta-at-elenco--* (tutta la lista) e ta-at-voce--* (singola voce).
 * L’icona del tipo file resta automatica dall’estensione del link.
 */

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol)[class*="ta-at-elenco--"] {
    --ta-at-file-icon-size: 1.35em;
    --ta-at-file-gap: 0.45rem;
    --ta-at-file-text: inherit;
    --ta-at-file-li-margin: 0.55em;
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol)[class*="ta-at-elenco--"] > li,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li[class*="ta-at-voce--"] {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ta-at-file-gap, 0.45rem);
    box-sizing: border-box;
    position: relative;
    list-style: none;
    margin: 0 0 var(--ta-at-file-li-margin, 0.55em);
    padding: 0.1em 0;
    min-height: calc(var(--ta-at-file-icon-size, 1.35em) + 0.35em);
    font-size: var(--ta-at-file-text, inherit);
    line-height: 1.35;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol)[class*="ta-at-elenco--"] > li > p,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li[class*="ta-at-voce--"] > p {
    margin: 0;
}

/* Editor: icona ::before in flusso (non assoluta) quando c’è una presentazione */
:is(
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol)[class*="ta-at-elenco--"] > li::before,
:is(
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li[class*="ta-at-voce--"]::before {
    position: static;
    left: auto;
    top: auto;
    flex: 0 0 var(--ta-at-file-icon-size, 1.35em);
    width: var(--ta-at-file-icon-size, 1.35em);
    height: var(--ta-at-file-icon-size, 1.35em);
    align-self: center;
}

/* Portale: scala l’icona Bootstrap nel link */
.albo-at-pubblico :is(ul, ol)[class*="ta-at-elenco--"] a.ta-at-file-link .ta-at-file-bi,
.albo-at-pubblico li[class*="ta-at-voce--"] a.ta-at-file-link .ta-at-file-bi {
    font-size: var(--ta-at-file-icon-size, 1.35em);
    margin-right: 0;
}

/* --- Misure --- */

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol).ta-at-elenco--compatto,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li.ta-at-voce--compatto {
    --ta-at-file-icon-size: 1.05em;
    --ta-at-file-gap: 0.35rem;
    --ta-at-file-text: 0.9em;
    --ta-at-file-li-margin: 0.35em;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol).ta-at-elenco--grande,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li.ta-at-voce--grande {
    --ta-at-file-icon-size: 1.75em;
    --ta-at-file-gap: 0.55rem;
    --ta-at-file-text: 1.1em;
    --ta-at-file-li-margin: 0.75em;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol).ta-at-elenco--xl,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li.ta-at-voce--xl {
    --ta-at-file-icon-size: 2.2em;
    --ta-at-file-gap: 0.7rem;
    --ta-at-file-text: 1.25em;
    --ta-at-file-li-margin: 1em;
}

/* --- Formati --- */

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol).ta-at-elenco--spaziato > li,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li.ta-at-voce--spaziato {
    --ta-at-file-li-margin: 1.25em;
    margin-bottom: 1.25em;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol).ta-at-elenco--grassetto > li,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li.ta-at-voce--grassetto {
    font-weight: 700;
}

:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) :is(ul, ol).ta-at-elenco--scheda > li,
:is(
    .albo-at-pubblico .albo-at-layout__main-inner,
    .albo-at-pubblico .ta-at-area-hub-content,
    body.mce-content-body,
    body#tinymce,
    body.wp-editor
) li.ta-at-voce--scheda {
    background: #f4f7fb;
    border: 1px solid #d5e0ee;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.65em;
}
