/* =========================
   COMPONENT: FILTERS
   File: components-filter.css
   Scope:
   - Toolbar filters (custom select)
   - Active chips
   - Advanced filters modal
========================= */

/* =========================
   FILTERS – LAYOUT
========================= */

.ro-filters{
  display: flex;
  flex-direction: column;
  gap: var(--ro-space-12);
}

/* Scrollable row */
.ro-filters__row{
  display: flex;
  align-items: center;
  gap: var(--ro-space-10);
  flex-wrap: nowrap;

  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;

  padding: var(--ro-space-12) 0; /* avoids cutting shadows */
}

/* Wrapper (each select) */
.ro-filter{
  position: relative;
  display: inline-flex;
}

/* Native select: kept for data, hidden */
.ro-filter__native{
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;

  appearance: none;
  -webkit-appearance: none;
}

/* =========================
   FILTER BUTTON (TRIGGER)
========================= */

.ro-filter__btn{
  height: var(--ro-size-32);
  padding: 0 var(--ro-space-12);
  border-radius: var(--ro-radius-6);

  border: 1px solid var(--ro-dolphing-500);
  background: var(--ro-bg-0);
  color: var(--ro-dolphing-950);

  font-size: var(--ro-font-size-s);
  font-weight: var(--ro-font-weight-bold);
  line-height: 1;

  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ro-space-10);

  cursor: pointer;
  user-select: none;

  /* button-like */
  box-shadow: 2px 2px 0 0 var(--ro-dolphing-300);

  transition:
    background .15s ease,
    border-color .15s ease,
    box-shadow .1s ease,
    transform .05s ease;
}

/* Label */
.ro-filter__label{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Chevron */
.ro-filter__chev{
  font-size: 18px;
  line-height: 1;
  color: var(--ro-dolphing-700);
  transition: transform .15s ease;
}

/* Hover */
.ro-filter__btn:hover{
  background: var(--ro-dolphing-100);
}

/* Active (pressed) */
.ro-filter__btn:active{
  box-shadow: none;
  transform: translate(2px, 2px);
}

/* Focus (accessible) */
.ro-filter__btn:focus{
  outline: none;
}

.ro-filter__btn:focus-visible{
  outline: none;
  box-shadow: var(--ro-focus-ring);
}

/* Open state (dropdown opened) */
.ro-filter.is-open .ro-filter__chev{
  transform: rotate(180deg);
}

.ro-filter.is-open .ro-filter__btn{
  background: var(--ro-dolphing-200);
  border-color: var(--ro-dolphing-600);
}

/* Active state (value selected != 0)
   NOTE: add .is-active via JS when a filter has a real value */
.ro-filter.is-active .ro-filter__btn{
  background: var(--ro-dolphing-200);
  border-color: var(--ro-dolphing-700);
  box-shadow: 2px 2px 0 0 var(--ro-dolphing-400);
}

/* =========================
   DROPDOWN PANEL
   IMPORTANT:
   - panel visibility is controlled by .is-open on the panel itself
   - not by .ro-filter.is-open (in case you portal/relocate it)
========================= */

.ro-filter__panel{
  display: none;
  min-width: 240px;

  background: var(--ro-bg-0);
  border: 1px solid var(--ro-dolphing-300);
  border-radius: var(--ro-radius-6);

  box-shadow: 0 10px 30px rgba(0,0,0,.12);

  padding: var(--ro-space-6);
}

.ro-filter__panel.is-open{
  display: block;
}

/* =========================
   DROPDOWN OPTIONS
========================= */

.ro-filter__opt{
  width: 100%;
  height: var(--ro-size-32);

  border-radius: var(--ro-radius-6);
  border: 0;
  background: transparent;

  color: var(--ro-dolphing-950);
  font-size: var(--ro-font-size-s);
  font-weight: var(--ro-font-weight-bold);
  text-align: left;

  padding: 0 var(--ro-space-12);
  cursor: pointer;

  transition:
    background .15s ease,
    box-shadow .1s ease,
    transform .05s ease;
}

.ro-filter__opt:hover{
  background: var(--ro-dolphing-100);
}

.ro-filter__opt:active{
  background: var(--ro-dolphing-200);
}

.ro-filter__opt:focus{
  outline: none;
}

.ro-filter__opt:focus-visible{
  outline: none;
  box-shadow: var(--ro-focus-ring);
}

/* Selected option */
.ro-filter__opt[aria-selected="true"]{
  background: var(--ro-dolphing-200);
  box-shadow: 2px 2px 0 0 var(--ro-dolphing-300);
}

/* =========================
   CHIPS (ACTIVE FILTERS)
========================= */

.ro-filters__chips{
  display: flex;
  gap: var(--ro-space-8);
  flex: 0 0 auto;
  align-items: center;
}

.ro-chip{
  display: inline-flex;
  align-items: center;
  gap: var(--ro-space-6);

  height: var(--ro-size-32);
  padding: 0 var(--ro-space-10);

  border-radius: var(--ro-radius-6);
  border: 1px solid var(--ro-dolphing-500);

  background: var(--ro-dolphing-100);
  color: var(--ro-dolphing-950);
  text-decoration: none;
  white-space: nowrap;
}

.ro-chip i{
  font-size: 16px;
}

.ro-chip:hover{
  background: var(--ro-dolphing-200);
}

/* =========================
   TAGS (STATUS)
========================= */

.ro-tag,
.ro-Publié{
  display: inline-flex;
  align-items: center;
  gap: var(--ro-space-6);

  height: var(--ro-size-24);
  padding: var(--ro-space-2) var(--ro-space-12);

  border-radius: var(--ro-radius-24);
  background: var(--ro-dolphing-200);
  color: var(--ro-dolphing-700);
  text-decoration: none;
}

.ro-tag i{
  font-size: var(--ro-size-24);
}

/* Draft variants */
.ro-tag.is-draft,
.ro-Brouillon{
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: var(--ro-space-6);

  height: var(--ro-size-24);
  padding: var(--ro-space-2) var(--ro-space-12);

  border-radius: var(--ro-radius-24);
  background: var(--ro-neutral-200);
  color: var(--ro-neutral-700);
  text-decoration: none;
}

/* =========================
   ADVANCED FILTERS MODAL (BASE)
========================= */

.ro-adv[hidden]{ display: none; }

.ro-adv{
  position: fixed;
  inset: 0;
  z-index: 10000;
  left: var(--ro-sidebar-current-w);
  width: calc(100vw - var(--ro-sidebar-current-w));
}

.ro-adv__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
}

