/* ============ Events Calendar page (.pg-events) ============ */

/* --- category colours (used by chips, dots, badges, legend) --- */
.pg-events .ev-c-academic { --evc: var(--p-600); --evc-bg: var(--p-100); }
.pg-events .ev-c-exam     { --evc: var(--g-700); --evc-bg: var(--g-100); }
.pg-events .ev-c-holiday  { --evc: var(--n-500); --evc-bg: var(--fill-2); }
.pg-events .ev-c-social   { --evc: var(--p-400); --evc-bg: var(--p-100); }
.pg-events .ev-c-sports   { --evc: var(--p-500); --evc-bg: var(--p-100); }
.pg-events .ev-c-deadline { --evc: var(--g-700); --evc-bg: var(--g-100); }
.pg-events .ev-c-workshop { --evc: var(--p-700); --evc-bg: var(--p-100); }

/* --- header / month nav --- */
.pg-events .ev-nav { gap: 8px; flex-wrap: nowrap; }
.pg-events .ev-month-title {
  margin: 0 4px; min-width: 172px; text-align: center; font-size: 18px; white-space: nowrap;
}

/* --- legend / filter chips --- */
.pg-events .ev-legend { margin-bottom: 16px; }
.pg-events .ev-lchip { display: inline-flex; align-items: center; gap: 7px; }

/* --- two-column layout (calendar | upcoming) --- */
.pg-events .ev-layout {
  display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
}

/* --- calendar grid --- */
.pg-events .ev-week-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px;
}
.pg-events .ev-week-head span {
  text-align: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.pg-events .ev-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pg-events .ev-cell {
  min-height: 88px; border: 1px solid var(--line); border-radius: 8px; padding: 5px;
  display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden;
  background: var(--card);
}
.pg-events .ev-cell.ev-has { cursor: pointer; }
.pg-events .ev-cell.ev-has:hover { border-color: var(--indigo-3); background: var(--fill); }
.pg-events .ev-out { background: transparent; border-style: dashed; opacity: .35; }
.pg-events .ev-daynum {
  font-size: 11.5px; font-weight: 700; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 50%; flex: none;
}
.pg-events .ev-today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.pg-events .ev-today .ev-daynum { background: var(--gold); color: var(--indigo); }

.pg-events .ev-cell-evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pg-events .ev-chip {
  display: flex; align-items: center; gap: 5px; border: 0; border-radius: 6px;
  background: var(--evc-bg, var(--accent-tint)); color: var(--evc, var(--indigo-3));
  padding: 2px 6px; font-family: inherit; font-size: 10.8px; font-weight: 700;
  cursor: pointer; min-width: 0; max-width: 100%; text-align: left; line-height: 1.5;
}
.pg-events .ev-chip-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.pg-events .ev-chip-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--evc, var(--indigo)); flex: none;
}
.pg-events .ev-more { font-size: 10px; font-weight: 700; color: var(--muted); padding-left: 2px; }

/* --- category badge (detail modal, upcoming rows) --- */
.pg-events .ev-badge { text-transform: capitalize;
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; text-transform: capitalize; white-space: nowrap;
  background: var(--evc-bg, var(--accent-tint)); color: var(--evc, var(--indigo-3));
}

/* --- upcoming list --- */
.pg-events .ev-up-row { cursor: pointer; align-items: flex-start; }
.pg-events .ev-up-row:hover .ev-up-title { color: var(--indigo-3); }
.pg-events .ev-datesq {
  width: 46px; height: 50px; border-radius: 10px; background: var(--accent-tint); color: var(--indigo-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none;
}
.pg-events .ev-dsq-day { font-size: 18px; font-weight: 800; line-height: 1.1; }
.pg-events .ev-dsq-mon {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
}
.pg-events .ev-up-title {
  font-weight: 700; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.pg-events .ev-up-desc {
  font-size: 12.5px; color: var(--muted); margin-top: 6px; white-space: pre-line;
}
.pg-events .ev-expand {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; cursor: pointer;
  color: var(--muted); flex: none; margin-top: 3px;
}
.pg-events .ev-expand svg { width: 15px; height: 15px; transition: transform .15s ease; }
.pg-events .ev-expand.open svg { transform: rotate(90deg); }
.pg-events .ev-expand:hover { border-color: var(--indigo-3); color: var(--indigo-3); }

/* --- detail modal rows --- */
.pg-events .ev-detail-row {
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 8px; font-size: 13.5px;
}
.pg-events .ev-detail-row svg { color: var(--muted); flex: none; margin-top: 2px; }
.pg-events .ev-detail-desc { white-space: pre-line; margin-top: 10px; margin-bottom: 0; }

/* --- day list modal rows --- */
.pg-events .ev-day-row {
  background: none; border: 0; border-bottom: 1px solid var(--line); width: 100%;
  text-align: left; cursor: pointer; font-family: inherit; font-size: inherit; color: inherit;
  display: flex; gap: 12px; align-items: center; padding: 12px 4px;
}
.pg-events .ev-day-row:last-child { border-bottom: 0; }
.pg-events .ev-day-row:hover .list-title { color: var(--indigo-3); }

/* --- responsive --- */
@media (max-width: 980px) {
  .pg-events .ev-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .pg-events .ev-month-title { min-width: 0; font-size: 15.5px; }
  .pg-events .ev-cal-card { padding: 12px 10px; }
  .pg-events .ev-cell { min-height: 50px; padding: 3px 2px; align-items: center; gap: 2px; }
  .pg-events .ev-cell-evs {
    flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; align-items: center;
  }
  .pg-events .ev-chip { padding: 0; background: none; border-radius: 0; }
  .pg-events .ev-chip-label { display: none; }
  .pg-events .ev-more { font-size: 9px; padding: 0; }
  .pg-events .ev-daynum { width: 20px; height: 20px; font-size: 10.5px; }
}
