/* Planning annuel des absences. */

/* Planning annuel des absences ------------------------------------------ */

.absence-calendar-panel {
    --calendar-row-height: 23px;
    padding: 0;
    overflow: hidden;
}

.absence-calendar-page .page {
    /* Pleine largeur commune à toutes les pages depuis le 17/10/2026 ; seule
       la gouttière réduite du calendrier (arbitrage du 15/10/2026) reste propre. */
    padding-inline: var(--rh-space-3);
}

.employee-contract-filter {
    display: grid;
    gap: var(--rh-space-2);
    margin-bottom: var(--rh-space-4);
}

.employee-contract-filter .button { justify-self: start; }
.employee-contract-filter .section-hint { max-width: 46rem; margin: 0; }

.absence-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: var(--rh-space-4);
    padding: var(--rh-space-4);
    border-bottom: 1px solid var(--rh-line);
}

.absence-period-nav,
.absence-filters,
.absence-legend {
    display: flex;
    align-items: center;
    gap: var(--rh-space-2);
}

.absence-period-nav > div {
    display: grid;
    min-width: 13rem;
    text-align: center;
}

.absence-period-nav strong {
    color: var(--rh-ink);
    font-size: 0.9rem;
}

.absence-filters {
    align-items: end;
    flex-wrap: wrap;
}

.absence-filters .field {
    gap: var(--rh-space-1);
    min-width: 13rem;
}

.absence-filters select {
    min-height: 34px;
    padding-top: var(--rh-space-1);
    padding-bottom: var(--rh-space-1);
}

.absence-legend {
    padding: var(--rh-space-2) var(--rh-space-4);
    overflow-x: auto;
    border-bottom: 1px solid var(--rh-line);
    color: var(--rh-ink-soft);
    font-size: 0.76rem;
    white-space: nowrap;
}

/* Cette légende réutilise l’habillage des calendriers de congés, mais doit
   rester une bande horizontale même si leave-management.css est chargé après. */
.absence-legend.leave-calendar-help {
    display: flex;
    flex-wrap: nowrap;
}

.absence-legend.leave-calendar-help > span {
    display: inline-flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
}

.absence-legend small { color: var(--rh-muted); }

.absence-swatch,
.calendar-key {
    display: inline-block;
    width: 18px;
    height: 10px;
    border: 1px solid var(--rh-line-strong);
    border-radius: 3px;
}

/* Teintes pleines des absences, communes au tableau des souhaits (arbitrage
   MOA A3 du 17/10/2026) : la case entière porte la couleur et le code. */
.absence-paid,
.absence-medical,
.absence-training,
.absence-recovery,
.absence-other,
.absence-alternance-school { color: var(--rh-absence-ink); }
.absence-paid { background: var(--rh-absence-paid); border-color: var(--rh-absence-paid); }
.absence-medical { background: var(--rh-absence-medical); border-color: var(--rh-absence-medical); }
.absence-training { background: var(--rh-absence-training); border-color: var(--rh-absence-training); }
.absence-recovery { background: var(--rh-absence-recovery); border-color: var(--rh-absence-recovery); }
.absence-other { background: var(--rh-absence-other); border-color: var(--rh-absence-other); }
.absence-alternance-school {
    border-color: var(--rh-absence-school);
    background: var(--rh-absence-school) repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--rh-absence-ink) 14%, transparent) 5px 7px);
}
.absence-alternance-company { background: var(--rh-absence-company); border-color: var(--rh-absence-company); color: var(--rh-absence-company-ink); }
.calendar-key-weekend { background: color-mix(in srgb, var(--rh-line) 62%, var(--rh-surface)); }
.calendar-key-holiday { background: color-mix(in srgb, var(--rh-leave-unknown) 24%, var(--rh-surface)); }
.calendar-key-today { border: 2px solid var(--rh-primary); background: var(--rh-primary-soft); }

.annual-calendar-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
}

/* Grille alignée sur le tableau des souhaits de congés (jugé le plus lisible
   par la MOA le 17/10/2026) : cases de 1,7 rem sur 23 px, colonne salarié de
   10,5 rem, en-têtes compacts, début de mois souligné, samedi et dimanche
   distingués, ligne de totaux. */
.annual-calendar {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.72rem;
}

.annual-calendar th,
.annual-calendar td {
    box-sizing: border-box;
    border-right: 1px solid color-mix(in srgb, var(--rh-line) 65%, transparent);
    border-bottom: 1px solid var(--rh-line);
}

.annual-calendar thead th {
    position: sticky;
    z-index: 4;
    padding: 0;
    background: var(--rh-surface);
    color: var(--rh-ink-soft);
    font-weight: 750;
    text-align: center;
}

