/*
 * Employee list rows: MudBlazor list item icon defaults (see Mud _list.scss) are
 *   .mud-list-item-icon { min-width: 56px; flex-shrink: 0; }
 * In a narrow column both prevent the label from getting space / ellipsis.
 * Global sheet so rules always win over MudBlazor.min.css (loaded before this file).
 */
.employee-sidebar .mud-list-item {
    min-width: 0;
}

.employee-sidebar .mud-list-item-icon {
    min-width: 0 !important;
    flex-shrink: 1 !important;
}

.employee-sidebar .mud-list-item-text {
    min-width: 0;
    overflow: hidden;
}

/*
 * Shared EmployeeSidebar component (Employees + Vacation pages). Styles live here — not in a
 * scoped .razor.css — because the component's root is a MudPaper (child component), so CSS
 * isolation attributes never land on the elements these rules target.
 */
.employee-sidebar {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
}

.employee-sidebar-paper {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.employee-sidebar-top {
    flex-shrink: 0;
    margin-bottom: 0.25rem;
}

.employee-sidebar-search {
    flex-shrink: 0;
}

.employee-sidebar-search .employee-sidebar-role-toggle {
    padding: 2px;
}

.employee-sidebar-search .employee-sidebar-role-toggle-on.mud-toggle-icon-button .mud-icon-button {
    color: var(--mud-palette-primary) !important;
    background-color: var(--mud-palette-primary-hover, rgba(var(--mud-palette-primary-rgb), 0.12)) !important;
    border-radius: var(--mud-default-borderradius, 4px);
}

.employee-sidebar-search .employee-sidebar-role-toggle-on.mud-toggle-icon-button[aria-pressed="true"] .mud-icon-button {
    color: var(--mud-palette-primary) !important;
}

/* Header row above the employee list: label + count + select-all / deselect-all icon buttons. */
.employee-sidebar-header {
    flex-shrink: 0;
    padding: 0.125rem 0;
    margin-top: 0.25rem;
    border-bottom: 1px solid var(--mud-palette-table-lines, rgba(0, 0, 0, 0.08));
}

.employee-sidebar-header .mud-icon-button {
    padding: 2px; /* tighten so the two buttons don't add a full row of height */
}

.employee-sidebar-list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 0.125rem;
    padding-right: 2px;
}

.employee-sidebar-list .mud-list-item {
    padding-top: 2px;
    padding-bottom: 2px;
    min-height: 2rem;
}

.employee-sidebar-list .mud-list-item .mud-icon-root {
    font-size: 1.125rem;
}

/* Single-select lists have no checkbox, so the role icon would sit flush against the name. */
.employee-sidebar-list-single .mud-list-item-icon {
    margin-right: 0.5rem;
}

