html {
    scroll-behavior: smooth;
}

.fr-header__operator .fr-responsive-img {
    max-width: 8rem;
}

.dgcl-logo-footer {
    max-width: 12rem;
}

.header-items {
    position: relative;
}

.header-items #user-menu > ul {
    max-width: 200px;
}

/* Utils */

.gsl-nowrap {
    white-space: nowrap;
}

ul.no-list-style {
    list-style-type: none;
    padding-inline-start: 0;
}

ul.no-list-style li {
    padding: 0;
}

.gsl-money {
    font-variant-numeric: tabular-nums;
    text-align: right !important;
}

.gsl-no-underline {
    background-image: none;
}

.stick-to-bottom {
    position: sticky;
    bottom: 1em;
}

.text-align-right {
    text-align: right;
}

/* Colors */

.color-red {
    color: var(--status-color-red);
}

.color-green {
    color: var(--status-color-green);
}

.color-blue {
    color: var(--status-color-blue);
}

.color-brown {
    color: var(--status-color-brown);
}

/* Page un projet */

.gsl-projet-container {
    border-top: 1px solid #ddd;
}

.gsl-projet-menu {
    border-right: 1px solid #ddd;
}

.gsl-projet h3 {
    display: flex;
    align-items: center;
    margin: 2em 0 1em;
}

.gsl-projet h3::before {
    content: "";
    background: #000091;
    width: 1.1em;
    height: .35em;
    margin: 0 .5em .1em 0;
}

.gsl-projet h3::after {
    content: "";
    flex-grow: 1;
    margin-left: 1em;
    height: 1px;
    background: #ddd;
}

.gsl-projet h4 {
    font-size: 1.25rem;
}

.gsl-projet h5 {
    font-size: 1.125rem;
}

.gsl-projet > section {
    padding: 3em;
}

.gsl-projet > section + section {
    border-top: 1px solid #ddd;
}

.block-avis-commission-detr {
    display: inline-flex;
    gap: 16px;
    align-items: center;
}


.gsl-projet-table thead th {
    padding: 1em .75em;
    text-align: center;
    line-height: 1.3;
}

.gsl-projet-table thead th,
.gsl-projet-table thead th .fr-badge {
    font-size: 0.75rem;
}


#table-simulation .gsl-col--cout-total,
#table-simulation .gsl-col--assiette,
#table-simulation .gsl-col--montant-sollicite,
#table-simulation .gsl-col--montant-retenu {
    width: 110px;
}

#table-simulation .gsl-col--taux {
    width: 80px;
}

