/* Admin theme overrides. Loaded by MainLayout/EmptyLayout right AFTER Bootstrap (Bootstrap is injected
   via HeadContent, so anything in index.html loads before it and loses at equal specificity).
   Colors come from the tokens declared in app.css. */

:root {
    --bs-primary: #7c5cff;
    --bs-primary-rgb: 124, 92, 255;
    --bs-body-bg: var(--work-bg);
    --bs-body-color: var(--text);
}

body {
    background-color: var(--work-bg);
    color: var(--text);
}

/* ---------- Buttons ---------- */

.btn-primary {
    color: #fff;
    background: var(--accent-gradient);
    border: 0;
    box-shadow: 0 6px 16px rgba(124, 92, 255, .28);
    transition: transform .15s, box-shadow .15s, filter .15s;
}

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-primary:active {
        color: #fff;
        background: var(--accent-gradient);
        filter: brightness(1.06);
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(124, 92, 255, .38);
    }

    .btn-primary:disabled {
        opacity: .7;
        transform: none;
    }

.btn-outline-primary {
    color: var(--accent-1-dark);
    border-color: var(--accent-1);
}

    .btn-outline-primary:hover {
        color: #fff;
        background-color: var(--accent-1);
        border-color: var(--accent-1);
    }

/* ---------- Form controls ---------- */

.form-control,
.form-select {
    border-color: var(--border);
    border-radius: .6rem;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--accent-1);
        box-shadow: 0 0 0 .25rem var(--accent-ring);
    }

.form-check-input:checked {
    background-color: var(--accent-1);
    border-color: var(--accent-1);
}

/* ---------- Grids (light work area, dark header) ---------- */

table.quickgrid {
    background-color: var(--surface);
}

/* Card look on desktop only - below 768px the shared QuickGrid switches rows into stacked cards.
   Rounded corners go on the corner cells, not overflow:hidden, which would clip the absolutely
   positioned tools column. No shadow: the grid's .table-responsive wrapper (overflow:auto) would clip it. */
@media (min-width: 768px) {
    table.quickgrid {
        border-collapse: separate;
        border-spacing: 0;
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    /* The loading overlay covers the whole grid (table plus tools column), so it rounds the same outer corners
       instead of showing square white corners over the page background. */
    .quickgrid-loading-overlay {
        border-radius: var(--radius);
    }

        /* With a fixed tools column the table's end side is an inner edge (the tools cells carry the
           outer corners), so it stays square. */
        table.quickgrid:has(> thead > tr > td.first-col-fixed) {
            border-start-end-radius: 0;
            border-end-end-radius: 0;
        }

        table.quickgrid > thead > tr:first-child > th:first-child {
            border-start-start-radius: var(--radius);
        }

        /* Any last header cell, not just a th: in grids with tools that corner is the tools column's header td. */
        table.quickgrid > thead > tr:first-child > :last-child {
            border-start-end-radius: var(--radius);
        }

        table.quickgrid > tbody > tr:last-child > td:first-child {
            border-end-start-radius: var(--radius);
        }

        table.quickgrid > tbody > tr:last-child > td:last-child {
            border-end-end-radius: var(--radius);
        }

    /* Every row - header, filter and body - gets one explicit height, shared with the edit/delete tools
       column. That column is a set of absolutely positioned cells (.first-col-fixed in QuickGrid.razor.css)
       outside the table's row layout, so it only lines up when both use the same height.
       Vertical padding moves into that height, and content is centered vertically: normal cells via
       vertical-align, the tools cells (absolutely positioned, so no longer table cells) via flex. */
    table.quickgrid > thead > tr > th,
    table.quickgrid > thead > tr > td,
    table.quickgrid > tbody > tr > td {
        box-sizing: border-box;
        height: var(--grid-row-height);
        padding-top: 0;
        padding-bottom: 0;
        vertical-align: middle;
    }

    table.quickgrid td.first-col-fixed {
        display: flex;
        align-items: center;
        height: var(--grid-row-height);
    }
}

    /* Header colors also cover the tools column's header cells, so the dark header runs the full width. */
    table.quickgrid > thead > tr:first-child > th,
    table.quickgrid > thead > tr:first-child > td.first-col-fixed {
        background-color: var(--grid-head);
        color: #fff;
        font-weight: 600;
    }

    table.quickgrid > thead > tr.headerOptions > th,
    table.quickgrid > thead > tr.headerOptions > td.first-col-fixed {
        background-color: var(--grid-filter);
    }

    table.quickgrid thead input,
    table.quickgrid thead .form-control {
        opacity: 1;
        background-color: var(--surface);
        border: 1px solid var(--border);
        border-radius: .5rem;
    }

    /* Row separators: borders on <tr> don't render with border-collapse: separate, so they go on the cells. */
    table.quickgrid > tbody > tr > td {
        border-bottom: 0px solid var(--border);
    }

    table.quickgrid > tbody > tr:last-child > td {
        border-bottom: 0;
    }

    table.quickgrid > tbody > tr {
        cursor: pointer;
    }

        /* The selection background comes from the row (QuickGrid.razor.css), not the cells. */
        table.quickgrid > tbody > tr.selected-row > td {
            color: var(--accent-1-dark);
            font-weight: 500;
        }

/* ---------- Misc ---------- */

.alert-danger {
    border-radius: .7rem;
}

.dropdown-menu {
    border-color: var(--border);
    border-radius: .7rem;
    box-shadow: 0 12px 30px rgba(22, 28, 69, .12);
}

/* Phones: keep the page from scrolling behind the open slide-in menu (see MainLayout.razor.css). */
body.mobile-menu-open {
    overflow: hidden;
}

/* ---------- Bootstrap 5.3 utilities ---------- */
/* The app ships Bootstrap 5.1, which lacks these; same values as 5.3, so an upgrade makes them redundant, not different. */

.fw-semibold { font-weight: 600 !important; }

.column-gap-3 { column-gap: 1rem !important; }
.column-gap-4 { column-gap: 1.5rem !important; }
.row-gap-2 { row-gap: .5rem !important; }

.bg-danger-subtle { background-color: #f8d7da !important; }
.bg-success-subtle { background-color: #d1e7dd !important; }
.bg-warning-subtle { background-color: #fff3cd !important; }
.text-danger-emphasis { color: #58151c !important; }
.text-success-emphasis { color: #0a3622 !important; }
.text-warning-emphasis { color: #664d03 !important; }
