/**
 * Calendar — Add student modal (roster + searchable picker)
 */

/* Narrow the shared calendar modal when this panel is open */
#calendarModal:has(#calPanelEnroll:not(.hidden)) > .glass-card {
  max-width: 28rem;
}

.cal-enroll {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.cal-enroll-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.cal-enroll-section--add {
  padding-top: 1.1rem;
  border-top: 1px solid var(--cui-border);
}

.cal-enroll-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.cal-enroll-section__titles {
  min-width: 0;
}

.cal-enroll-section__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cui-text);
  line-height: 1.3;
}

.cal-enroll-section__sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--cui-text-muted);
  line-height: 1.35;
}

.cal-enroll-cap {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--cui-border);
  background: color-mix(in srgb, var(--cui-surface-alt, var(--cui-surface)) 88%, transparent);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cui-text-muted);
  white-space: nowrap;
}

.cal-enroll-cap.is-full {
  color: #b45309;
  border-color: color-mix(in srgb, #f59e0b 45%, var(--cui-border));
  background: color-mix(in srgb, #f59e0b 14%, var(--cui-surface));
}

html[data-theme="dark"] .cal-enroll-cap.is-full,
:root[data-theme="dark"] .cal-enroll-cap.is-full {
  color: #fbbf24;
}

.cal-enroll-loading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px dashed var(--cui-border);
  color: var(--cui-text-muted);
  font-size: 0.8125rem;
}

.cal-enroll-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 1.35rem 1rem;
  border-radius: 0.85rem;
  border: 1px dashed var(--cui-border);
  background: color-mix(in srgb, var(--cui-surface-alt, var(--cui-surface)) 70%, transparent);
}

.cal-enroll-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.25rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cui-accent, #2563eb) 12%, transparent);
  color: var(--cui-accent, #2563eb);
  font-size: 1rem;
}

.cal-enroll-empty__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--cui-text);
}

.cal-enroll-empty__hint {
  margin: 0;
  max-width: 16rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--cui-text-muted);
}

.cal-enroll-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 13.5rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.cal-enroll-roster__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.65rem 0.55rem 0.55rem;
  border: 1px solid var(--cui-border);
  border-radius: 0.8rem;
  background: var(--cui-surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cal-enroll-roster__item:hover {
  border-color: color-mix(in srgb, var(--cui-accent, #2563eb) 28%, var(--cui-border));
  background: color-mix(in srgb, var(--cui-accent, #2563eb) 5%, var(--cui-surface));
}

.cal-enroll-avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cui-accent, #2563eb);
  background: color-mix(in srgb, var(--cui-accent, #2563eb) 14%, transparent);
  text-transform: uppercase;
}

.cal-enroll-roster__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.cal-enroll-roster__name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--cui-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-enroll-roster__meta {
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--cui-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-enroll-roster__actions {
  flex: 0 0 auto;
}

.cal-enroll-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 1.9rem;
  padding: 0.3rem 0.65rem;
  border-radius: 0.55rem;
  border: 1px solid var(--cui-border);
  background: transparent;
  color: var(--cui-text-muted);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.cal-enroll-remove:hover {
  color: #b91c1c;
  border-color: color-mix(in srgb, #ef4444 40%, var(--cui-border));
  background: color-mix(in srgb, #ef4444 10%, transparent);
}

html[data-theme="dark"] .cal-enroll-remove:hover,
:root[data-theme="dark"] .cal-enroll-remove:hover {
  color: #fca5a5;
}

.cal-enroll-remove:disabled {
  opacity: 0.55;
  cursor: wait;
}

.cal-enroll-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cal-enroll-picker {
  position: relative;
}

.cal-enroll-picker__label {
  margin-bottom: 0.4rem;
}

.cal-enroll-picker__control {
  position: relative;
}

.cal-enroll-picker__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cui-text-muted);
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1;
}

.cal-enroll-picker__input {
  width: 100%;
  padding-left: 2.35rem !important;
}

.cal-enroll-picker__menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10080;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--cui-surface);
  border: 1px solid var(--cui-border);
  border-radius: 0.85rem;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
}

html[data-theme="dark"] .cal-enroll-picker__menu,
:root[data-theme="dark"] .cal-enroll-picker__menu {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.cal-enroll-picker__option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.55rem;
  border-radius: 0.65rem;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--cui-text);
  cursor: pointer;
}

.cal-enroll-picker__option:hover,
.cal-enroll-picker__option.is-active {
  background: color-mix(in srgb, var(--cui-accent, #2563eb) 10%, transparent);
}

.cal-enroll-picker__option-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.cal-enroll-picker__option-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-enroll-picker__option-meta {
  font-size: 0.72rem;
  color: var(--cui-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-enroll-picker__option--muted {
  justify-content: center;
  color: var(--cui-text-muted);
  cursor: default;
  pointer-events: none;
  font-size: 0.8125rem;
}

.cal-enroll-hint {
  min-height: 1.1rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--cui-text-muted);
}

.cal-enroll-hint.is-warn,
.cal-enroll-hint.text-amber-300 {
  color: #b45309;
  font-weight: 600;
}

.cal-enroll-other-warn {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(180, 83, 9, 0.35);
  background: rgba(251, 191, 36, 0.12);
  color: #92400e;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.cal-enroll-other-warn[hidden] {
  display: none !important;
}

.cal-enroll-other-warn strong {
  font-weight: 700;
}

.cal-enroll-other-warn__place {
  display: block;
  margin-top: 0.25rem;
  font-weight: 600;
}

html[data-theme="dark"] .cal-enroll-other-warn,
:root[data-theme="dark"] .cal-enroll-other-warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
}

html[data-theme="dark"] .cal-enroll-hint.is-warn,
html[data-theme="dark"] .cal-enroll-hint.text-amber-300,
:root[data-theme="dark"] .cal-enroll-hint.is-warn,
:root[data-theme="dark"] .cal-enroll-hint.text-amber-300 {
  color: #fbbf24;
}

.cal-enroll-form__actions {
  display: flex;
  justify-content: flex-end;
}

.cal-enroll-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.55rem;
  padding: 0.65rem 1.1rem;
  font-weight: 650;
}

.cal-enroll-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Empty-slot hover affordance lives next to this file historically */
.lms-sched-grid-empty--clickable:hover .lms-sched-grid-empty-plus {
  opacity: 0.85;
  color: var(--cui-text);
}
.lms-sched-grid-cell--clickable {
  cursor: pointer;
}
.lms-sched-grid-cell--clickable:hover {
  filter: brightness(0.95);
}
