/* Wolfee Instance — workflow activity card restyling
   Caricato globalmente da Site.Master; tutte le regole sono agganciate
   alle classi load-bearing gia presenti nei template HTML di
   ScriptsCustom/Wolfee/WolfeeInstance.js. */

/* Token locali (fallback indipendenti dal tema mandante) */
.istance-activity-card {
    --wf-bg: #ffffff;
    --wf-bg-soft: #f7f6f1;
    --wf-border: #e7e4dc;
    --wf-border-strong: #cfccc1;
    --wf-ink: #1b1a17;
    --wf-ink-2: #43413c;
    --wf-muted: #797668;
    --wf-r: 12px;
    --wf-r-sm: 8px;
    --wf-shadow: 0 1px 2px rgba(20, 18, 14, .04), 0 4px 14px rgba(20, 18, 14, .05);
    --wf-danger: #c63b3b;
    --wf-danger-soft: #f8e2e2;
    /* [2026-07-30 WF-PULSE] Colore dell'alone che pulsa attorno al bottone Completa.
       Segue il tema perche' il bottone e' un .main-bg-button, quindi gia' colorato
       dalla mandante. Doppia dichiarazione voluta: la prima e' il fallback per i
       browser senza color-mix(), la seconda vince dove color-mix e' supportata. */
    --wf-pulse: rgba(47, 125, 79, .45);
    --wf-pulse: color-mix(in srgb, var(--main-bg-color, #2f7d4f) 45%, transparent);
}

/* ====== Card wrapper ====== */
.istance-activity-card.card {
    background: var(--wf-bg);
    border: 1px solid var(--wf-border);
    border-radius: var(--wf-r);
    box-shadow: var(--wf-shadow);
    transition: box-shadow 140ms ease, transform 140ms ease;
}

.istance-activity-card.card:hover {
    box-shadow: 0 2px 4px rgba(20, 18, 14, .06), 0 10px 24px rgba(20, 18, 14, .07);
}

.istance-activity-card .card-body {
    padding: 14px 16px;
}

/* Titolo workflow (mostrato solo in storico per-data) */
.istance-activity-card .card-body > p.bold-text {
    font-size: 13px;
    color: var(--wf-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 8px;
}

/* ====== Header (chip + icone + meta) ====== */
.wolfee-card__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.wolfee-card__header-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.wolfee-card__chip {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    letter-spacing: .01em;
    line-height: 1.2;
    border-radius: 999px;
}

/* Icona tipo attivita (tasks / question) accanto al chip */
.wolfee-card__type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--wf-bg-soft);
    color: var(--wf-ink-2);
    font-size: 13px;
}

/* Riga icone "contenuti" (busta, asterisco, lock, route, ...) */
.wolfee-icon-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.wolfee-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--wf-bg-soft);
    color: var(--wf-ink-2);
    font-size: 11px;
    line-height: 1;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
    cursor: default;
}

.wolfee-meta-icon:hover {
    background: var(--wf-border);
    color: var(--wf-ink);
    transform: translateY(-1px);
}

/* ====== Meta a destra (Riferito a + Ultima modifica) ====== */
.wolfee-card__meta {
    font-size: 12px;
    color: var(--wf-muted);
    text-align: right;
    line-height: 1.55;
    min-width: 180px;
}

.wolfee-card__meta b {
    color: var(--wf-ink-2);
    font-weight: 600;
}

.wolfee-card__meta-stake {
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--wf-border);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    color: var(--wf-ink-2);
}

.wolfee-card__meta-stake .wolfee-meta-icon {
    width: 22px;
    height: 22px;
    font-size: 10px;
}

/* ====== Istruzioni in linea ====== */
.istance-activity-card .card-body > div:not([class]) {
    /* fallback per i blocchi istruzioni iniettati senza classe */
    color: var(--wf-ink-2);
}

/* ====== Riga azioni ====== */
.wolfee-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.wolfee-card__actions-left,
.wolfee-card__actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wolfee-card__actions .btn {
    border-radius: var(--wf-r-sm);
    font-weight: 600;
    letter-spacing: .01em;
    transition: 140ms ease;
}

.wolfee-card__actions .btn:hover {
    transform: translateY(-1px);
}

