:root {
  --weekly-schedule-header-height: 8.5rem;
  --weekly-schedule-footer-height: 2.25rem;
  --weekly-schedule-days-row-height: 2.5rem;
  --weekly-schedule-week-switcher-height: 2rem;
  
  --weekly-schedule-slot-height: 4.375rem;
  --weekly-schedule-slot-height-thin: 3.25rem;
}

.weekly-schedule--page-container {
  width: 100%;
  height: 100%;
  overflow: clip;
}

.weekly-schedule {
  display: flex;
  flex-direction: column;
  height: fit-content;
  background: white;
  height: calc(100% - var(--weekly-schedule-header-height));
  border-radius: var(--radius-md);
}

.weekly-schedule--week-nav {
  display: flex;
  align-items: center;
  gap: var(--rem-16);
}

.weekly-schedule--calendar {
  flex: 1;
  overflow: auto;
  padding: 0;
  background: white;
  height: calc(100% - var(--weekly-schedule-footer-height));
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.weekly-schedule--grid-header {
  height: var(--weekly-schedule-days-row-height);
  display: grid;
  grid-template-columns: 5.5rem repeat(7, 1fr);
  background: white;
  border-bottom: 1px solid #E5E7EB;
}

.weekly-schedule--time-header {
  padding: var(--rem-12) var(--rem-16);
  font-size: var(--rem-12);
  font-weight: var(--text-medium);
  color: #6B7280;
  display: flex;
  align-items: center;
  margin-inline: auto;
}

.weekly-schedule--day-header {
  padding: 0;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: .5rem;

  &[data-current="true"] {
    background-color: var(--primary-500);
    span {
      color: white;
    }
  }
}

.weekly-schedule--day-name {
  font-size: var(--rem-12);
  font-weight: var(--text-medium);
  color: #6B7280;
  text-transform: uppercase;
}

.weekly-schedule--day-date {
  font-size: var(--rem-18);
  font-weight: var(--text-semibold);
  color: var(--neutral-900);
  margin-top: var(--rem-2);
}

.weekly-schedule--grid {
  display: grid;
  grid-template-columns: 5.5rem repeat(7, 1fr);
  grid-template-rows: repeat(25, var(--weekly-schedule-slot-height-thin));
  position: relative;
  height: calc(100% - var(--weekly-schedule-days-row-height));
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;

  &::-webkit-scrollbar {
    display: none;
  }
}

.weekly-schedule--time-cell {
  grid-column: 1;
  padding: var(--rem-12) var(--rem-16);
  font-size: var(--rem-12);
  color: #6B7280;
  border-bottom: 1px solid #F3F4F6;
  border-right: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  height: var(--weekly-schedule-slot-height-thin);
}

.weekly-schedule--slot {
  position: relative;
  border-left: 1px solid #E5E7EB;
  border-bottom: 1px solid #F3F4F6;
  padding: 0;
  height: var(--weekly-schedule-slot-height-thin);
  width: 100%;
}

.weekly-schedule--empty-slot {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  text-decoration: none;
  padding: .25rem;
}

.weekly-schedule--empty-slot:hover {
  span.weekly-schedule--empty-slot-hover {
    opacity: 1;
  }
}

.weekly-schedule--empty-slot-hover {
  width: 100%;
  height: 100%;
  background-color: var(--primary-50);
  border: dashed 2px var(--primary-500);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.weekly-schedule--appointments-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.weekly-schedule--appointment {
  cursor: pointer;
  position: absolute;
  z-index: 2;
  pointer-events: all;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;

  &:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  &[data-positioned="true"] {
    opacity: 1;
  }

  /* When dropdown menu is open, give the appointment a high z-index */
  &:has(.dropdowns--menu:not([hidden])) {
    z-index: 9999;
  }
}

.weekly-schedule--appointment-inner {
  height: 100%;
  padding: .25rem;
  background: var(--primary-100);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: var(--rem-11);
  overflow: hidden;
  border-left: solid 3px var(--primary-500);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: .25rem;

  &[data-appointment-type="new_patient"] {
    background: #FFF4E9;
    border: solid 1px #EEB479;
    border-left: solid 3px #EEB479;
  }

  &[data-appointment-type="follow_up"] {
    background: #EDF6F8;
    border: solid 1px #62B6CB;
    border-left: solid 3px #62B6CB;
  }

  &[data-appointment-type="procedure"] {
    background: #F6EEF9;
    border: solid 1px #BB62D3;
    border-left: solid 3px #BB62D3;
  }

  &[data-appointment-type="other"] {
    background: var(--surface-subtle);
    border: dashed 1px var(--border-primary);
    border-left: solid 3px var(--border-primary);
  }
}

.weekly-schedule--appointment-patient {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .125rem;
  width: calc(100% - 1.25rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  
  a {
    text-decoration: none;
    font-size: var(--rem-13);
    font-variation-settings: 'wght' var(--text-medium);
    color: var(--text-body);
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    &:hover {
      opacity: 0.75;
    }
  }

  span {
    font-size: var(--rem-11);
    font-variation-settings: 'wght' var(--text-medium);
    color: var(--text-information);
  }
}

.weekly-schedule--appointment-small-text {
  display: block;
  font-size: var(--rem-11);
  font-variation-settings: 'wght' var(--text-medium);
  color: var(--text-information);
  padding-block: .125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;

  &:has(.icon) {
    display: flex;
    gap: .25rem;
    align-items: center;
    justify-content: flex-start;
  }
}

.weekly-schedule--footer {
  height: var(--weekly-schedule-footer-height);
  background: var(--neutral-200);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 1.5rem;
}

.weekly-schedule--stats {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  span {
    font-size: var(--rem-13);
    color: var(--text-body);
  }
}

.weekly-schedule--stats {
  font-weight: var(--text-semibold);
  color: var(--neutral-900);
}

.weekly-schedule--legend {
  display: flex;
  align-items: center;
  gap: var(--rem-24);
}

.weekly-schedule--legend-item {
  display: flex;
  align-items: center;
  gap: var(--rem-6);
}

.weekly-schedule--legend-dot {
  width: var(--rem-10);
  height: .25rem;
  border-radius: var(--radius-full);

  &[data-type="new_patient"] {
    background-color: #EEB479;
  }
  &[data-type="follow_up"] {
    background-color: #62B6CB;
  }
  &[data-type="procedure"] {
    background-color: #BB62D3;
  }
  &[data-type="other"] {
    background-color: var(--border-primary);
  }
}

.weekly-schedule--current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #EF4444;
  z-index: 10;
  pointer-events: none;
  transition: top 0.5s ease;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
}

.weekly-schedule--hour-indicator {
  display: none;
  position: absolute;
  width: 100%;
  height: 2px;
  background: black;
  z-index: 999;
}

.weekly-schedule--hour-indicator::before {
  content: attr(data-current-time);
  position: absolute;
  left: 0;
  top: 0;
  font-size: var(--rem-11);
  font-weight: var(--text-semibold);
  color: white;
  background-color: black;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.weekly-schedule--appointment-more-options-container {
  position: absolute;
  top: .5rem;
  right: .25rem;
  z-index: 10;
  display: none;
}

.weekly-schedule--appointment:hover > .weekly-schedule--appointment-inner > .weekly-schedule--appointment-more-options-container,
.weekly-schedule--appointment-more-options-container:has(.menus--more-options-button[data-active="true"]) {
  display: flex;
}

.weekly-schedule--appointment .menus--more-options-menu {
  z-index: 10000 !important;
  position: absolute;
}

.weekly-schedule--appointment .menus--more-options-container {
  z-index: inherit;
}

.weekly-schedule--week-switcher {
  width: fit-content;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding-left: 1px;
  height: var(--weekly-schedule-week-switcher-height);

  a {
    width: min-content;
  }
}

.weekly-schedule--appointment-top-row {
  width: calc(100% - 1.25rem);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .25rem;
}

.weekly-schedule--appointment-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .25rem;
}