#table-projets .gsl-col--statut,
#table-programmation .gsl-col--documents {
    max-width: 140px;
    width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gsl-col--180px-min {
    max-width: 200px;
    width: 200px;
    min-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gsl-col--140px-min {
    max-width: 150px;
    width: 150px;
    min-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gsl-col--105px-min {
    max-width: 120px;
    width: 120px;
    min-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.max-3-lines {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

#table-projets .fr-btn--tooltip,
#table-programmation .fr-btn--tooltip,
#table-simulation .fr-btn--tooltip {
    margin-bottom: -4px; /* to reduce the header height */
}

.gsl-projet-table {
    margin-left: calc(-50vw + 52%);
    margin-right: calc(-50vw + 52%);
}

.gsl-projet-table .gsl-projet-table__total {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
    color: var(--text-title-blue-france);
    font-weight: 500;
    line-height: calc(14rem / 16);
    display: inline-flex;
}

.gsl-projet-table .gsl-projet-table__total--total_cost {
    background-color: var(--background-alt-blue-france-hover);
}

.gsl-projet-table .gsl-projet-table__total--total_amount_asked {
    background-color: var(--artwork-background-green-tilleul-verveine);
}

.gsl-projet-table .gsl-projet-table__total--total_amount_granted {
    background-color: var(--background-contrast-success);
}


.gsl-projet-table .fr-table__content thead th:first-child {
    padding-left: 1.5em;
}

.gsl-projet-table .fr-table__content td,
.gsl-projet-table .fr-table__content td .fr-select,
.gsl-projet-table .fr-table__content td .fr-input,
.gsl-projet-table .fr-table__content td .fr-link,
.gsl-projet-table .fr-table__content td p  {
    font-size: .75rem; /* = 10px */
}

.gsl-projet-table .fr-table__content td p {
    line-height: 1.5;
}

.gsl-projet-table .fr-table__content td {
    padding: .75em;
    line-height: 1.5;
}


.gsl-projet-table table tbody td:first-child {
    padding-left: 1.5em;
}

.gsl-projet-table .fr-table__footer {
    justify-content: center;
}

/*
 * Z-index scale for sticky table columns:
 *  2  – sticky body cells (default)
 *  3  – sticky header cells (above body)
 * 10  – checkbox header dropdown open
 * 11  – DSFR frame border (above all sticky cells and dropdowns)
 * 12  – status dropdown open (must be above frame border)
 */

/* Raise the DSFR frame border above all sticky cells and dropdowns */
.gsl-projet-table[data-fr-js-table] .fr-table__wrapper::after {
    z-index: 11;
}

/* Sticky columns */
.gsl-projet-table__sticky-left-1,
.gsl-projet-table__sticky-left-2,
.gsl-projet-table__sticky-left-3,
.gsl-projet-table__sticky-right,
.gsl-projet-table__sticky-right-1,
.gsl-projet-table__sticky-right-2 {
    position: sticky;
    z-index: 2;
    background-color: var(--background-default-grey);
}

.gsl-projet-table thead .gsl-projet-table__sticky-left-1,
.gsl-projet-table thead .gsl-projet-table__sticky-left-2,
.gsl-projet-table thead .gsl-projet-table__sticky-left-3,
.gsl-projet-table thead .gsl-projet-table__sticky-right,
.gsl-projet-table thead .gsl-projet-table__sticky-right-1,
.gsl-projet-table thead .gsl-projet-table__sticky-right-2 {
    z-index: 3;
}

.gsl-projet-table__row--other-dotation .gsl-projet-table__sticky-left-1,
.gsl-projet-table__row--other-dotation .gsl-projet-table__sticky-left-2,
.gsl-projet-table__row--other-dotation .gsl-projet-table__sticky-left-3,
.gsl-projet-table__row--other-dotation .gsl-projet-table__sticky-right,
.gsl-projet-table__row--other-dotation .gsl-projet-table__sticky-right-1,
.gsl-projet-table__row--other-dotation .gsl-projet-table__sticky-right-2 {
    background-color: var(--background-default-grey-hover);
}

.gsl-projet-table__sticky-left-1 {
    left: 0;
}

/* Single sticky-right column (used by projets table) */
.gsl-projet-table__sticky-right {
    right: 0;
    box-shadow: -2px 0 4px rgb(0 0 0 / 8%);
}

.gsl-projet-table .fr-table__content td.gsl-projet-table__sticky-right {
    padding-right: 1.5em;
}

.gsl-projet-table__sticky-right:has([aria-expanded="true"]) {
    z-index: 12;
}

/* Split sticky-right columns (used by programmation and simulation tables)
 * Use custom properties so :has() rules can adjust offsets when columns hide. */
.gsl-projet-table__sticky-right-2 {
    right: 0;
    min-width: var(--sticky-right-2-width);
}

.gsl-projet-table__sticky-right-1 {
    right: var(--sticky-right-2-width);
    box-shadow: -2px 0 4px rgb(0 0 0 / 8%);
}

.gsl-projet-table .fr-table__content td.gsl-projet-table__sticky-right-2 {
    text-align: center;
}

.gsl-projet-table__sticky-right-1:has([aria-expanded="true"]) {
    z-index: 12;
}

.gsl-projet-table .fr-table__container:has([aria-expanded="true"]) {
    overflow: visible;
}

/* Custom properties for sticky offsets – adjusted by :has() rules when columns hide */
#projet-table-wrapper,
#simulation-table-wrapper {
    --sticky-left-1-width: 100px;
    --sticky-right-2-width: 120px;
}

#programmation-table-wrapper {
    --sticky-left-1-width: 60px;
    --sticky-right-2-width: 120px;
}

/* Left offsets for tables with Date as first column (projets, simulation) */
#table-projets .gsl-projet-table__sticky-left-1,
#table-simulation .gsl-projet-table__sticky-left-1 {
    min-width: var(--sticky-left-1-width);
}

