/* FullCalendar Custom Styles */

/* Calendar container */
.fc {
  --fc-border-color: rgb(229 231 235);
  --fc-button-text-color: rgb(55 65 81);
  --fc-button-bg-color: white;
  --fc-button-border-color: rgb(229 231 235);
  --fc-button-hover-bg-color: rgb(243 244 246);
  --fc-button-hover-border-color: rgb(209 213 219);
  --fc-button-hover-text-color: rgb(17 24 39);
  --fc-button-active-bg-color: rgb(190 22 34);
  --fc-button-active-border-color: rgb(190 22 34);
  --fc-button-active-text-color: white;
  --fc-today-bg-color: rgb(239 246 255);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgb(249 250 251);
  --fc-list-event-hover-bg-color: rgb(243 244 246);
}

/* Dark mode */
.dark .fc {
  --fc-border-color: rgb(55 65 81);
  --fc-today-bg-color: rgb(30 58 138 / 0.2);
  --fc-neutral-bg-color: rgb(31 41 55);
  --fc-list-event-hover-bg-color: rgb(55 65 81);
  --fc-page-bg-color: transparent;
}

.dark .fc .fc-daygrid-day-number,
.dark .fc .fc-col-header-cell-cushion {
  color: rgb(229 231 235);
}

.dark .fc .fc-button {
  background-color: rgb(31 41 55);
  border-color: rgb(55 65 81);
  color: rgb(229 231 235);
}

.dark .fc .fc-button:hover {
  background-color: rgb(55 65 81);
  border-color: rgb(75 85 99);
  color: white;
}

.dark .fc .fc-button-active,
.dark .fc .fc-button-primary:not(:disabled).fc-button-active,
.dark .fc .fc-button-primary:not(:disabled):active {
  background-color: rgb(190 22 34);
  border-color: rgb(190 22 34);
  color: white;
}

/* Header toolbar styling */
.fc .fc-toolbar-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.fc .fc-button {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  transition: background-color 120ms, color 120ms, border-color 120ms;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  color: white;
}

.fc .fc-button-primary:focus,
.fc .fc-button-primary:not(:disabled):active:focus,
.fc .fc-button-primary:not(:disabled).fc-button-active:focus {
  box-shadow: 0 0 0 3px rgb(190 22 34 / 0.2);
}

.fc .fc-button-group {
  gap: 0;
}

.fc .fc-button-group > .fc-button {
  margin-left: -1px;
  border-radius: 0;
}

.fc .fc-button-group > .fc-button:first-child {
  margin-left: 0;
  border-radius: 0.5rem 0 0 0.5rem;
}

.fc .fc-button-group > .fc-button:last-child {
  border-radius: 0 0.5rem 0.5rem 0;
}

.fc .fc-button-group > .fc-button.fc-button-active,
.fc .fc-button-group > .fc-button:hover {
  position: relative;
  z-index: 1;
}

/* Event styling by status */
.fc-event {
  cursor: pointer;
  border-radius: 0.25rem;
  padding: 2px 4px;
  font-size: 0.75rem;
}

/* Unassigned event indicator */
.fc-event-unassigned-icon {
  display: inline-block;
  margin-right: 0.25rem;
  font-size: 0.875rem;
  vertical-align: middle;
}

.fc-event-unassigned {
  border-style: dashed !important;
  border-width: 2px !important;
}

.fc-event-accepted {
  background-color: rgb(34 197 94);
  border-color: rgb(34 197 94);
}

.fc-event-maybe {
  background-color: rgb(234 179 8);
  border-color: rgb(234 179 8);
}

.fc-event-declined {
  background-color: rgb(156 163 175);
  border-color: rgb(156 163 175);
  opacity: 0.6;
}

.fc-event-pending {
  background-color: rgb(79 70 229);
  border-color: rgb(79 70 229);
}

/* Day grid specific */
.fc-daygrid-day-frame {
  min-height: 80px;
}

.fc-daygrid-event {
  margin: 1px 2px;
}

/* Time grid specific */
.fc-timegrid-slot {
  height: 2.5rem;
}

