@import url("variables.css");
button {
  outline-style: none;
  &:focus {
    outline-style: none;
  }
  &:hover {
    cursor: pointer;
  }
}
@keyframes ssc-spin {
  to {
    transform: rotate(360deg);
  }
}
.ssc-calendar-wrapper {
  margin: 0 auto;
  padding: 0 0 20px 0;
}

.ssc-custom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.ssc-view-calendar-header {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
  width: 100%;
  border-bottom: 1px solid #E0E0E7;
  align-items: center;
  .ssc-view-tabs {
    display: flex;
    gap: 24px;
    align-items: center;
  }
  & .item {
    flex: 0 0 auto;
    &.last {
      margin: 0 0 0 auto;
    }
  }
}
.ssc-tab-btn {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 16px;
  color: var(--text-color-body);
  font-size: 18px;
  font-weight: 600;
  position: relative;
  transition: all 0.2s;
  &::before {
    content: '';
    position: absolute;
    width: 0;
    height: 4px;
    background: var(--primary-color);
    left: 0;
    bottom: 0;
    transition: width .3s linear;
  }
  &:hover {
    color: var(--primary-color);
  }
  &.active {
    &::before {
      width: 100%;
    }
  }
}

.fc .fc-toolbar-chunk {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fc-col-header {
  margin: 0px !important;
}
.ssc-filter-dropdown {
  position: relative;
  display: inline-block;
}
.ssc-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--background-color);
  color: var(--secondary-color);
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  &:hover {
    background-color: var(--primary-color-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
  }
  & svg {
    transition: transform 0.2s ease;
  }
}

.ssc-filter-dropdown.open .ssc-dropdown-btn {
  background: var(--primary-color-hover);
  border-color: var(--primary-color);
  color: var(--primary-color);
  & svg {
    transform: rotate(180deg);
  }
}
.ssc-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background-color: var(--background-color-lighter);
  border: 1px solid var(--background-color-darker);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}
.ssc-filter-dropdown.open .ssc-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.ssc-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  &:hover {
    background: var(--primary-color-hover);
  }
}
.ssc-dropdown-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}
.ssc-dropdown-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ssc-dropdown-label {
  flex: 1;
  font-size: 14px;
  color: var(--secondary-color);
  font-weight: 400;
}

/* CALENDAR STYLES */
#ssc_calendar {
  border-radius: 4px;
  padding: 20px 0;
  position: relative;
  &.ssc-loading {
    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: var(--background-color-lighter);
      z-index: 999;
      border-radius: 8px;
    }
    &::after {
      content: "";
      position: absolute;
      top: 50%;
      left: 50%;
      width: 40px;
      height: 40px;
      margin-top: -20px;
      margin-left: -20px;
      border: 4px solid var(--background-color-darker);
      border-top-color: var(--primary-color);
      border-radius: 50%;
      z-index: 1000;
      animation: ssc-spin 0.8s linear infinite;
    }
  }
  & .fc-scrollgrid {
    margin: 0;
    th {
      padding: 0;
      border-bottom: 0;
    }
    td[role="presentation"] { padding: 0; }
  }
  & .fc-scrollgrid-sync-table { margin: 0; }
  table {
    line-height: 1.4;
  }
}

