/*
 * calendar.css — styles for the calendar feature.
 *
 * Builds on the shared design tokens (--fh-*) and components (.card, .btn,
 * .badge, .form, .page-header) defined in application.css.
 */

/* -------------------------------------------------------------------------- */
/* Toolbar (month nav + new event)                                            */
/* -------------------------------------------------------------------------- */

.cal-toolbar {
  display: flex;
  align-items: center;
  gap: var(--fh-space-3);
  flex-wrap: wrap;
}

.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--fh-space-2);
}

/* -------------------------------------------------------------------------- */
/* Month grid                                                                 */
/* -------------------------------------------------------------------------- */

.cal-card {
  padding: 0;
  overflow: hidden;
}

/* Below ~700px the grid keeps its shape and scrolls horizontally. */
.cal-scroll {
  overflow-x: auto;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-scroll .cal-grid {
  min-width: 640px;
}

.cal-weekdays {
  background: var(--fh-surface-muted);
  border-bottom: 1px solid var(--fh-border);
}

.cal-weekday {
  padding: var(--fh-space-2) var(--fh-space-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fh-text-muted);
  text-align: left;
}

.cal-day {
  min-height: 108px;
  padding: var(--fh-space-2);
  border-right: 1px solid var(--fh-border);
  border-bottom: 1px solid var(--fh-border);
  background: var(--fh-surface);
  display: flex;
  flex-direction: column;
  gap: var(--fh-space-1);
}

/* Remove the trailing edges so the grid sits flush in the card. */
.cal-days .cal-day:nth-child(7n) {
  border-right: none;
}

.cal-day.is-other-month {
  background: var(--fh-surface-muted);
}

.cal-day.is-other-month .cal-day-num {
  color: var(--fh-text-muted);
}

.cal-day.is-today {
  background: var(--fh-accent-soft);
  box-shadow: inset 0 0 0 2px var(--fh-accent);
}

.cal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fh-text);
}

.cal-day.is-today .cal-day-num {
  color: var(--fh-accent-dark);
}

/* The subtle "+" affordance, revealed on hover / focus. */
.cal-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--fh-radius-pill);
  font-size: 0.8rem;
  line-height: 1;
  color: var(--fh-text-muted);
  background: transparent;
  opacity: 0;
  transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.cal-day:hover .cal-add,
.cal-day:focus-within .cal-add,
.cal-add:focus-visible {
  opacity: 1;
}

.cal-add:hover {
  text-decoration: none;
  color: var(--fh-surface);
  background: var(--fh-accent);
}

/* -------------------------------------------------------------------------- */
/* Event chips inside a day cell                                              */
/* -------------------------------------------------------------------------- */

.cal-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-chip {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px var(--fh-space-2);
  border-radius: var(--fh-radius-sm);
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
}

.cal-chip:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.cal-chip-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex: none;
}

.cal-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Timed events: quiet accent-tinted pill with a colored leading edge. */
.cal-chip.is-timed {
  color: var(--fh-accent-dark);
  background: var(--fh-accent-soft);
  border-left: 3px solid var(--fh-accent);
}

/* All-day events: solid terracotta band so they read differently at a glance. */
.cal-chip.is-allday {
  color: var(--fh-surface);
  background: var(--fh-terracotta);
}

/* -------------------------------------------------------------------------- */
/* Event show page                                                            */
/* -------------------------------------------------------------------------- */

.event-details {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--fh-space-4);
}

.event-detail dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fh-text-muted);
  margin-bottom: var(--fh-space-1);
}

.event-detail dd {
  margin: 0;
  color: var(--fh-text);
}

.event-description {
  white-space: normal;
}

.event-description p {
  margin: 0 0 var(--fh-space-2);
}

.event-creator {
  display: inline-flex;
  align-items: center;
  gap: var(--fh-space-2);
}

/* -------------------------------------------------------------------------- */
/* Event form                                                                 */
/* -------------------------------------------------------------------------- */

.event-form .form-row {
  display: flex;
  gap: var(--fh-space-4);
  flex-wrap: wrap;
}

.event-form .form-row .form-group {
  flex: 1 1 200px;
  margin-bottom: 0;
}

.event-form .form-check {
  display: flex;
  align-items: center;
  gap: var(--fh-space-2);
}

.event-form .form-check input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.event-form .form-check label {
  margin: 0;
}