/* Column header */
.fc .fc-col-header-cell {
  padding: 0.5rem 0;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* Day number */
.fc .fc-daygrid-day-number {
  padding: 0.5rem;
  font-size: 0.875rem;
}

/* More link */
.fc .fc-daygrid-more-link {
  font-size: 0.75rem;
  color: rgb(79 70 229);
}

.fc .fc-daygrid-more-link:hover {
  color: rgb(67 56 202);
}

/* Popover */
.fc .fc-popover {
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark .fc .fc-popover {
  background-color: rgb(31 41 55);
  border-color: rgb(55 65 81);
}

.fc .fc-popover-header {
  padding: 0.5rem 0.75rem;
  background-color: rgb(243 244 246);
}

.dark .fc .fc-popover-header {
  background-color: rgb(55 65 81);
  color: rgb(229 231 235);
}

/* Nav links */
.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
  text-decoration: none;
}

.fc .fc-daygrid-day-number:hover,
.fc .fc-col-header-cell-cushion:hover {
  color: rgb(79 70 229);
}

/* ===== Timeline (custom view, partage les variables FullCalendar) ===== */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.timeline-toolbar__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-toolbar__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: rgb(31 41 55);
}

.dark .timeline-toolbar__title {
  color: rgb(229 231 235);
}

.timeline-grid {
  display: grid;
  grid-template-columns: 12rem repeat(var(--timeline-cols, 7), minmax(0, 1fr));
  border: 1px solid var(--fc-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: white;
}

.dark .timeline-grid {
  background-color: rgb(17 24 39);
}

.timeline-grid__corner {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(107 114 128);
  background-color: var(--fc-neutral-bg-color);
  border-right: 1px solid var(--fc-border-color);
  border-bottom: 1px solid var(--fc-border-color);
}

.timeline-grid__day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  background-color: var(--fc-neutral-bg-color);
  border-right: 1px solid var(--fc-border-color);
  border-bottom: 1px solid var(--fc-border-color);
}

.timeline-grid__day-header:last-child {
  border-right: 0;
}

.timeline-grid__day-header--today {
  background-color: var(--fc-today-bg-color);
}

.timeline-grid__day-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(107 114 128);
  text-transform: uppercase;
}

.timeline-grid__day-num {
  font-size: 1.125rem;
  font-weight: 600;
  color: rgb(31 41 55);
}

.dark .timeline-grid__day-num {
  color: rgb(229 231 235);
}

.timeline-grid__row-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(31 41 55);
  background-color: var(--fc-neutral-bg-color);
  border-right: 1px solid var(--fc-border-color);
  border-bottom: 1px solid var(--fc-border-color);
}

.timeline-grid__row-label--unassigned {
  color: rgb(107 114 128);
  font-style: italic;
}

.dark .timeline-grid__row-label {
  color: rgb(229 231 235);
}

.timeline-grid__cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 4.5rem;
  padding: 0.25rem;
  background-color: white;
  border-right: 1px solid var(--fc-border-color);
  border-bottom: 1px solid var(--fc-border-color);
  cursor: pointer;
  transition: background-color 100ms;
}

.timeline-grid__cell:hover {
  background-color: rgb(249 250 251);
}

.timeline-grid__cell:last-child {
  border-right: 0;
}

.timeline-grid__cell--today {
  background-color: var(--fc-today-bg-color);
}

.dark .timeline-grid__cell {
  background-color: rgb(17 24 39);
}

.dark .timeline-grid__cell:hover {
  background-color: rgb(31 41 55);
}

.timeline-grid__empty {
  padding: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: rgb(156 163 175);
  background-color: white;
}

.dark .timeline-grid__empty {
  background-color: rgb(17 24 39);
}

.timeline-event {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: white;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: filter 100ms;
}

.timeline-event:hover {
  filter: brightness(0.92);
}

.timeline-event__time {
  font-weight: 600;
  flex-shrink: 0;
}

.timeline-event__title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Year view (custom) ===== */

.year-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.year-view__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.year-view__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Shared view switcher (year, timeline, future calendar shell) */
.view-switcher {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}

.view-switcher__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  padding: 0 0.875rem;
  border: 1px solid rgb(229 231 235);
  background: white;
  color: rgb(55 65 81);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background-color 120ms, color 120ms, border-color 120ms;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  margin-left: -1px;
}

.view-switcher__btn:first-child {
  margin-left: 0;
  border-top-left-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
}

.view-switcher__btn:last-child {
  border-top-right-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.view-switcher__btn--standalone {
  margin-left: 0;
  border-radius: 0.5rem;
}

.view-switcher__btn--icon {
  width: 2.25rem;
  padding: 0;
}

.view-switcher__btn:hover {
  background: rgb(243 244 246);
  color: rgb(17 24 39);
  position: relative;
  z-index: 1;
}

.view-switcher__btn--active,
.view-switcher__btn--active:hover {
  background: rgb(190 22 34);
  border-color: rgb(190 22 34);
  color: white;
  cursor: default;
  position: relative;
  z-index: 1;
}

.dark .view-switcher__btn {
  background: rgb(31 41 55);
  border-color: rgb(55 65 81);
  color: rgb(229 231 235);
}

.dark .view-switcher__btn:hover {
  background: rgb(55 65 81);
  color: white;
}

.dark .view-switcher__btn--active,
.dark .view-switcher__btn--active:hover {
  background: rgb(190 22 34);
  border-color: rgb(190 22 34);
  color: white;
}

.year-view__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: rgb(17 24 39);
  margin: 0 0.5rem;
  min-width: 4rem;
  text-align: center;
}

