/* ================================================================================================
   DataPhyx grid & entity-header restyle (app-wide).

   Loaded AFTER the Syncfusion bootstrap4 theme in _Host.cshtml so these rules win without needing
   heavy !important stacking. Grid rules are scoped to .dpx-grid-shell .e-grid: SfDynamicGrid wraps
   every grid in a plain <div class="dpx-grid-shell"> because Syncfusion's SfGrid CssClass parameter
   is not reliably rendered onto the .e-grid root in this build, whereas a plain wrapper div always
   is. The wrapper uses display:contents so it adds no box of its own and never affects layout.
   Entity page-header helpers (.entity-page-*) are additive and used by EntityMainLayout.
   ================================================================================================ */

:root {
    --dpx-accent: #2563eb;
    --dpx-accent-dark: #1d4ed8;
    --dpx-border: #e2e8f0;
    --dpx-text: #1e293b;
    --dpx-muted: #64748b;
    --dpx-header-grad-top: #ffffff;
    --dpx-header-grad-bottom: #f8fafc;
}

/* Transparent wrapper SfDynamicGrid puts around every grid. display:contents means it produces no
   box of its own, so it is purely a styling hook and never changes the grid's layout/sizing. */
.dpx-grid-shell {
    display: contents;
}

/* ---------------------------------------------------------------------------------- Grid shell */
.dpx-grid-shell .e-grid {
    border: 1px solid var(--dpx-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    font-family: inherit;
}

/* ------------------------------------------------------------------------------------- Toolbar */
.dpx-grid-shell .e-grid .e-toolbar {
    border: none;
    border-bottom: 1px solid var(--dpx-border);
    padding: 4px 6px;
    background: #fff;
}

    .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item .e-tbar-btn {
        border-radius: 8px;
        font-weight: 600;
        color: #334155;
        transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }

    .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item .e-tbar-btn:hover {
        background: #f1f5f9;
    }

    /* Emphasize the primary Add action. */
    .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item#Grid_add .e-tbar-btn,
    .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item[title="Add"] .e-tbar-btn {
        background: var(--dpx-accent);
        color: #fff;
    }

        .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item#Grid_add .e-tbar-btn:hover,
        .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item[title="Add"] .e-tbar-btn:hover {
            background: var(--dpx-accent-dark);
        }

        .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item#Grid_add .e-tbar-btn .e-icons,
        .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item[title="Add"] .e-tbar-btn .e-icons,
        .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item#Grid_add .e-tbar-btn .e-tbar-btn-text,
        .dpx-grid-shell .e-grid .e-toolbar .e-toolbar-item[title="Add"] .e-tbar-btn .e-tbar-btn-text {
            color: #fff;
        }

    /* Rounded search box with a focus ring. */
    .dpx-grid-shell .e-grid .e-toolbar .e-input-group.e-search {
        border-radius: 8px;
        background: #f8fafc;
        border: 1px solid var(--dpx-border);
        padding: 2px 8px;
    }

        .dpx-grid-shell .e-grid .e-toolbar .e-input-group.e-search.e-input-focus {
            border-color: var(--dpx-accent);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
            background: #fff;
        }

/* ---------------------------------------------------------------------------- Column header row
   Sticky positioning itself is handled by EnableStickyHeader; here we just make it read clearly. */
.dpx-grid-shell .e-grid .e-gridheader {
    border-top: none;
    border-bottom: 2px solid var(--dpx-border);
}

    .dpx-grid-shell .e-grid .e-gridheader .e-headercell,
    .dpx-grid-shell .e-grid .e-gridheader .e-detailheadercell,
    .dpx-grid-shell .e-grid .e-gridheader .e-grouptopleftcell {
        background: linear-gradient(180deg, var(--dpx-header-grad-top), var(--dpx-header-grad-bottom));
        border-color: #eef2f7;
    }

    .dpx-grid-shell .e-grid .e-gridheader .e-headercelldiv,
    .dpx-grid-shell .e-grid .e-gridheader .e-headertext {
        color: #334155;
        font-weight: 700;
        font-size: 12.5px;
        letter-spacing: 0.2px;
    }

    /* Sorted column: accent the header text + sort arrow. */
    .dpx-grid-shell .e-grid .e-gridheader .e-headercell.e-focused,
    .dpx-grid-shell .e-grid .e-gridheader .e-sortfilter .e-headertext {
        color: var(--dpx-accent-dark);
    }

    .dpx-grid-shell .e-grid .e-gridheader .e-sortnumber {
        background: var(--dpx-accent);
        color: #fff;
    }

    .dpx-grid-shell .e-grid .e-gridheader .e-icon-ascending::before,
    .dpx-grid-shell .e-grid .e-gridheader .e-icon-descending::before {
        color: var(--dpx-accent);
    }

/* ---------------------------------------------------------------------------------------- Rows */
.dpx-grid-shell .e-grid .e-row .e-rowcell {
    border-color: #f1f5f9;
    color: var(--dpx-text);
    padding-top: 9px;
    padding-bottom: 9px;
}

.dpx-grid-shell .e-grid .e-row:nth-child(even) .e-rowcell {
    background: #fbfdff;
}

.dpx-grid-shell .e-grid .e-row:hover .e-rowcell {
    background: #eff6ff !important;
}

/* Left accent bar on the hovered/selected row. */
.dpx-grid-shell .e-grid .e-row:hover .e-rowcell:first-child {
    box-shadow: inset 3px 0 0 var(--dpx-accent);
}

.dpx-grid-shell .e-grid .e-row .e-selectionbackground {
    background: #dbeafe !important;
}

/* ------------------------------------------------------------------------- Details chip button */
.dpx-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dpx-accent-dark);
    background: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

    .dpx-details-btn:hover {
        background: #dbeafe;
        border-color: #bfdbfe;
    }

    .dpx-details-btn:hover .dpx-details-arrow {
        transform: translateX(2px);
    }

.dpx-details-arrow {
    transition: transform 0.15s ease;
}

/* -------------------------------------------------------------------------------- Empty state */
.dpx-grid-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 48px 24px;
    margin: 8px;
    background: #f8fafc;
    border: 1px dashed var(--dpx-border);
    border-radius: 12px;
    color: var(--dpx-muted);
}

.dpx-grid-empty-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #eff6ff;
    color: var(--dpx-accent);
    margin-bottom: 6px;
}

    .dpx-grid-empty-icon .e-icons {
        font-size: 26px;
    }

.dpx-grid-empty-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
}

.dpx-grid-empty-text {
    margin: 0;
    max-width: 460px;
    font-size: 0.9rem;
}
