/* Public and CRM timetable presentation. */

.schedule-grid-scroll {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.schedule-grid {
  --schedule-hour-height: 4.75rem;
  background: var(--surface);
  display: grid;
  grid-template-columns: 4.5rem repeat(7, minmax(0, 1fr));
  grid-template-rows: 3rem repeat(var(--schedule-row-count), var(--schedule-hour-height));
  min-width: 0;
  position: relative;
  width: 100%;
}

.schedule-grid-corner,
.schedule-grid-heading,
.schedule-grid-time {
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.75rem;
  position: sticky;
  z-index: 4;
}

.schedule-grid-corner {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  grid-column: 1;
  grid-row: 1;
  left: 0;
  top: 0;
  z-index: 6;
}

.schedule-grid-heading {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  grid-row: 1;
  text-align: center;
  top: 0;
  z-index: 5;
}

.schedule-grid-time {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  grid-column: 1;
  left: 0;
  text-align: right;
}

.schedule-grid-cell {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: var(--schedule-hour-height);
  transition: background-color 0.15s ease-in-out;
}

.schedule-grid-cell.is-drop-target {
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--accent-primary);
}

.schedule-card {
  align-self: stretch;
  min-height: 0;
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.schedule-card:hover,
.schedule-card:focus-within {
  z-index: 7;
}

.schedule-card-body {
  background: color-mix(in srgb, var(--schedule-event-color) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--schedule-event-color) 38%, var(--border));
  border-left-color: var(--schedule-event-color);
  border-left-width: 0.25rem;
  border-radius: 0.4rem;
  color: var(--text);
  height: max(2.5rem, var(--schedule-duration));
  left: calc(var(--schedule-lane-offset) + 0.2rem);
  overflow: hidden;
  padding: 0.45rem 0.55rem;
  pointer-events: auto;
  position: absolute;
  top: var(--schedule-start);
  transition:
    background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out,
    transform 0.15s ease-in-out;
  width: calc(var(--schedule-lane-width) - 0.4rem);
}

.schedule-card-color-0 {
  --schedule-event-color: var(--calendar-blue);
}

.schedule-card-color-1 {
  --schedule-event-color: var(--calendar-green);
}

.schedule-card-color-2 {
  --schedule-event-color: var(--calendar-red);
}

.schedule-card-color-3 {
  --schedule-event-color: var(--calendar-purple);
}

.schedule-card-color-4 {
  --schedule-event-color: var(--calendar-amber);
}

.schedule-card-color-5 {
  --schedule-event-color: var(--calendar-teal);
}

.schedule-card-color-6 {
  --schedule-event-color: var(--calendar-coral);
}

.schedule-card-color-7 {
  --schedule-event-color: var(--calendar-gray);
}

.schedule-card-body:hover,
.schedule-card-body:focus-within {
  background: color-mix(in srgb, var(--schedule-event-color) 18%, var(--surface));
  border-color: var(--schedule-event-color);
  transform: translateY(-2px);
  z-index: 5;
}

.schedule-card-topline {
  align-items: center;
  display: flex;
  gap: 0.35rem;
  justify-content: space-between;
}

.schedule-card-time,
.schedule-card-meta,
.schedule-card-enroll {
  font-size: 0.75rem;
}

.schedule-card-title {
  font-size: 0.9rem;
  line-height: 1.2;
  margin: 0.25rem 0;
  overflow-wrap: anywhere;
}

.schedule-card-title a,
.schedule-card-enroll {
  color: var(--text);
}

.schedule-card-title a:hover,
.schedule-card-title a:focus,
.schedule-card-enroll:hover,
.schedule-card-enroll:focus {
  color: var(--accent-primary);
}

.schedule-card-meta {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card-enroll {
  display: inline-block;
  font-weight: 700;
  margin-top: 0.25rem;
}

.schedule-card--editable {
  cursor: grab;
}

.schedule-card--editable .schedule-card-body {
  overflow: visible;
}

.schedule-card.is-dragging {
  opacity: 0.35;
}

.schedule-grid.is-dragging .schedule-card {
  pointer-events: none;
}

.schedule-card-popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  box-shadow: 0 0.5rem 1rem var(--border);
  display: grid;
  font-size: 0.8rem;
  gap: 0.2rem;
  left: 0;
  min-width: 12rem;
  padding: 0.75rem;
  position: absolute;
  top: calc(100% + 0.3rem);
  z-index: 8;
}

.schedule-card-popover--up {
  bottom: calc(100% + 0.3rem);
  top: auto;
}

.schedule-card-drag-image {
  left: -10000px;
  max-block-size: 4rem;
  max-inline-size: 15rem;
  overflow: hidden;
  position: fixed;
  top: -10000px;
  width: 15rem;
}

.schedule-mobile-agenda {
  display: grid;
  gap: 1.5rem;
}

.schedule-mobile-day-title {
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  padding-bottom: 0.5rem;
}

.schedule-mobile-card {
  background: color-mix(in srgb, var(--schedule-event-color) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--schedule-event-color) 38%, var(--border));
  border-left: 0.25rem solid var(--schedule-event-color);
  border-radius: 0.5rem;
  padding: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  .schedule-card-body,
  .schedule-grid-cell {
    transition: none;
  }

  .schedule-card-body:hover,
  .schedule-card-body:focus-within {
    transform: none;
  }
}
