.filters-pills { 
  display: flex; 
  gap: 12px;
  align-items: center; 
}

.drp { 
  position: relative; 
  display: inline-block;
  font: 14px "PT Sans", sans-serif;
}

.drp.icon-mode {
  .knob {
    color: #8E91A4;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 18px;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    line-height: 23px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
  }
  .knob:hover {
    border-color: #FFA600;
    background-color: #FFF8DD;
  }
  .knob.on {
    color: #FFA600;
    border-color: #FFA600;
    background-color: #FFF8DD;
  }
  .dropdown.calendar {
    left: 0;
    right: auto;
  }
  &.position-above .dropdown.calendar {
    top: auto;
    bottom: calc(100% + 6px);
  }
}

.drp.text-mode {
  .date-trigger { cursor: pointer; }
  .date-trigger:hover { color: var(--pl-deep-sea); background-color: #FFF8DD; border-radius: 4px; padding: 2px 6px; margin: 0 -6px; }
  .dropdown.calendar { left: 0; right: auto; }
  
  &.position-above .dropdown.calendar {
    top: auto;
    bottom: calc(100% + 6px);
  }
}

.drp.position-above .dropdown.calendar {
  top: auto;
  bottom: calc(100% + 6px);
}

.pill {
  display: inline-flex; 
  align-items: center; 
  gap: 6px;
  height: 22px;
  padding: 0 10px; 
  border-radius: 8px;
  border: 1px solid #BCC7DD; 
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;

  &.range {
    min-width: 140px;
  }

  &.single-date {
    min-width: 100px;
    padding: 0 6px;
    gap: 6px;
    
    .text-slot {
      width: 70px;
      padding: 0 4px;
    }
    
    .week-slot {
      width: 30px;
      padding: 0 2px;
    }
  }

  &.hide-year {
    min-width: 110px;
    
    .day-label {
      margin-right: 4px;
      margin-left: 4px;
    }
    
    .text-slot {
      width: 70px;
    }
    
    &.single-date {

      .text-slot {
        width: auto;
        padding: 0;
      }
      
      .week-slot {
        width: auto;
        padding: 0;
      }
    }
  }

  .text {
    white-space: nowrap;
  }

  .week-slot {
    display: inline-grid;
    justify-items: center;
  }

  .text-slot {
    display: inline-grid;
    width: 143px; /* reduced to account for removed X */

    &.single {
      justify-items: center;
    }
  }
}

.pill .chev, .pill .caret, .pill .clear { 
  font-family: 'Material Symbols'; 
  cursor: pointer; 
}

.dropdown {
  &.calendar, &.client {
    position: absolute; 
    background: #fff;
    top: calc(100% + 6px);
    bottom: auto;
    left: 0;
    border: 1px solid var(--pl-eggshell); 
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); 
    z-index: 999999; /* same as tooltips so calendar is always on top */
  }

  &.calendar {
    padding: 12px;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 8px;

    &.no-quick {
      grid-template-columns: 1fr;
    }

    .grid {
      min-width: 294px;
    }

    .quick .quick-item {
      padding: 8px 10px;
      border-radius: 8px;
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      -moz-user-select: none;
  
      &:hover {
        background: var(--pl-early-dawn);
      }
  
      &.selected {
        background: #F5F5F5;
        font-weight: 600;
      }
    }
  }
}

.calendar-header { 
  display: grid;
  grid-template-columns: 36px repeat(7, 28px);
  gap: 8px;
  align-items: center; 
  margin-bottom: 8px; 

  .head-item.msymbol {
    display: inline-grid;
    place-items: center;
    width: 24px; height: 24px;
    border: 1px solid #BCC7DD;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    color: #263E50;

    &:hover {
      background: #F6F7FB;
    }
    
    &:first-child {
      justify-self: end;
      margin-right: 8px;
    }
  }  
  .title {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
  }
}

.calendar-container {
  color: black;
}

.weekday-header {
  display: grid;
  grid-template-columns: 36px repeat(7, 28px);
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;

  .week-spacer {
    /* Empty spacer for week labels column */
    grid-area: auto;
  }

  .weekday-label {
    text-align: center;
    color: #8D92A5;
    font-weight: 400;
    font-size: 14px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
  }
}

.weeks-container {
  position: relative;

  &::before {
    content: "";
    position: absolute;
    left: 36px;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px solid #8D92A5;
  }
}

.week-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
  position: relative;

  .week-label {
    text-align: right; 
    padding-right: 8px;
    box-sizing: border-box;
    color: #8D92A5;
    font-weight: 400;
    font-size: 14px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
  }

  .days-row {
    display: grid;
    grid-template-columns: repeat(7, 28px);
    gap: 8px;
    position: relative;
  }
}

.day {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border-radius: 8px;
  font-weight: 400; 
  cursor: pointer;
  color: inherit;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  position: relative;

  &.filler {
    color: #8D92A5;
  }

  &.in-range {
    background: #FEF3C1;
    border-radius: 0;
    
    /* Extend background to fill gaps between cells - only for non-start/end cells */
    &:not(.start):not(.end)::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: -4px;
      right: -4px;
      background: #FEF3C1;
      z-index: -1;
    }
    
    /* Don't extend on the first cell of a row */
    &:not(.start):not(.end):first-child::before {
      left: 0;
    }
    
    /* Don't extend on the last cell of a row */
    &:not(.start):not(.end):last-child::before {
      right: 0;
    }
  }

  &.start, &.end {
    background: #FFA600 !important;
    color: #fff !important;
    font-weight: 700;
    z-index: 2;
    
    /* Override in-range background */
    &.in-range {
      background: #FFA600 !important;
    }
  }

  &.start { 
    border-top-left-radius: 8px; 
    border-bottom-left-radius: 8px; 
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    
    /* If start is also end (single day), make it fully rounded */
    &.end {
      border-radius: 8px;
    }
    
    /* Add connecting background to the right for start cells */
    &:not(.end)::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      right: -4px;
      width: 4px;
      background: #FEF3C1;
      z-index: -1;
    }
    
    /* Don't extend on the last cell of a row */
    &:not(.end):last-child::before {
      display: none;
    }
  }
  
  &.end { 
    border-top-right-radius: 8px; 
    border-bottom-right-radius: 8px; 
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    
    /* Add connecting background to the left for end cells */
    &:not(.start)::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: -4px;
      width: 4px;
      background: #FEF3C1;
      z-index: -1;
    }
    
    &:not(.start):first-child::before {
      display: none;
    }
  }

  &.today {
    position: relative;
    font-weight: 700;
    color: black;
    z-index: 1;

    &:not(.in-range):not(.start):not(.end) {
      border-radius: 8px;
      background: #FEFAEB;
      border: 1px solid #FFC800;
    }
  }

  &.current:hover:not(.start):not(.end):not(.in-range):not(.disabled) {
    border: 1px solid #FFA600;
    font-weight: 700;
  }

  &.filler:hover:not(.start):not(.end):not(.in-range):not(.disabled) {
    border: 1px solid #FFA600;
    font-weight: 700;
  }

  &.disabled {
    color: #C5C9D6;
    cursor: not-allowed;
    pointer-events: none;
  }

  &.available {
    background-color: #FEF3C1;
  }

  &.in-range.first-of-week:not(.start) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  &.in-range.last-of-week:not(.end) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}
