/**
 * @file
 * Styles for the monthly events calendar (/events/calendar).
 */

.ssuk-event-calendar {
  --ec-purple: #442d72;
  --ec-purple-hover: #5a3d96;
  --ec-purple-light: #6b46c1;
  --ec-border: #e5e7eb;
  --ec-muted: #6b7280;
  --ec-day-pad: 0.5rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ec-purple);
  background: linear-gradient(135deg, #f8f4ff 0%, #ffffff 50%, #f8f4ff 100%);
  padding: 3rem 0;
}

.ec-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.ec-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.ec-title {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  color: var(--ec-purple);
}

.ec-subtitle {
  margin: 0.4rem 0 0;
  color: var(--ec-muted);
  font-size: 1rem;
}

.ec-list-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--ec-purple);
  border-radius: 9999px;
  background: var(--ec-purple);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(68, 45, 114, 0.2);
  transition: background-color 0.2s, color 0.2s, transform 0.3s, box-shadow 0.3s;
}

.ec-list-link:hover {
  background: #fff;
  color: var(--ec-purple);
  border-color: var(--ec-purple);
  border-radius: 9999px;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(68, 45, 114, 0.3);
}

/* Toolbar */
.ec-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ec-month {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  min-width: 12rem;
  text-align: center;
}

.ec-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1px solid var(--ec-purple);
  background: var(--ec-purple);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(68, 45, 114, 0.2);
  transition: background-color 0.2s, color 0.2s, transform 0.3s, box-shadow 0.3s;
}

.ec-nav:hover {
  background: #fff;
  color: var(--ec-purple);
  border-color: var(--ec-purple);
  border-radius: 9999px;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(68, 45, 114, 0.3);
}

.ec-today {
  margin-left: auto;
  padding: 0.5rem 1rem;
  border: 1px solid var(--ec-purple);
  border-radius: 9999px;
  background: var(--ec-purple);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 4px 14px rgba(68, 45, 114, 0.2);
  transition: background-color 0.2s, color 0.2s, transform 0.3s, box-shadow 0.3s;
}

.ec-today:hover {
  background: #fff;
  color: var(--ec-purple);
  border-color: var(--ec-purple);
  border-radius: 9999px;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(68, 45, 114, 0.3);
}

/* Grid */
.ec-grid {
  background: #fff;
  border: 1px solid var(--ec-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px -18px rgba(68, 45, 114, 0.35);
}

.ec-weekdays,
.ec-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.ec-weekday {
  padding: 0.85rem 0.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ec-purple-light);
  background: #faf7ff;
  border-bottom: 1px solid var(--ec-border);
}

.ec-day {
  min-height: 8.5rem;
  padding: var(--ec-day-pad);
  border-right: 1px solid var(--ec-border);
  border-bottom: 1px solid var(--ec-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #fff;
}

.ec-week .ec-day:nth-child(7n) {
  border-right: none;
}

.ec-day.is-out {
  background: #fafafa;
  color: #c4c4c4;
}

.ec-day.is-out .ec-day-num {
  color: #c4c4c4;
}

.ec-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ec-purple);
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  flex: 0 0 auto;
}

.ec-day.is-today .ec-day-num {
  background: var(--ec-purple);
  color: #fff;
}

/* Event chips */
.ec-events {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ec-chip {
  display: block;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.25;
  text-decoration: none;
  color: #fff;
  background: var(--ec-purple);
  border: 1px solid var(--ec-purple);
  border-left: 3px solid rgba(255, 255, 255, 0.4);
  transition: background-color 0.2s, color 0.2s, transform 0.3s, box-shadow 0.3s;
}

.ec-chip:hover {
  background: #fff;
  color: var(--ec-purple);
  border-color: var(--ec-purple);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(68, 45, 114, 0.3);
  position: relative;
  z-index: 1;
}

/* Multi-day spans render as one continuous bar: each day's segment bleeds
   into the cell padding so adjacent segments join across the grid. */
.ec-chip--mid,
.ec-chip--end {
  border-left: none;
}

.ec-chip--start {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
  margin-right: calc(-1 * var(--ec-day-pad) - 1px);
}

.ec-chip--mid {
  border-radius: 0;
  border-right: none;
  margin-left: calc(-1 * var(--ec-day-pad) - 1px);
  margin-right: calc(-1 * var(--ec-day-pad) - 1px);
}

.ec-chip--end {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: calc(-1 * var(--ec-day-pad) - 1px);
}

.ec-chip-time {
  display: block;
  font-weight: 700;
  font-size: 0.68rem;
  opacity: 0.9;
}

.ec-chip-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.ec-chip-extra {
  display: none;
}

.ec-day.is-expanded .ec-chip-extra {
  display: block;
}

.ec-more {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--ec-purple-light);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.1rem 0;
}

.ec-more:hover {
  text-decoration: underline;
}

.ec-day.is-expanded .ec-more {
  display: none;
}

/* Event chips use the brand purple (matching the "Join Now" button). */

/* Responsive */
@media (max-width: 768px) {
  .ssuk-event-calendar {
    padding: 2rem 0;
  }
  .ec-title {
    font-size: 1.75rem;
  }
  .ec-month {
    font-size: 1.2rem;
    min-width: 0;
    flex: 1;
  }
  .ec-day {
    --ec-day-pad: 0.3rem;
    min-height: 6rem;
  }
  .ec-weekday {
    padding: 0.6rem 0.2rem;
    font-size: 0.65rem;
  }
  .ec-chip-title {
    font-size: 0.68rem;
  }
  .ec-chip-time {
    display: none;
  }
}

@media (max-width: 480px) {
  .ec-day {
    min-height: 4.5rem;
  }
  .ec-chip {
    padding: 0.15rem 0.3rem;
  }
}
