/* ==========================================================================
   UI-COMP-001B — ENTERPRISE ACTION BAR FOUNDATION

   Componente condiviso per:
   - modalità GRID;
   - modalità FORM;
   - icone colorate;
   - tooltip nativi;
   - stati active, disabled e loading;
   - comportamento responsive.

   Nessuna persistenza funzionale viene gestita da questo componente.
   ========================================================================== */

.enterprise-action-bar {
    --enterprise-action-bar-surface:
        var(--surface, var(--company-explorer-surface, #ffffff));
    --enterprise-action-bar-surface-hover:
        var(--surface-hover, var(--company-explorer-surface-hover, #f4f7fb));
    --enterprise-action-bar-border:
        var(--border, var(--company-explorer-border, #dbe3ec));
    --enterprise-action-bar-text:
        var(--text-primary, var(--company-explorer-text, #172033));
    --enterprise-action-bar-muted:
        var(--text-secondary, var(--company-explorer-muted, #66758a));
    --enterprise-action-bar-focus:
        var(--accent, var(--company-explorer-accent, #42d3c8));

    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;

    min-width: 0;
}

.enterprise-action-bar[data-mode="grid"],
.enterprise-action-bar[data-mode="form"] {
    position: relative;
}

.enterprise-action-bar__group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.enterprise-action-bar__group + .enterprise-action-bar__group {
    margin-left: 2px;
    padding-left: 8px;
    border-left: 1px solid var(--enterprise-action-bar-border);
}

.enterprise-action-bar__item {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-width: 38px;
    min-height: 38px;
    padding: 6px 10px;

    border: 1px solid var(--enterprise-action-bar-border);
    border-radius: 9px;

    background: var(--enterprise-action-bar-surface);
    color: var(--enterprise-action-bar-text);

    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
    user-select: none;

    transition:
        transform 120ms ease,
        border-color 120ms ease,
        background-color 120ms ease,
        box-shadow 120ms ease;
}

.enterprise-action-bar__item:hover {
    background: var(--enterprise-action-bar-surface-hover);
    border-color: color-mix(
        in srgb,
        var(--enterprise-action-color, var(--enterprise-action-bar-focus)) 65%,
        var(--enterprise-action-bar-border)
    );

    box-shadow:
        0 5px 14px
        color-mix(
            in srgb,
            var(--enterprise-action-color, var(--enterprise-action-bar-focus)) 15%,
            transparent
        );

    transform: translateY(-1px);
}

.enterprise-action-bar__item:active {
    transform: translateY(0);
}

.enterprise-action-bar__item:focus-visible {
    outline: 2px solid
        var(--enterprise-action-color, var(--enterprise-action-bar-focus));
    outline-offset: 2px;
}

.enterprise-action-bar__item[aria-pressed="true"],
.enterprise-action-bar__item.is-active {
    border-color:
        var(--enterprise-action-color, var(--enterprise-action-bar-focus));

    background:
        color-mix(
            in srgb,
            var(--enterprise-action-color, var(--enterprise-action-bar-focus)) 12%,
            var(--enterprise-action-bar-surface)
        );
}

.enterprise-action-bar__item:disabled,
.enterprise-action-bar__item[aria-disabled="true"] {
    opacity: 0.48;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.enterprise-action-bar__item.is-loading {
    cursor: wait;
}

.enterprise-action-bar__icon {
    position: relative;

    display: inline-grid;
    place-items: center;

    width: 25px;
    min-width: 25px;
    height: 25px;

    border-radius: 7px;

    background:
        color-mix(
            in srgb,
            var(--enterprise-action-color, var(--enterprise-action-bar-focus)) 17%,
            transparent
        );

    color:
        var(--enterprise-action-color, var(--enterprise-action-bar-focus));

    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.enterprise-action-bar__label {
    white-space: nowrap;
}

.enterprise-action-bar__badge {
    display: inline-grid;
    place-items: center;

    min-width: 18px;
    height: 18px;
    padding: 0 5px;

    border-radius: 999px;

    background:
        var(--enterprise-action-color, var(--enterprise-action-bar-focus));
    color: #07111f;

    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

/* Colori coerenti con il linguaggio visuale della Sidebar Enterprise. */

.enterprise-action-bar__item[data-color="cyan"] {
    --enterprise-action-color: #22d3ee;
}

.enterprise-action-bar__item[data-color="blue"] {
    --enterprise-action-color: #60a5fa;
}

.enterprise-action-bar__item[data-color="violet"] {
    --enterprise-action-color: #a78bfa;
}

.enterprise-action-bar__item[data-color="green"] {
    --enterprise-action-color: #34d399;
}

.enterprise-action-bar__item[data-color="amber"] {
    --enterprise-action-color: #fbbf24;
}

.enterprise-action-bar__item[data-color="orange"] {
    --enterprise-action-color: #fb923c;
}

.enterprise-action-bar__item[data-color="red"] {
    --enterprise-action-color: #fb7185;
}

.enterprise-action-bar__item[data-color="pink"] {
    --enterprise-action-color: #f472b6;
}

.enterprise-action-bar--compact .enterprise-action-bar__item {
    padding-inline: 6px;
}

.enterprise-action-bar--compact .enterprise-action-bar__label {
    position: absolute;

    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;

    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;

    border: 0;
}

@media (max-width: 820px) {
    .enterprise-action-bar {
        justify-content: flex-start;
        width: 100%;
    }

    .enterprise-action-bar__label {
        position: absolute;

        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;

        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;

        border: 0;
    }

    .enterprise-action-bar__item {
        padding-inline: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .enterprise-action-bar__item {
        transition: none;
    }
}


/*
 * TOOLBAR-CONTACTS-001E-STANDARD-VISUAL-POSITION
 *
 * MASTER SUITE Enterprise — Action Bar visual contract.
 *
 * Questa definizione vive nel CSS canonico Action Bar
 * ed è riutilizzabile dai workspace Enterprise.
 */

.ms-enterprise-actionbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;

    width: 100%;
    min-width: 0;

    margin: 12px 0 14px;
    padding: 8px;

    box-sizing: border-box;

    border:
        1px solid
        rgba(74, 112, 148, .48);

    border-radius: 12px;

    background:
        linear-gradient(
            180deg,
            rgba(18, 42, 64, .88),
            rgba(10, 30, 48, .88)
        );

    box-shadow:
        inset 0 1px 0
        rgba(255,255,255,.025);
}


.ms-enterprise-actionbar__button {
    appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 36px;

    padding: 6px 11px;

    box-sizing: border-box;

    border:
        1px solid
        rgba(68, 104, 137, .56);

    border-radius: 9px;

    background:
        rgba(11, 31, 49, .86);

    color:
        var(
            --ms-text-primary,
            #f3f7fb
        );

    font: inherit;
    font-size: 12px;
    font-weight: 650;

    line-height: 1;

    cursor: pointer;

    transition:
        border-color .15s ease,
        background .15s ease,
        transform .15s ease;
}


.ms-enterprise-actionbar__button:hover:not(:disabled) {
    border-color:
        rgba(90, 167, 218, .72);

    background:
        rgba(19, 48, 72, .96);

    transform:
        translateY(-1px);
}


.ms-enterprise-actionbar__button:focus-visible {
    outline:
        2px solid
        rgba(72, 188, 235, .76);

    outline-offset:
        2px;
}


.ms-enterprise-actionbar__button:disabled {
    opacity: .42;
    cursor: not-allowed;
    transform: none;
}


.ms-enterprise-actionbar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;

    flex: 0 0 24px;

    border-radius: 7px;

    font-size: 17px;
    font-weight: 800;
    line-height: 1;

    background:
        rgba(255,255,255,.045);

    box-shadow:
        inset 0 1px 0
        rgba(255,255,255,.06);
}


/* CREATE — verde */
.ms-enterprise-actionbar__icon.is-create {
    color: #39ddb1;
    background: rgba(31, 185, 142, .14);
}


/* EDIT — blu */
.ms-enterprise-actionbar__icon.is-edit {
    color: #5baeff;
    background: rgba(59, 130, 246, .14);
}


/* DELETE — rosso */
.ms-enterprise-actionbar__icon.is-delete {
    color: #f07189;
    background: rgba(225, 69, 96, .13);
}


/* REFRESH — cyan */
.ms-enterprise-actionbar__icon.is-refresh {
    color: #42d5f4;
    background: rgba(34, 193, 224, .13);
}


/* COLUMNS — blu */
.ms-enterprise-actionbar__icon.is-columns {
    color: #62a9ff;
    background: rgba(56, 128, 237, .14);
}


/* FIT — violetto */
.ms-enterprise-actionbar__icon.is-fit {
    color: #a888ff;
    background: rgba(132, 91, 235, .14);
}


/* RESET — ambra */
.ms-enterprise-actionbar__icon.is-reset {
    color: #f5bd48;
    background: rgba(224, 162, 42, .14);
}


@media (max-width: 820px) {
    .ms-enterprise-actionbar {
        gap: 6px;
    }

    .ms-enterprise-actionbar__button {
        padding:
            6px 9px;
    }
}