/* Documents / Notes contatore */
.wolfee-count-badge {
    font-size: 10px;
    line-height: 1;
    margin: 0;
}

.wolfee-count-badge .badge {
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 0 0 2px var(--wf-bg);
}

/* Stato attenzione documenti (al posto del bordo rosso inline) */
.wolfee-docs-attention {
    box-shadow: 0 0 0 3px var(--wf-danger-soft) !important;
    border-color: var(--wf-danger) !important;
}

.wolfee-docs-attention .wolfee-count-badge .badge {
    background-color: var(--wf-danger) !important;
    color: #fff !important;
}

/* ====== Sezioni (checklist / navigazioni / automazioni) ====== */
.istance-activity-card hr {
    border: 0;
    border-top: 1px solid var(--wf-border);
    opacity: 1;
    margin: .75rem 0;
}

.wolfee-check-all {
    display: flex;
    justify-content: center;
    margin: 4px 0 6px;
}

.wolfee-check-all .btn {
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: .01em;
    transition: 140ms ease;
}

.wolfee-check-all .btn:hover {
    transform: translateY(-1px);
}

/* Item checklist / navigazione / automazione */
.list-group-item.wolfee-check-item,
.list-group-item.wolfee-nav-item,
.list-group-item.wolfee-auto-item {
    border: 0;
    border-bottom: 1px dashed var(--wf-border);
    padding: 8px 4px;
    background: transparent;
}

.list-group-item.wolfee-check-item:last-child,
.list-group-item.wolfee-nav-item:last-child,
.list-group-item.wolfee-auto-item:last-child {
    border-bottom: 0;
}

.wolfee-auto-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wolfee-auto-item .form-check-label {
    color: var(--wf-ink-2);
    font-size: 13px;
    flex: 1 1 auto;
    min-width: 0;
}

.wolfee-auto-item .btn {
    border-radius: var(--wf-r-sm);
    padding: 4px 10px;
    font-size: 12px;
}

.wolfee-check-item .form-check,
.wolfee-nav-item .form-check {
    margin-bottom: 0;
    padding-left: 1.7rem;
}

.wolfee-check-item .form-check-input,
.wolfee-nav-item .form-check-input {
    margin-top: .2rem;
    border-color: var(--wf-border-strong);
    cursor: pointer;
}

.wolfee-check-item .form-check-input:checked,
.wolfee-nav-item .form-check-input:checked {
    background-color: var(--main-button-bg-color, #4f8a4c);
    border-color: var(--main-button-bg-color, #4f8a4c);
}

.wolfee-check-item .form-check-label,
.wolfee-nav-item .form-check-label {
    color: var(--wf-ink-2);
    font-size: 13px;
    cursor: pointer;
    line-height: 1.45;
}

.wolfee-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wolfee-nav-item .navigazione-instance-button {
    margin-left: auto;
    border-radius: var(--wf-r-sm);
    padding: 4px 10px;
    font-size: 12px;
}

.wolfee-nav-item .navigazione-instance-button:disabled {
    opacity: .5;
}

/* ====== Bottone "+" nuova attivazione ====== */
#new-wolfee-modal-button-container {
    margin: 6px 0 14px;
}

.wolfee-new-button {
    width: 42px;
    height: 42px;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(20, 18, 14, .12);
    transition: 160ms ease;
}

.wolfee-new-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 18, 14, .18);
}

/* ====== Header del workflow (titolo "Test Completo" + cestino) ====== */
.wolfee-instance-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 4px 4px;
    margin-bottom: 6px;
}

.wolfee-instance-header__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--wf-ink);
    margin: 0;
    letter-spacing: .01em;
    flex: 1 1 auto;
    min-width: 0;
}

/* Bottone cestino "elimina attivazione" — ghost: icona scura a riposo, rossa in hover.
   I token --wf-* sono ridefiniti qui perche' il bottone vive NEL .wolfee-instance-header
   (sopra le activity card) e quindi non eredita i token da .istance-activity-card. */
button.delete-attivazione-wolfee-button {
    --wf-ink: #1b1a17;
    --wf-danger: #c63b3b;
    --wf-danger-soft: #f8e2e2;

    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--wf-ink) !important;
    width: 28px;
    height: 28px;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    box-shadow: none !important;
    transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

