/* =========================================================
   BUSINESSMANAGER CRUD ACTION BUTTON STANDARD
   ---------------------------------------------------------
   Centralized Create/Edit/Details/Delete action treatment.

   Visual baseline:
   Customers/Details service-location action buttons.
   ========================================================= */

:root {
    --bm-crud-action-height: 42px;
    --bm-crud-action-radius: 12px;
    --bm-crud-action-padding-x: 1rem;
    --bm-crud-action-shadow: 0 3px 10px rgba(15, 23, 42, .06);
    --bm-crud-action-hover-shadow: 0 7px 16px rgba(15, 23, 42, .11);
    --bm-crud-action-focus: 0 0 0 3px rgba(37, 99, 235, .16);
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn:not(.ops-action-btn) {
    min-height: var(--bm-crud-action-height);
    border-radius: var(--bm-crud-action-radius);
    font-weight: 700;
    transition:
        transform .16s ease,
        box-shadow .16s ease,
        background-color .16s ease,
        border-color .16s ease,
        color .16s ease;
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn:not(.btn-sm):not(.ops-action-btn) {
    padding-inline: var(--bm-crud-action-padding-x);
}

/* Explicit icon-only CRUD action utility.
   IMPORTANT: do not infer icon-only buttons from child-count selectors.
   CSS child-count pseudo-classes ignore text nodes, which previously collapsed buttons
   such as Directions, Apply, Complete and Add Item into 42px squares. */
body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn.bm-icon-action:not(.ops-action-btn) {
    width: var(--bm-crud-action-height);
    min-width: var(--bm-crud-action-height);
    height: var(--bm-crud-action-height);
    min-height: var(--bm-crud-action-height);
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: var(--bm-crud-action-shadow);
}

/* Text actions always size to their content. */
body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn:not(.ops-action-btn):not(.bm-icon-action) {
    width: auto;
    min-width: 0;
    white-space: nowrap;
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page :is(
    .btn-outline-primary,
    .btn-outline-secondary,
    .btn-outline-success,
    .btn-outline-info,
    .btn-outline-warning,
    .btn-outline-danger
):not(.ops-action-btn) {
    background: #fff;
    box-shadow: var(--bm-crud-action-shadow);
}

/* Explicit semantic hover states prevent white-on-white disappearing text. */
@media (hover: hover) {
    body:is(
        [data-current-action="Create"],
        [data-current-action="Edit"],
        [data-current-action="Details"],
        [data-current-action="Delete"]
    ) .bm-page .btn:not(.ops-action-btn):not(:disabled):not(.disabled):hover {
        transform: translateY(-1px);
        box-shadow: var(--bm-crud-action-hover-shadow);
    }

    body:is([data-current-action="Create"],[data-current-action="Edit"],[data-current-action="Details"],[data-current-action="Delete"])
    .bm-page .btn-outline-secondary:not(.ops-action-btn):hover { color:#334155; border-color:#64748b; background:#f8fafc; }

    body:is([data-current-action="Create"],[data-current-action="Edit"],[data-current-action="Details"],[data-current-action="Delete"])
    .bm-page .btn-outline-primary:not(.ops-action-btn):hover { color:#3151d5; border-color:#3151d5; background:#eef2ff; }

    body:is([data-current-action="Create"],[data-current-action="Edit"],[data-current-action="Details"],[data-current-action="Delete"])
    .bm-page .btn-outline-success:not(.ops-action-btn):hover { color:#287442; border-color:#287442; background:#f0fdf4; }

    body:is([data-current-action="Create"],[data-current-action="Edit"],[data-current-action="Details"],[data-current-action="Delete"])
    .bm-page .btn-outline-info:not(.ops-action-btn):hover { color:#0e7490; border-color:#0e7490; background:#ecfeff; }

    body:is([data-current-action="Create"],[data-current-action="Edit"],[data-current-action="Details"],[data-current-action="Delete"])
    .bm-page .btn-outline-warning:not(.ops-action-btn):hover { color:#854d0e; border-color:#854d0e; background:#fffbeb; }

    body:is([data-current-action="Create"],[data-current-action="Edit"],[data-current-action="Details"],[data-current-action="Delete"])
    .bm-page .btn-outline-danger:not(.ops-action-btn):hover { color:#c93640; border-color:#c93640; background:#fff1f2; }
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn:not(.ops-action-btn):focus-visible {
    outline: 0;
    box-shadow: var(--bm-crud-action-focus), var(--bm-crud-action-hover-shadow) !important;
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn:not(.ops-action-btn):disabled,
body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .btn:not(.ops-action-btn).disabled {
    transform: none !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Details"],
    [data-current-action="Delete"]
) .bm-page .bm-page-actions {
    gap: .65rem;
}

body:is(
    [data-current-action="Create"],
    [data-current-action="Edit"],
    [data-current-action="Delete"]
) :is(
    .operations-sticky-actions-inner,
    .customer-sticky-actions-inner,
    .employee-sticky-actions-inner,
    .estimate-sticky-actions-inner,
    .bm-form-sticky-actions,
    .bm-sticky-actions-inner,
    .form-sticky-actions-inner
) {
    gap: .65rem;
}

@media (max-width: 575.98px) {
    :root {
        --bm-crud-action-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body:is(
        [data-current-action="Create"],
        [data-current-action="Edit"],
        [data-current-action="Details"],
        [data-current-action="Delete"]
    ) .bm-page .btn:not(.ops-action-btn) {
        transition: none;
    }
}