/* FULLCALENDAR OVERRIDES */
.fc#ssc_calendar {
  & .fc-toolbar {
    padding-bottom: 15px;
    &.fc-header-toolbar { margin-bottom: 0; }
  }
  & .fc-toolbar-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--title-color);
    text-transform: capitalize;
    letter-spacing: 0.3px;
  }
  & .fc-button {
    background: var(--background-color-lighter);
    border: none;
    color: var(--title-color);
    padding: 4px;
    & span {
      font-size: 30px;
    }
    &:hover {
      color: var(--primary-color);
    }
  }
  & .fc-col-header-cell {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
  }
  & .fc-col-header-cell-cushion {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 14px;
  }
  & .fc-daygrid-day {
    background: var(--background-color-lighter);
    border-color: #e5e7eb;
    &:hover {
      background: var(--background-color-darker);
    }
  }
  & .fc-daygrid-day-number {
    color: var(--secondary-color);
    font-weight: 500;
    text-decoration: none !important;
    font-size: 14px;
  }
  & .fc-day-today {
    background: var(--primary-color-hover);
    & .fc-daygrid-day-number {
      font-weight: 600;
    }
  }
  & .fc-day-past {
    background: var(--background-color-darker);
    & .fc-daygrid-day-number {
      color: var(--past-text-color);
      font-weight: 400;
    }
  }
  /* FUTURE DAYS - Normal white */
  & .fc-day-future {
    background: var(--background-color-lighter);
  }
  /* Days from other months */
  & .fc-day-other {
    background: var(--background-color-lighter);
    & .fc-daygrid-day-number {
      color: var(--past-text-color);
      font-weight: 400;
    }
  }
  & .fc-day-sat,
  & .fc-day-fri,
  & .fc-day-thu,
  & .fc-day-wed,
  & .fc-day-tue,
  & .fc-day-mon,
  & .fc-day-sun {
    background-color: var(--background-color-lighter);
  }
}

/* ============================================
   EVENT STYLING IN CALENDAR
   ============================================ */
.fc-event {
  cursor: pointer;
  padding: 2px 3px;
}
.fc-event-main-frame {
  width: 100%;
  height: 100%;
}
#ssc_calendar .fc-event-title {
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}
.fc-event-time {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
}
.fc-event-type {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
  color: var(--light-color);
}
.fc-event-location {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
  color: var(--light-color);
}
.fc-list-event {
  &:hover {
    background: #f9fafb !important;
  }
  & .fc-list-event-dot {
    border-width: 8px !important;
  }
}
.fc-daygrid-event.ssc-has-tooltip {
  position: relative;
  overflow: visible; /* allow tooltip to extend outside the event pill */
}
.fc-daygrid-event {
  position: relative;
  z-index: 1;
  overflow: visible; /* let tooltip escape the chip */
}
.fc-daygrid-event.ssc-event-past .fc-event-title {
  color: var(--past-text-color);
}
.fc-daygrid-event.ssc-has-tooltip:hover {
  z-index: 100; /* bring this event above its siblings */
}

.ssc-event-tooltip {
  position: absolute;
  /* top: calc(100% + 8px); */
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  padding: 12px 14px;
  background: var(--light-color);
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  border: 1px solid #e2e8f0;
  color: var(--title-color);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  text-align: left;
}
.fc-daygrid-event.ssc-has-tooltip:hover .ssc-event-tooltip {
  opacity: 1;
}
.ssc-tooltip-date {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--title-color);
  margin-bottom: 4px;
}
.ssc-tooltip-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.ssc-tooltip-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.ssc-tooltip-location {
  font-size: 13px;
  color: var(--title-color);
}

@media (max-width: 768px) {
  .ssc-custom-header {
    flex-direction: column;
    align-items: stretch;
  }
  .ssc-calendar-wrapper {
    padding: 10px;
  }
  .ssc-tab-btn {
    padding: 10px;
  }
  #ssc-calendar {
    padding: 10px;
  }
  .fc {
    & .fc-toolbar {
      flex-wrap: wrap;
    }
    & .fc-toolbar-title {
      font-size: 18px;
    }
    & .fc-daygrid-day-number {
      font-size: 12px;
      padding: 6px;
    }
  }
  .ssc-toolbar-pills {
    width: 100%;
    justify-content: center;
    margin-left: 0;
    margin-top: 10px;
  }
  .ssc-filter-dropdown {
    margin-left: 0;
    width: 100%;
    margin-top: 10px;
  }
  .ssc-dropdown-btn {
    width: 100%;
    justify-content: space-between;
  }
  .ssc-dropdown-menu {
    left: 0;
    right: 0;
    width: 100%;
  }

  .ssc-view-calendar-header {
    .ssc-view-tabs {
      display: none;
    }
    & .item {
      &.last {
        margin: 0 0 10px 0;
      }
    }
  }
}