.calendar-days th {
    top: 0;
    width: 1.7rem;
    min-width: 1.7rem;
    height: 32px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.calendar-days .calendar-weekday {
    display: block;
    line-height: 1.1;
}

.calendar-days .calendar-weekday {
    color: var(--rh-muted);
    font-size: 0.62rem;
    font-weight: 600;
}

/* Le défilement vers un mois laisse la place de la colonne salarié collante. */
.calendar-days th[id^="month-"] { scroll-margin-left: 10.5rem; }

.annual-calendar .calendar-employee-head {
    left: 0;
    z-index: 7;
    width: 10.5rem;
    min-width: 10.5rem;
    padding-left: var(--rh-space-4);
    text-align: left;
}

.annual-calendar .calendar-employee {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 10.5rem;
    min-width: 10.5rem;
    max-width: 10.5rem;
    height: var(--calendar-row-height);
    overflow: hidden;
    padding: 0 var(--rh-space-2);
    background: var(--rh-surface);
    color: var(--rh-ink);
    font-size: 0.7rem;
    font-weight: 500;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-employee-select {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.calendar-cell {
    position: relative;
    width: 1.7rem;
    min-width: 1.7rem;
    height: var(--calendar-row-height);
    padding: 0;
    background: var(--rh-surface);
}

.annual-calendar .is-saturday { background: color-mix(in srgb, var(--rh-line) 38%, var(--rh-surface)); }
.annual-calendar .is-sunday {
    background-color: color-mix(in srgb, var(--rh-line) 62%, var(--rh-surface));
    background-image: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--rh-muted) 8%, transparent) 4px 6px);
}
.annual-calendar .is-holiday { background-color: color-mix(in srgb, var(--rh-leave-unknown) 24%, var(--rh-surface)); }
.annual-calendar .is-month-start { border-left: 3px solid var(--rh-primary); }
.annual-calendar .is-today { box-shadow: inset 2px 0 var(--rh-primary), inset -2px 0 var(--rh-primary); }
.annual-calendar tbody tr:hover > *,
.annual-calendar tbody tr:focus-within > *,
.annual-calendar tbody tr.is-row-selected > * {
    border-top: 2px solid var(--rh-ink);
    border-bottom: 2px solid var(--rh-ink);
}

.absence-filter-confirmation,
.leave-view-context {
    margin: var(--rh-space-2) 0;
    color: var(--rh-ink-soft);
    font-size: .82rem;
}

.annual-calendar tbody tr.is-filtered-result > * {
    background-color: color-mix(in srgb, var(--rh-primary-soft) 48%, var(--rh-surface));
}
.annual-calendar tbody tr:hover > :first-child,
.annual-calendar tbody tr:focus-within > :first-child,
.annual-calendar tbody tr.is-row-selected > :first-child { border-left: 2px solid var(--rh-ink); }
.annual-calendar tbody tr:hover > :last-child,
.annual-calendar tbody tr:focus-within > :last-child,
.annual-calendar tbody tr.is-row-selected > :last-child { border-right: 2px solid var(--rh-ink); }

.calendar-add-absence {
    display: grid;
    width: 100%;
    height: var(--calendar-row-height);
    color: transparent;
    font-size: 0.8rem;
    font-weight: 800;
    place-items: center;
    text-decoration: none;
}

.calendar-cell:hover .calendar-add-absence,
.calendar-add-absence:focus-visible {
    background: var(--rh-primary-soft);
    color: var(--rh-primary);
    outline: none;
}

/* L'absence remplit la case : couleur pleine et code lisible. */
.absence-block {
    display: grid;
    width: 100%;
    height: calc(var(--calendar-row-height) - 1px);
    border: 0;
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 850;
    line-height: 1;
    place-items: center;
    text-decoration: none;
}

.absence-block-list {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.absence-company-marker {
    position: absolute;
    right: 1px;
    bottom: 1px;
    z-index: 3;
    display: grid;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: var(--rh-absence-company);
    color: var(--rh-absence-company-ink);
    font-size: .46rem;
    font-weight: 900;
    line-height: 1;
    place-items: center;
    text-decoration: none;
}

.absence-block:hover,
.absence-block:focus-visible {
    position: relative;
    z-index: 2;
    filter: saturate(1.25);
    outline: 2px solid var(--rh-ink);
    outline-offset: -2px;
}

.absence-block sup {
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 0.48rem;
}

/* Totaux du jour : nombre de salariés absents, comme sous le tableau des souhaits. */
.annual-calendar tfoot th,
.annual-calendar tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 4;
    height: var(--calendar-row-height);
    background: var(--rh-surface-muted);
    color: var(--rh-ink-soft);
    font-size: 0.7rem;
    text-align: center;
}

.annual-calendar tfoot th { left: 0; z-index: 7; padding: 0 var(--rh-space-2); text-align: left; }
