/*
 * Meetings — page file for the meeting views: the details card, the drawer
 * list (calendar/agendas) and the meeting form. They open in the calendar's
 * dialogs, or as pages of their own without JavaScript.
 */

/* The dialogs' frames fill them, so header, body and footer lay out. */
#meeting_form_dialog > turbo-frame,
#meeting_card_dialog > turbo-frame,
#meeting_drawer_dialog > turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ---- Details card: a popover beside the meeting on desktop ---- */

/* A popover, not a modal page: no dimming (scoped to beat shared/dialog.css). */
dialog.sheet.meeting-card::backdrop {
  background: transparent;
}

/* Scoped with .sheet so it beats the full-screen dialog.sheet[open] rule in
   shared/dialog.css, which loads after this file. */
@media (min-width: 640px) {
  dialog.sheet.meeting-card[open] {
    inset: 0;
    margin: auto;
    width: 340px;
    height: fit-content;
    max-height: 80dvh;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-comfortable);
    box-shadow: var(--shadow-dialog);
  }
}

.meeting-card__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-4);
  overflow-y: auto;
}

.meeting-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.meeting-card__dot {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  background-color: var(--event-color);
  border-radius: var(--radius-subtle);
}

.meeting-card__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}

.meeting-card__close,
.meeting-card__back {
  flex-shrink: 0;
  width: 36px;
  min-height: 36px;
  height: 36px;
}

.meeting-card__facts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
}

.meeting-card__fact {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: var(--space-3);
  align-items: start;
}

.meeting-card__fact dt {
  padding-top: 2px;
  color: var(--color-comment);
}

.meeting-card__fact dd {
  margin: 0;
  font-size: var(--text-md);
}

.meeting-card__note {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-comment);
}

.meeting-card__guests {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.meeting-card__guests .meeting-card__note {
  display: inline;
}

.meeting-card__description p {
  margin: 0 0 var(--space-1);
}

/* ---- Drawer list (stack "+N", Month "+N more") ---- */

.agenda {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agenda__link {
  display: grid;
  grid-template-columns: 12px auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2);
  color: var(--color-foreground);
  text-decoration: none;
  border-radius: var(--radius-standard);
}

.agenda__link:hover {
  text-decoration: none;
  background-color: var(--color-selection);
}

.agenda__swatch {
  width: 12px;
  height: 12px;
  background-color: var(--event-color);
  border-radius: var(--radius-subtle);
}

.agenda__time {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-comment);
}

.agenda__title {
  min-width: 0;
  font-weight: var(--weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda__flag {
  color: var(--color-red);
}

.agenda__item--past {
  opacity: 0.6;
}

/* ---- Meeting form ---- */

@media (min-width: 640px) {
  /* Fits its content (a centered dialog with inset 0 would otherwise stretch). */
  dialog#meeting_form_dialog.sheet--centered[open] {
    width: min(520px, calc(100vw - var(--space-8)));
    height: fit-content;
    max-height: 90dvh;
  }
}

.meeting-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.meeting-form__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.meeting-form__title {
  font-size: var(--text-xl);
}

.meeting-form__when {
  margin: 0;
  padding: 0;
  border: 0;
}

.meeting-form__zone {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--color-comment);
}

.meeting-form__times {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.meeting-form__time {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.meeting-form__sublabel {
  font-size: var(--text-sm);
  color: var(--color-comment);
}

@media (min-width: 640px) {
  .meeting-form__times {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.meeting-form__end-date {
  margin-top: var(--space-2);
  font-size: var(--text-md);
}

.meeting-form__end-date summary {
  color: var(--color-purple);
  cursor: pointer;
}

.meeting-form__end-date[open] summary {
  margin-bottom: var(--space-2);
}

.meeting-form__color {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.meeting-form__color-input {
  width: 56px;
  height: 36px;
  padding: 2px;
  background: var(--color-deep-night);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-subtle);
}

.meeting-form__description {
  min-height: 72px;
  resize: vertical;
}

.meeting-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.meeting-form__actions .btn {
  width: auto;
}

/* Guest picker: shared/people_picker.css */

/* ---- Card actions (creator only) ---- */

.meeting-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-subtle);
}

.meeting-card__actions form {
  display: contents;
}

.meeting-card__actions .btn {
  width: auto;
}

.meeting-card__delete:hover {
  color: var(--color-red);
}

/* ---- Repeat rule and scope ---- */

.meeting-form__repeat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  border: 0;
}

.meeting-form__repeat[hidden] {
  display: none;
}

.meeting-form__ends {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.meeting-form__end-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
}

.meeting-form__end-option input[type="radio"],
.meeting-form__scope-option input {
  accent-color: var(--color-purple);
}

.meeting-form__end-input {
  width: auto;
  min-height: 36px;
  padding: var(--space-1) var(--space-2);
}

.meeting-form__count {
  width: 80px;
}

.meeting-form__scope {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: var(--space-3) var(--space-4) 0;
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
}

.meeting-form__scope-option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
}

.meeting-card__actions {
  flex-wrap: wrap;
}

.meeting-card__delete-scope:hover {
  color: var(--color-red);
}