.ro-adv__modal{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  width: min(860px, calc(100vw - var(--ro-sidebar-current-w) - 24px));
  max-height: 80vh;

  background: var(--ro-bg-0);
  border: 1px solid var(--ro-dolphing-300);
  border-radius: var(--ro-radius-10);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 440px){
  .ro-adv{
    left: 0;
    width: 100vw;
  }

  .ro-adv__modal{
    width: min(860px, calc(100vw - 24px));
  }
}

.ro-adv__head{
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: var(--ro-space-12);
  border-bottom: 1px solid var(--ro-dolphing-200);
}

.ro-adv__foot{
  padding: var(--ro-space-12);
  border-top: 1px solid var(--ro-dolphing-200);

  display: flex;
  justify-content: flex-end;
  gap: var(--ro-space-10);
}

/* =========================
   ADVANCED MODAL – GRID + SCROLL
========================= */

/* Grid: objectives narrower, ingredients wider */
.ro-adv__grid{
  display: grid;
  gap: var(--ro-space-12);
  grid-template-columns: 0.9fr 1.5fr;

  padding: var(--ro-space-12);

  /* required for internal scrolling */
  flex: 1;
  min-height: 0;
  overflow: visible;
}

/* Columns */
.ro-adv__col{
  border: 1px dashed var(--ro-dolphing-300);
  border-radius: var(--ro-radius-6);

  padding: var(--ro-space-10);
  min-width: 0;
}

/* Each option = a real row */
.ro-filters__group label{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.25;
  margin: 0 0 10px;

  break-inside: avoid;
  white-space: normal;
}

/* Ingredients column: vertical scroll container */
.ro-adv__col--ing{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Scroll area (final clean) */
.ro-adv__col--ing .ro-adv__scroll{
  flex: 1;
  min-height: 0;

  overflow-y: auto;   /* use scroll if you want always visible */
  overflow-x: hidden;

  padding-right: 10px;
  overscroll-behavior: contain;

  scrollbar-gutter: stable;
}

/* 2 columns on desktop (no horizontal scroll) */
@media (min-width: 860px){
  .ro-adv__col--ing .ro-adv__scroll{
    column-count: 2;
    column-gap: 16px;
  }

  .ro-adv__col--ing .ro-adv__scroll label{
    display: inline-flex;
    width: 100%;
    break-inside: avoid;
  }
}

/* Mobile: 1 column */
@media (max-width: 720px){
  .ro-adv__grid{
    grid-template-columns: 1fr;
  }
}

/* =========================
   SCROLLBAR STYLING
========================= */

/* Webkit */
.ro-adv__col--ing .ro-adv__scroll::-webkit-scrollbar{
  width: 12px;
}

.ro-adv__col--ing .ro-adv__scroll::-webkit-scrollbar-track{
  background: rgba(0,0,0,.06);
  border-radius: 999px;
}

.ro-adv__col--ing .ro-adv__scroll::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,.28);
  border-radius: 999px;
  border: 3px solid rgba(0,0,0,.06);
  background-clip: padding-box;
}

.ro-adv__col--ing .ro-adv__scroll::-webkit-scrollbar-thumb:hover{
  background: rgba(0,0,0,.40);
}

/* Firefox */
.ro-adv__col--ing .ro-adv__scroll{
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.35) rgba(0,0,0,.06);
}