/*
 * Brand color override for the staff portal (issue #22). Loaded after
 * bootstrap.min.css/style.min.css in base.html.twig and auth-base.html.twig.
 *
 * #dd1b26 is defined ONCE below; every tint/shade is derived from it via
 * native CSS color-mix() rather than a precomputed/hardcoded palette, since
 * the staff assets have no Sass build step (Symfony AssetMapper serves
 * these files directly) — requires Chrome 111+/Firefox 113+/Safari 16.2+.
 *
 * The vendor CSS bakes #2f55d4 (Bootstrap's stock blue) as literal hex into
 * most rules rather than purely through var(--bs-primary) — Bootstrap's
 * Sass shade/tint computation happens at compile time, and several utility
 * classes carry a second, later, hardcoded-hex declaration that wins over
 * the CSS-variable-based one by source order. A :root variable override
 * alone is therefore NOT sufficient; the selectors below are overridden
 * explicitly. Scoped to what's actually visible in the staff portal's own
 * pages (buttons, active nav, badges, form focus rings, borders) — not
 * every one of the ~67 occurrences across Landrick's unused marketing
 * components (blog/pricing/team/timeline/tns-nav/work-container/etc).
 */

:root {
    --bs-primary: #dd1b26;
    --bs-primary-rgb: 221, 27, 38;
    --bs-primary-text-emphasis: color-mix(in srgb, var(--bs-primary) 60%, black);
    --bs-primary-bg-subtle: color-mix(in srgb, var(--bs-primary) 15%, white);
    --bs-primary-border-subtle: color-mix(in srgb, var(--bs-primary) 40%, white);
}

/* Buttons — hover/active mix ratios approximate Bootstrap 5.3's own
   shade amounts for a mid-tone color, matching how the vendor CSS's own
   .btn-danger (#dc3545, nearly identical hue/lightness to #dd1b26) already
   darkens on hover/active. */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: color-mix(in srgb, var(--bs-primary) 85%, black);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--bs-primary) 80%, black);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: color-mix(in srgb, var(--bs-primary) 80%, black);
    --bs-btn-active-border-color: color-mix(in srgb, var(--bs-primary) 75%, black);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
    --bs-btn-disabled-color: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
}

/* Utility classes: the vendor CSS's second, hardcoded-hex declaration for
   each of these wins by source order — override that exact declaration. */
.bg-primary {
    background-color: var(--bs-primary) !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

.border-primary {
    border-color: var(--bs-primary) !important;
}

/* Form focus rings / checked state */
.form-control:focus {
    border-color: color-mix(in srgb, var(--bs-primary) 50%, white);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

.form-check-input:focus {
    border-color: color-mix(in srgb, var(--bs-primary) 50%, white);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Applications queue (#257): keep the review table scannable while allowing
   the secondary identity/activity details to stay contained on small screens. */
.applications-table {
    --applications-column-gap: 1rem;
}

.applications-table th,
.applications-table td {
    vertical-align: middle;
}

.applications-table .application-primary-row > td:first-child {
    min-width: 17rem;
}

.applications-expand-button {
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--bs-secondary-color);
    line-height: 2rem;
    text-decoration: none;
}

.applications-expand-button:hover,
.applications-expand-button:focus-visible {
    color: var(--bs-primary);
    text-decoration: none;
}

.applications-expand-button[aria-expanded="true"] .mdi {
    display: inline-block;
    transform: rotate(180deg);
}

.applications-assignment-badge {
    font-weight: 500;
    white-space: nowrap;
}

.applications-assignment-badge--assigned {
    background-color: color-mix(in srgb, var(--bs-success) 14%, white);
    color: color-mix(in srgb, var(--bs-success) 70%, black);
}

.applications-assignment-badge--unassigned {
    background-color: color-mix(in srgb, var(--bs-warning) 25%, white);
    color: color-mix(in srgb, var(--bs-warning) 70%, black);
}

.application-details-row > td {
    padding: 0;
    border-top: 0;
}

.application-details-content {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 2rem;
    margin: 0 .75rem .75rem 3.75rem;
    padding: .75rem 1rem;
    overflow-wrap: anywhere;
    background: color-mix(in srgb, var(--bs-light) 75%, white);
    border-left: .2rem solid color-mix(in srgb, var(--bs-primary) 45%, white);
    font-size: .875rem;
}

@media (max-width: 767.98px) {
    .applications-table {
        min-width: 46rem;
    }

    .applications-table .application-primary-row > td:first-child {
        min-width: 15rem;
    }

    .application-details-content {
        margin-left: .75rem;
    }

    .applications-filter-actions .btn {
        flex: 1 1 0;
    }
}

/* Applications filter toolbar (#262): give the "Unassigned only" switch and
   the Apply/Clear action buttons the same control height as the row's
   inputs/selects, whether or not they sit under a visible label. */
.applications-filter-toggle,
.applications-filter-actions {
    display: flex;
    align-items: center;
    min-height: calc(1.5em + .75rem + 2px);
    gap: .5rem;
}

@media (min-width: 768px) {
    .applications-filter-actions {
        justify-content: flex-end;
    }
}

/* Sidebar: base.html.twig's #sidebar uses the sidebar-dark theme variant,
   whose own CSS already renders active/hover nav items, the dropdown
   chevron, and brand-hover state as white (`color:#fff!important` /
   `color:#fff`), never the stock Bootstrap blue — nothing to override here.
   (The non-dark .sidebar-wrapper variant's blue rules don't apply since
   this project never uses that variant.) */
