@use '../../../../styles/_globals.scss' as *;
@use '../schedule-constants.scss' as *;

:host {
  --nr-of-days: 5;
  --nr-of-weeks: 6;
  background: transparent;
  display: flex;
  flex-direction: column;
}

// we need this to prevent problems with route ani and scroll behavior
.scroll-wrapper {
  height: 100%;
  width: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  box-sizing: border-box;

  // Enable horizontal scroll when viewport is too small for 7 days
  &[data-horizontal-scroll] {
    overflow-x: scroll; // Show horizontal scrollbar when needed

    // Match app's standard scrollbar styling
    scrollbar-width: $schedule-scrollbar-width;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);

    &::-webkit-scrollbar {
      width: $schedule-scrollbar-width;
      height: $schedule-scrollbar-height; // Slightly taller for horizontal visibility
    }

    &::-webkit-scrollbar-track {
      background: var(--scrollbar-track);
      border-radius: $schedule-scrollbar-width;
    }

    &::-webkit-scrollbar-thumb {
      background: var(--scrollbar-thumb);
      border-radius: 16px;

      &:hover {
        background: var(--scrollbar-thumb-hover);
      }
    }
  }
}

.schedule-nav-controls {
  display: flex;
  align-items: center;
  gap: var(--s);
  min-height: 48px;
  color: var(--text-color);
  background: transparent;
  padding-right: $schedule-header-scrollbar-padding;
  @include extraBorder('-top');
  @include extraBorder('-bottom');

  .title {
    margin-left: auto;
    padding-right: var(--s);
    font-weight: 600;
    font-size: 18px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    @include mq(xs, max) {
      font-size: 14px;
    }
  }

  button {
    flex-shrink: 0;
  }

  mat-icon {
    flex-shrink: 0;
  }

  .date-nav-group {
    display: flex;
    align-items: center;
  }

  .week-month-selector {
    display: flex;
    margin-left: var(--s);
    border-radius: var(--card-border-radius);
    overflow: hidden;
    border: 1px solid var(--extra-border-color);
    background: var(--bg-lighter);
  }

  .week-month-btn {
    border: none;
    border-radius: 0;
    transition: var(--transition-standard);
    background: transparent;
    color: var(--text-color);
    box-shadow: none;

    &:hover:not(.active) {
      background: var(--separator-color);
    }

    &.active {
      background: var(--c-primary);
      color: white;
    }

    &:first-child {
      border-right: 1px solid var(--extra-border-color);
    }
  }
}

.cal-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

.main-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  @include extraBorder('-bottom');
}

.days {
  display: grid;
  place-content: center;
  text-align: center;
  grid-auto-columns: 1fr;
  grid-template-columns: var(--schedule-time-width) repeat(var(--nr-of-days), 1fr);

  --schedule-time-width: #{$schedule-time-column-width};
}

.day {
  line-height: 32px;
  font-size: 18px;
  @include extraBorder('-left');

  @include mq(xs, max) {
    font-size: 14px;
    line-height: 20px;
  }
}

.day-num {
  font-weight: 600;
  display: inline;
  padding-right: 6px;
}

.day-day {
  display: inline;
  font-weight: 100;
}