.dark .year-view__title {
  color: rgb(243 244 246);
}

.year-view__tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: max-content;
  max-width: 280px;
  background: rgb(17 24 39);
  color: white;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.25);
  pointer-events: none;
  text-align: left;
}

.year-view__tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgb(17 24 39) transparent transparent transparent;
}

.dark .year-view__tooltip {
  background: rgb(55 65 81);
}

.dark .year-view__tooltip::after {
  border-color: rgb(55 65 81) transparent transparent transparent;
}

.year-view__tooltip-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(209 213 219);
  margin-bottom: 0.375rem;
}

.year-view__tooltip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.year-view__tooltip-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.year-view__tooltip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  flex-shrink: 0;
  margin-top: 4px;
}

.year-view__tooltip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.year-view__tooltip-time {
  font-weight: 600;
  color: rgb(243 244 246);
}

.year-view__tooltip-title {
  color: rgb(209 213 219);
  word-break: break-word;
}

.year-view__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .year-view__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.year-view__month {
  background: white;
  border: 1px solid rgb(229 231 235);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.dark .year-view__month {
  background: rgb(17 24 39);
  border-color: rgb(55 65 81);
}

.year-view__month-header {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgb(17 24 39);
  text-align: center;
  margin-bottom: 0.5rem;
}

.dark .year-view__month-header {
  color: rgb(243 244 246);
}

.year-view__weekdays {
  display: grid;
  grid-template-columns: 1.6rem repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.year-view__weeknum-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
  color: rgb(156 163 175);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.year-view__weeks {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.year-view__week {
  display: grid;
  grid-template-columns: 1.6rem repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
  gap: 2px;
}

.year-view__weeknum {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: rgb(156 163 175);
  letter-spacing: 0.02em;
}

.dark .year-view__weeknum {
  color: rgb(107 114 128);
}

.year-view__weekday {
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  color: rgb(156 163 175);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.year-view__day {
  position: relative;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 2rem;
  padding: 4px 2px;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  color: rgb(55 65 81);
  background: transparent;
  text-decoration: none;
  transition: background-color 120ms;
  cursor: pointer;
}

.year-view__day--out {
  color: rgb(209 213 219);
  pointer-events: none;
  opacity: 0.5;
}

.dark .year-view__day--out {
  color: rgb(75 85 99);
}

.year-view__day--blank {
  visibility: hidden;
  cursor: default;
}

.year-view__day--weekend .year-view__day-number {
  color: rgb(156 163 175);
}

.dark .year-view__day {
  color: rgb(229 231 235);
}

.year-view__day:not(.year-view__day--blank):hover {
  background: rgb(243 244 246);
}

.dark .year-view__day:not(.year-view__day--blank):hover {
  background: rgb(31 41 55);
}

.year-view__day--has-events {
  background: rgb(249 250 251);
}

.dark .year-view__day--has-events {
  background: rgb(31 41 55 / 0.5);
}

.year-view__day--today {
  background: rgb(254 226 226);
  font-weight: 700;
}

.dark .year-view__day--today {
  background: rgb(127 29 29 / 0.4);
}

.year-view__day-number {
  line-height: 1;
  margin-top: 1px;
}

.year-view__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding-top: 2px;
  min-height: 8px;
}

.year-view__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.year-view__dots-more {
  font-size: 0.55rem;
  font-weight: 600;
  color: rgb(107 114 128);
  line-height: 1;
}

.dark .year-view__dots-more {
  color: rgb(156 163 175);
}

/* Multi-day bars (desktop). On mobile we fall back to dots. */

.year-view__bar {
  display: none;
}

@media (min-width: 768px) {
  .year-view__day {
    aspect-ratio: auto;
    min-height: 1.75rem;
  }

  .year-view__dots {
    display: none;
  }

  .year-view__bar {
    display: flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1;
    box-shadow: 0 1px 1px rgb(0 0 0 / 0.08);
  }

  .year-view__bar:hover {
    filter: brightness(1.08);
    z-index: 2;
  }

  .year-view__bar--continues-left {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -2px;
    padding-left: 8px;
  }

  .year-view__bar--continues-right {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -2px;
  }

  .year-view__bar-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
}