button.delete-attivazione-wolfee-button > i {
    color: inherit !important;
    transition: color 140ms ease;
}

button.delete-attivazione-wolfee-button:hover,
button.delete-attivazione-wolfee-button:focus,
button.delete-attivazione-wolfee-button:focus-visible {
    background: var(--wf-danger-soft) !important;
    color: var(--wf-danger) !important;
    border-color: transparent !important;
    transform: translateY(-1px);
}

button.delete-attivazione-wolfee-button:hover > i,
button.delete-attivazione-wolfee-button:focus > i,
button.delete-attivazione-wolfee-button:focus-visible > i {
    color: var(--wf-danger) !important;
}

button.delete-attivazione-wolfee-button:focus-visible {
    outline: 2px solid rgba(198, 59, 59, .35);
    outline-offset: 1px;
}

button.delete-attivazione-wolfee-button:active {
    background: rgba(248, 226, 226, .7) !important;
    transform: translateY(0);
}

/* ====== Responsive: meta sotto su schermi piccoli ====== */
@media (max-width: 575.98px) {
    .wolfee-card__header {
        flex-direction: column;
    }

    .wolfee-card__meta {
        text-align: left;
        min-width: 0;
    }

    .wolfee-card__meta-stake {
        justify-content: flex-start;
    }

    .wolfee-card__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .wolfee-card__actions-right {
        justify-content: flex-end;
    }
}

/* === Storico Workflow: 3 bottoni filtro come segmented pill control === */

/* Wrapper toolbar: ammorbidisce il bordo "border-black" che era troppo aggressivo */
#wolfee-module-history-content .border-black {
    border-color: rgba(0, 0, 0, 0.08) !important;
    background: #fafafa;
    border-radius: 12px !important;
}

/* Rimuove il gap tra i 3 bottoni così si fondono in un controllo unico */
#wolfee-module-history-content .d-flex.gap-2:has(#ordina-per-workflow-button) {
    gap: 0 !important;
}

/* Geometria dei 3 bottoni — i colori vengono da .main-bg-button (Colors.css) */
#wolfee-module-history-content #ordina-per-workflow-button,
#wolfee-module-history-content #ordina-per-sottoattivita-button,
#wolfee-module-history-content #ordina-per-sottoattivita-opposite-button {
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background-color 120ms ease, color 120ms ease;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Pill: estremi arrotondati */
#wolfee-module-history-content #ordina-per-workflow-button {
    border-top-left-radius: 999px !important;
    border-bottom-left-radius: 999px !important;
}
#wolfee-module-history-content #ordina-per-sottoattivita-opposite-button {
    border-top-right-radius: 999px !important;
    border-bottom-right-radius: 999px !important;
}

/* I bottoni 2° e 3° si sovrappongono di 1px al vicino → una sola linea di confine,
   e l'attivo/hover (z-index:1) porta il proprio bordo accent sopra ai vicini. */
#wolfee-module-history-content #ordina-per-sottoattivita-button,
#wolfee-module-history-content #ordina-per-sottoattivita-opposite-button {
    margin-left: -1px !important;
}

/* Hover: porta il bottone in primo piano così tutti e 4 i suoi bordi sono visibili
   (altrimenti il bordo destro del workflow/middle viene coperto dal bordo sinistro
   del vicino che ha margin-left:-1px). */
#wolfee-module-history-content #ordina-per-workflow-button:hover,
#wolfee-module-history-content #ordina-per-sottoattivita-button:hover,
#wolfee-module-history-content #ordina-per-sottoattivita-opposite-button:hover {
    z-index: 2;
}

/* Stato attivo (driven da WolfeeInstance.js: aggiunge/rimuove .activeButton).
   Usa i colori hover di .main-bg-button per coerenza con il tema. */
.activeButton,
#wolfee-module-history-content .activeButton {
    background-color: var(--main-button-hover-bg-color) !important;
    color: var(--main-button-hover-font-color) !important;
    border-color: var(--main-button-hover-border-color) !important;
    transform: none !important;
    z-index: 1;
}