#table-projets .gsl-projet-table__sticky-left-2,
#table-simulation .gsl-projet-table__sticky-left-2 {
    left: var(--sticky-left-1-width);
    min-width: 180px;
}

#table-projets .gsl-projet-table__sticky-left-3,
#table-simulation .gsl-projet-table__sticky-left-3 {
    left: calc(var(--sticky-left-1-width) + 180px);
    box-shadow: 2px 0 4px rgb(0 0 0 / 8%);
}

/* Left offsets for programmation table (checkbox as first column) */
#table-programmation .gsl-projet-table__sticky-left-1 {
    min-width: var(--sticky-left-1-width);
}

#table-programmation .gsl-projet-table__sticky-left-2 {
    left: var(--sticky-left-1-width);
    min-width: 180px;
}

#table-programmation .gsl-projet-table__sticky-left-3 {
    left: calc(var(--sticky-left-1-width) + 180px);
    box-shadow: 2px 0 4px rgb(0 0 0 / 8%);
}

/* :has() rules to adjust sticky offsets when columns are hidden */

/* When date_depot (LEFT_1) is hidden: collapse LEFT_1 width */
#projet-table-wrapper:has(#toggle-col-date-depot:not(:checked)),
#simulation-table-wrapper:has(#toggle-col-date-depot:not(:checked)) {
    --sticky-left-1-width: 0px;
}

/* When notification (RIGHT_2) is hidden: collapse RIGHT_2 width */
#projet-table-wrapper:has(#toggle-col-notification:not(:checked)),
#programmation-table-wrapper:has(#toggle-col-notification:not(:checked)),
#simulation-table-wrapper:has(#toggle-col-notification:not(:checked)) {
    --sticky-right-2-width: 0px;
}

/* Shadow transfer: when numero_dn (LEFT_3) is hidden, LEFT_2 gets the left shadow */
#projet-table-wrapper:has(#toggle-col-numero-dn:not(:checked)) .gsl-projet-table__sticky-left-2,
#programmation-table-wrapper:has(#toggle-col-numero-dn:not(:checked)) .gsl-projet-table__sticky-left-2,
#simulation-table-wrapper:has(#toggle-col-numero-dn:not(:checked)) .gsl-projet-table__sticky-left-2 {
    box-shadow: 2px 0 4px rgb(0 0 0 / 8%);
}

/* Shadow transfer: when statut (RIGHT_1) is hidden, RIGHT_2 gets the right shadow */
#projet-table-wrapper:has(#toggle-col-statut:not(:checked)) .gsl-projet-table__sticky-right-2,
#programmation-table-wrapper:has(#toggle-col-statut:not(:checked)) .gsl-projet-table__sticky-right-2,
#simulation-table-wrapper:has(#toggle-col-statut:not(:checked)) .gsl-projet-table__sticky-right-2 {
    box-shadow: -2px 0 4px rgb(0 0 0 / 8%);
}

.gsl-tooltip {
    padding-top: 0;
    padding-bottom: 4px;
    max-height: 28px;
    min-height: 24px;
}

.projet_status__accepted {
    color: var(--text-default-success)
}

.projet_status__refused {
    color: var(--text-default-error)
}

/* projet detail */
.badge-projet-status{
    min-width: max-content;
}

.badge-projet-status__accepted,
.badge-projet-status__valid {
    background-color: var(--background-contrast-success);
    color: var(--text-default-success);
}

.badge-projet-status__refused,
.badge-projet-status__cancelled {
    background-color: var(--background-contrast-error);
    color: var(--text-default-error);
}

/* .badge-projet-status__processing {
    background-color: var(--background-contrast-info);
    color: var(--text-default-info);
} */

.badge-projet-status__dismissed {
    background-color: var(--background-contrast-warning);
    color: var(--text-default-warning);
}

.badge-projet-status__provisionally_accepted {
    background-color: var(--background-contrast-info);
    color: var(--text-default-info);
}