.employee-sidebar-name {
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Planning main area: keep tab bar fixed and scroll tab content. Use global CSS because
   MudTabs internal DOM is rendered by child components (CSS isolation won't reliably hit it). */
.planning-main-col {
    min-height: 0;
}

.planning-main-tabs {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.planning-main-tabs .mud-tabs {
    height: 100%;
    min-height: 0;
}

.planning-main-tabs .mud-tabs-toolbar {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    z-index: 3;
    background: var(--mud-palette-surface);
    isolation: isolate;
    border-bottom: 1px solid rgba(0, 0, 0, 0.14);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.28) !important;
}

.planning-main-tabs .mud-tabs-toolbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 6px;
    pointer-events: none;
    box-shadow: inset 0 -6px 6px -6px rgba(0, 0, 0, 0.35);
}

.planning-main-tabs .mud-tabs-panels {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-top: 8px;
    padding-right: 2px;
}

.planning-vestigingen-table {
    height: 100%;
}

.planning-vestigingen-table .mud-table-container {
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
}

/* Month-view day cells with at least one unfilled demand (Heron AdditionalDateTimeClassesFunc).
   Global sheet because the class lands deep inside the MudCalendar DOM (CSS isolation won't hit it). */
.planning-belgian-holiday {
    background-color: #c5dff8;
}

.planning-cal-day {
    font-weight: 600;
}

.planning-cal-holiday-name {
    font-size: 0.65em;
    font-weight: 600;
    color: #1565c0;
    line-height: 1.1;
    padding: 0 2px;
    word-break: break-word;
}

/* Days spilling in from the previous/next month (cell.Outside) get a subtle recessed tint so a
   month that doesn't start on Monday / end on Sunday reads clearly as "these aren't this month".
   The marker class sits on the cell title; tint the whole cell via :has(). Scoped to
   PlanningMonthView's own class so it doesn't touch FullColorMonthView (which reuses the library's
   outside class on every cell). */
.mud-cal-month-cell:has(.planning-cal-day-outside) {
    background-color: color-mix(in srgb, var(--mud-palette-surface) 93%, var(--mud-palette-text-primary));
}

.planning-day-has-missing {
    background-color: rgba(211, 47, 47, 0.07);
    box-shadow: inset 3px 0 0 0 #d32f2f;
}

/* Make the day number itself pop: bold red pill. The class may land on the cell or its title,
   so target both the element-as-title and a descendant title/link. */
.planning-day-has-missing .mud-cal-month-cell-link,
.planning-day-has-missing.mud-cal-month-cell-title .mud-cal-month-cell-link,
.planning-day-has-missing .mud-cal-month-cell-title {
    color: #d32f2f !important;
    font-weight: 700;
}

/* Days whose only shortfall is against the streefbezetting: same shape, amber and deliberately
   quieter than the red variant (lighter tint, 600 instead of 700) so a real shortage still wins. */
.planning-day-has-target-gap {
    background-color: rgba(245, 158, 11, 0.06);
    box-shadow: inset 3px 0 0 0 #f59e0b;
}

.planning-day-has-target-gap .mud-cal-month-cell-link,
.planning-day-has-target-gap.mud-cal-month-cell-title .mud-cal-month-cell-link,
.planning-day-has-target-gap .mud-cal-month-cell-title {
    color: #b45309 !important;
    font-weight: 600;
}

/*
 * Planning calendar chips (PlannedItemTemplate). These render once per event — a dense month
 * grid can produce 1000+ chips, and this component renders over the Blazor Server circuit, so
 * every byte of per-chip inline style is multiplied across the whole grid and shipped in the
 * SignalR frame. The STATIC portions of the chip styles live here as classes; only the
 * per-chip DYNAMIC bits (background/border/color/cursor + highlight borders) stay inline.
 * Global sheet so rules win over MudBlazor.min.css without per-element scoped-css attributes.
 */
.planned-chip-outer {
    width: 100%;
    height: 100%;
    min-width: 0;
    align-self: stretch;
    display: block;
    box-sizing: border-box;
    padding: 4px;
    position: relative;
}

.planned-chip-inner {
    font-size: 0.75rem;
    padding: 1px 4px;
    border: 1px solid rgba(0, 0, 0, 0.22);
    border-radius: 5px;
    width: 100%;
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

/* Two stacked text lines inside a chip (was MudStack Spacing=0 + MudText Typo.caption). */
.planned-chip-lines {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Matches MudText Typo.caption metrics so the flattened chip renders identically. */
.planned-chip-line {
    line-height: 1.66;
    letter-spacing: 0.03333em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planned-chip-line-dim {
    opacity: 0.95;
}

/* Role annotation suffix (e.g. rol-marker) after the employee name. */
.planned-chip-annotation {
    margin-left: 0.35rem;
    opacity: 0.72;
    font-size: 0.9em;
    letter-spacing: 0.04em;
}

/* Car/bike toggle icon pinned to the chip's top-right corner. */
.planned-chip-transport {
    position: absolute;
    top: 4px;
    right: 5px;
    z-index: 2;
    line-height: 1;
}

.planned-chip-transport .mud-icon-root {
    width: 14px;
    height: 14px;
}

/*
 * Narrower planning sidebar. MudGrid's 12-column steps are too coarse here (sm=3 -> 25% is too
 * wide on large screens, sm=2 -> 16.7% too narrow for the name list), so we pin the sidebar
 * column to a fixed width and let the main column absorb the remainder. Only applies at md+;
 * below that the sidebar is hidden (MudHidden SmAndDown) and the main column is full-width.
 */
@media (min-width: 960px) {
    .planning-sidebar-col {
        flex: 0 0 300px !important;
        max-width: 300px !important;
    }

    .planning-main-col {
        flex: 1 1 0 !important;
        max-width: calc(100% - 300px) !important;
    }

    /* Vacation + Employees pages: same fixed sidebar width as Planning. */
    .vacation-sidebar-col,
    .employees-sidebar-col {
        flex: 0 0 300px !important;
        max-width: 300px !important;
    }

    .vacation-main-col,
    .employees-main-col {
        flex: 1 1 0 !important;
        max-width: calc(100% - 300px) !important;
    }
}

/* Below md the sidebar is hidden entirely (mobile uses the toolbar employee-filter menu instead).
   CSS replaces the former MudHidden wrapper — see the comment at the sidebar markup in
   Planning.razor for why (MudHidden delays first paint behind a viewport interop roundtrip). */
@media (max-width: 959.98px) {
    .planning-sidebar-col {
        display: none !important;
    }
}

/*
 * Collapsible panes. The sidebar (left, 300px) and the calendar legend (right, lg=3/xl=2)
 * both take width the calendar chips need on small screens. The collapsed state is a class on
 * the containing MudGrid (see Planning.razor); rules live in this global sheet because they
 * retarget MudItem columns (child-component DOM) and must override the fixed widths above.
 */
@media (min-width: 960px) {
    .planning-sidebar-collapsed .planning-sidebar-col {
        flex: 0 0 64px !important;
        max-width: 64px !important;
    }

    .planning-sidebar-collapsed .planning-main-col {
        max-width: calc(100% - 64px) !important;
    }
}

.planning-sidebar-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 2px;
}

@media (min-width: 1280px) {
    .planning-legend-collapsed .planning-calendar-legend-col {
        flex: 0 0 104px !important;
        max-width: 104px !important;
    }

    .planning-legend-collapsed .planning-calendar-col {
        flex: 1 1 0 !important;
        max-width: calc(100% - 104px) !important;
    }
}

/* Month-grid skeleton shown in the Kalender tab during the initial planning load. */
.planning-calendar-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(90px, 1fr);
    gap: 6px;
    height: calc(100% - 46px);
}