/* Icone nei 3 bottoni filtro tramite ::before (no edit .aspx) */
#wolfee-module-history-content #ordina-per-workflow-button::before,
#wolfee-module-history-content #ordina-per-sottoattivita-button::before,
#wolfee-module-history-content #ordina-per-sottoattivita-opposite-button::before {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    display: inline-block;
}
#wolfee-module-history-content #ordina-per-workflow-button::before {
    content: "\f0e8"; /* fa-sitemap */
}
#wolfee-module-history-content #ordina-per-sottoattivita-button::before {
    content: "\f160"; /* fa-sort-amount-down / fa-arrow-down-wide-short (più recente in cima) */
}
#wolfee-module-history-content #ordina-per-sottoattivita-opposite-button::before {
    content: "\f161"; /* fa-sort-amount-up / fa-arrow-up-wide-short (meno recente in cima) */
}

/* Sostituisce l'icona "Ordina:" da fa-filter a fa-sort (più appropriata per ordinamento) */
#wolfee-module-history-content i.fa-filter::before {
    content: "\f0dc"; /* fa-sort */
}

/* ====== [2026-07-30 WF-PULSE] Pulse morbido sul bottone Completa ======

   La classe .pulse e' aggiunta al bottone da WolfeeInstance.js (createActivityCards,
   case 0 dello switch sul tipo di nodo). Serve a far notare l'azione da fare
   nel pannello Workflow attivo.

   Perche' l'override: .pulse in main.css e' "shadow-pulse 1s infinite", un alone
   NERO che si espande fino a 35px — nato per elementi grandi, dentro una card
   Wolfee stretta diventa una macchia scura sopra i bottoni vicini. Qui si tiene
   la stessa classe (nessun rinominamento) e si sostituisce solo l'animazione:
   alone piccolo (9px) del colore della mandante. Il selettore ha specificita'
   maggiore di ".pulse", quindi non serve !important e la classe globale resta
   intatta per tutti gli altri usi nel progetto.

   Perche' scoped su #wolfee-attivita-container: e' il pannello Workflow attivo,
   il solo posto in cui il bottone Completa viene generato (createActivityCards lo
   costruisce solo se !isCompleted, e le card non completate finiscono solo li').
   Lo scope e' quindi prudenziale: se un domani una card aperta venisse stampata
   anche nello storico ordinato per data, quel bottone NON pulserebbe — ed e'
   corretto, perche' su quel contenitore l'handler del click non e' agganciato
   (WolfeeInstance.js, sezione EVENT HANDLERS) e un bottone che pulsa senza
   rispondere sarebbe peggio di uno fermo. */
@keyframes wolfee-complete-pulse {
    0% {
        box-shadow: 0 0 0 0 var(--wf-pulse);
    }

    70% {
        box-shadow: 0 0 0 9px rgba(0, 0, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

#wolfee-attivita-container .istance-activity-card .activity-complete-button.pulse {
    animation: wolfee-complete-pulse 1.8s cubic-bezier(.4, 0, .2, 1) infinite;
}

/* Chi ha attivato la riduzione dei movimenti nel sistema operativo non deve
   subire un'animazione infinita su ogni card aperta. */
@media (prefers-reduced-motion: reduce) {
    #wolfee-attivita-container .istance-activity-card .activity-complete-button.pulse {
        animation: none;
    }
}

/* ====== [2026-08-07 ICONA-SALVA] Floppy sui bottoni Salva delle pagine Wolfee ======

   Questi due bottoni portano l'icona via ::before invece che con un <i> nel markup,
   a differenza di tutti gli altri "Salva" del progetto. Il motivo e' che hanno
   data-language (Wolfee|Save e Wolfee|SavePositions) e translateElement
   (Scripts/main-Functions.js) li tratta cosi': rimuove i NODI DI TESTO del bottone
   e poi fa .prepend() della stringa tradotta. I figli elemento vengono conservati,
   quindi un <i> non sparirebbe — ma finirebbe DOPO il testo, cioe' l'icona uscirebbe
   a destra dell'etichetta. Un pseudo-elemento e' fuori dal DOM e la traduzione non
   lo puo' toccare, quindi resta a sinistra in ogni lingua.

   Stesso approccio gia' usato qui sopra per i 3 bottoni filtro dello storico.
   margin-right .25rem = esattamente la classe me-1 usata sugli altri Salva. */
#workflow-save-button::before,
#layout-save-button::before {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    content: "\f0c7"; /* fa-floppy-disk */
    display: inline-block;
    margin-right: .25rem;
}
