/* ===== Events calendar ===== */

/* tighten the page padding on the events view to reclaim vertical space
   (scoped via the data attribute this view sets on .page-content) */
.page-content[data-max-events] {
  padding: 14px 28px 16px;
}

.page-content[data-max-events] .page-title-row {
  margin-bottom: 12px;
}

/* single event color for now; a per-course color will replace this in stage 2 */
:root {
  --event-color: #FF6501;
  --event-bg: #fff3ea;
}

/* the calendar fills the viewport height below the header/title so the whole
   month fits without scrolling. the month navigation now lives in the page
   title row, so the calendar only needs to clear the header + title row. */
.calendar {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 132px);
  height: calc(100dvh - 132px);
}

/* month navigation, sitting in the page title row (prev / label / next) */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-month-label {
  font-size: 16px;
  font-weight: 600;
  color: #4a4a4a;
  min-width: 170px;
  text-align: center;
  text-transform: capitalize;
}

.btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* weekday headers (Mon-Fri only) */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #777;
  padding: 0;
}

/* month grid (5 weekday columns). fills remaining height and splits it evenly
   across the week rows so a 4- or 5-week month always fits the viewport. */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 1fr;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

/* a single day cell. min-height:0 lets it shrink; content stays contained */
.calendar-day {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  min-height: 0;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

/* empty placeholder to keep the grid aligned (days from other months / weekends) */
.calendar-day.calendar-day-empty {
  background: transparent;
  border: none;
}

/* past days: visible but read-only */
.calendar-day.calendar-day-past {
  background: #fafafa;
}

/* today's cell highlighted */
.calendar-day.calendar-day-today {
  border-color: var(--color1);
  box-shadow: 0 0 0 1px var(--color1);
}

.calendar-day-number {
  font-size: 11px;
  font-weight: 600;
  color: #4a4a4a;
  line-height: 1.1;
}

.calendar-day-today .calendar-day-number {
  color: var(--color1);
}

/* container for the event slots inside a day. no internal scroll: the cell is
   tall enough to fit the events + add buttons */
.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  margin-top: 1px;
}

/* a created event chip: single line, course name truncated with ellipsis */
.event-chip {
  background: var(--event-bg);
  border-left: 3px solid var(--event-color);
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 12px;
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.event-chip-name {
  font-weight: 600;
  color: #4a4a4a;
  line-height: 1.2;
  padding-right: 14px;
  /* truncate to a single line with ellipsis */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* delete button on an event chip */
.event-chip-delete {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  color: #bbb;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.event-chip-delete:hover {
  color: var(--errorColor);
}

/* "+ Crear evento" button for an empty slot */
.event-add-btn {
  border: 1px dashed #cfcfcf;
  background: transparent;
  border-radius: 5px;
  padding: 3px;
  font-size: 11px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.event-add-btn:hover {
  border-color: var(--color1);
  color: var(--color1);
}

.event-add-btn:focus {
  outline: none;
}

/* selected date shown in the create-event popup */
.event-popup-date {
  margin: 0 0 16px;
  font-size: 13px;
  color: #555;
}

/* responsive: allow horizontal scroll on small screens so cells stay usable */
@media (max-width: 900px) {
  .calendar-weekdays,
  .calendar-grid {
    min-width: 700px;
  }
  .calendar {
    overflow-x: auto;
  }
}