.badge-projet-status__provisionally_refused {
    background-color: var(--background-contrast-beige-gris-galet);
    color: var(--text-action-high-orange-terre-battue);
}

/* common */
.blue-color {
    color: var(--blue-france-sun-113-625);
}

.success-color,
.green-color {
    color: var(--text-default-success);
}

.refuse-color,
.red-color {
    color: var(--text-default-error);
}

.grey-color {
    color: var(--text-default-grey);
}

.processing-color {
  color: var(--text-default-grey);
}

.dismiss-color {
    color: var(--text-default-warning);
}


/* detail projet */

.fr-tabs__list.fake {
    list-style-type: none;
}

.fake-tab-panel {
    border: 1px solid #ddd;
    padding: 2rem;
    transform: translateY(-5px);
}

.sticky-menu {
    position: sticky;
    top: 1.5rem;
}

.callout-without-left-border {
  background-image: none;
}

/* dropdown */

.gsl-dropdown > button {
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gsl-dropdown > .fr-input {
  display: flex;
}

.gsl-dropdown > button > span {
  margin-top: 1px; /* Alignement vertical de l'icône */
}


.gsl-dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--background-default-grey);
  min-width: 260px;
  box-shadow: var(--shadow-default-grey);
  padding: 10px;
  z-index: 1000;
  gap: 1rem;
  max-height: 80vh;
  overflow-y: auto;
}


.gsl-dropdown .gsl-dropdown-content {
  gap: 6px;
  min-width: auto;
}


/* New gsl-dropdown without JS ! Migrate to this then, remove gsl-dropdown-content (or rename the new to the old) */

.new-gsl-dropdown-content {
  display: grid;
  position: absolute;
  background-color: var(--background-default-grey);
  min-width: 260px;
  box-shadow: var(--shadow-default-grey);
  padding: 10px;
  z-index: 1000;
  gap: 1rem;
  max-height: 80vh;
  overflow-y: auto;
}

/* modal */

.confirmation-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1em;
}

/* ce serait peut-être mieux de garder le souligné sur ces liens: */
.secondary-link {
    --underline-thickness: 0px;
}

.secondary-link:hover {
    --underline-thickness: calc(0.0625em + 0.25px)
}

.modelearrete-form-wrapper {
    display: flex;
}

.modelearrete-form-wrapper > form {
    flex-grow: 1;
}

.arrete-step-1-more-info {
    width: 50%;
    text-align: right;
    padding: 2em 0 0 2em;
}

.arrete-step-1-more-info img {
    max-width: 80%;
}

/* Spinner animation for loading buttons */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.fr-icon-spin::before,
.fr-icon-spin::after {
  animation: spin 1s linear infinite;
}

.fr-icon-loader::before,
.fr-icon-loader::after {
  mask-image: url("../img/refresh-line.a597cfaa3fd9.svg") !important;
}

/* Table toolbar (row count + column visibility button) */

.gsl-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: calc(-50vw + 52%);
    margin-right: calc(-50vw + 52%);
}

/* Column visibility dropdown */

.gsl-column-visibility-dropdown {
    position: relative;
    margin-bottom: 0;
}

.gsl-column-visibility-dropdown .gsl-column-visibility-list {
    display: none;
    right: 0;
    padding: 0;
    width: min(560px, 90vw);
    border: 1px solid var(--border-default-grey);
    box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
}

.gsl-column-visibility-checkboxes {
    columns: 2;
    padding-top: 10px;
}

.gsl-column-visibility-list .fr-checkbox-group {
    padding-left: 10px;
    padding-right: 10px;
    break-inside: avoid;
}

/* Double dotation: lighter border between main row and other-dotation row */
.gsl-projet-table .fr-table__content table tbody tr.gsl-projet-table__row--double-dotation td {
    background-image: linear-gradient(0deg, var(--border-disabled-grey), var(--border-disabled-grey));
}

.gsl-column-visibility-dropdown .gsl-column-visibility-reset {
    width: 100%;
    text-align: left;
    border-top: 1px solid var(--border-default-grey);
    padding: 0.75rem 10px 10px;
    margin-top: 0.25rem;
}


