/* =========================================
   CALENDAR (Desktop + Mobile)
   ========================================= */
.calendar { background: rgba(255,255,255,.35); border: 1px solid rgba(0,0,0,.08); }
.calendar-head {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: rgba(0,0,0,.05); color: rgba(0,0,0,.7); font-weight: 600; gap: 1px;
}
.calendar-head > div { padding: .45rem .5rem; text-align: center; }

.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: rgba(0,0,0,.06);
  min-width: 720px; /* allows horizontal scroll on md if tight */
}
.calendar-cell { min-height: 108px; background: rgba(255,255,255,.55); padding: .35rem; position: relative; }
.calendar-cell--blank { background: transparent; }
.calendar-date { font-size: .95rem; font-weight: 700; color: rgba(0,0,0,.6); margin-bottom: .25rem; }
.calendar-ev {
  background: var(--ghbc-dark-red, #752B2F); color: var(--ghbc-light, #E0D4D1);
  border: 0; padding: .25rem .35rem; border-radius: .35rem; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}
.is-today { outline: 2px solid rgba(0,0,0,.1); }

@media (max-width: 576px) { .calendar-cell { min-height: 88px; } }

/* Event color palette */
.calendar-ev[data-color="red"]    { background: #b91c1c; color: #fff; }
.calendar-ev[data-color="blue"]   { background: #1d4ed8; color: #fff; }
.calendar-ev[data-color="green"]  { background: #15803d; color: #fff; }
.calendar-ev[data-color="yellow"] { background: #a16207; color: #fff; }
.calendar-ev[data-color="purple"] { background: #6d28d9; color: #fff; }
.calendar-ev[data-color="teal"]   { background: #0f766e; color: #fff; }
.calendar-ev[data-color="gray"]   { background: #374151; color: #fff; }

/* Responsive wrappers */
.calendar-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Mobile agenda view */
.calendar-agenda {
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: .5rem;
}
.calendar-agenda .agenda-day {
  display: grid; grid-template-columns: 88px 1fr;
  gap: .75rem; padding: .75rem; border-bottom: 1px solid rgba(0,0,0,.06);
}
.calendar-agenda .agenda-day:last-child { border-bottom: 0; }
.calendar-agenda .agenda-date { display:flex; flex-direction:column; align-items:center; gap:.15rem; }
.calendar-agenda .agenda-date .dow { font-size: .8rem; color: rgba(0,0,0,.6); }
.calendar-agenda .agenda-date .daynum {
  width: 44px; height: 44px; border-radius: 50%; display:grid; place-items:center;
  background: rgba(0,0,0,.06); font-weight: 700; color: rgba(0,0,0,.75);
}
.calendar-agenda .agenda-date .today { background: rgba(29,78,216,.12); outline: 2px solid rgba(29,78,216,.25); }

/* Agenda event buttons (reuse palette) */
.calendar-ev-btn {
  display:block; width:100%; text-align:left; border:0; padding:.5rem .6rem;
  border-radius:.45rem; margin-bottom:.4rem; background: var(--ghbc-dark-red, #752B2F);
  color: var(--ghbc-light, #E0D4D1); cursor:pointer; white-space:normal; line-height:1.25;
}
.calendar-ev-btn:last-child { margin-bottom: 0; }
.calendar-ev-btn[data-color="red"]    { background: #b91c1c; color: #fff; }
.calendar-ev-btn[data-color="blue"]   { background: #1d4ed8; color: #fff; }
.calendar-ev-btn[data-color="green"]  { background: #15803d; color: #fff; }
.calendar-ev-btn[data-color="yellow"] { background: #a16207; color: #fff; }
.calendar-ev-btn[data-color="purple"] { background: #6d28d9; color: #fff; }
.calendar-ev-btn[data-color="teal"]   { background: #0f766e; color: #fff; }
.calendar-ev-btn[data-color="gray"]   { background: #374151; color: #fff; }
.calendar-ev-btn small { display:block; opacity:.95; font-weight:500; margin-top:.15rem; }

/* Event modal: width + below fixed navbar */
#eventModal {
  --bs-modal-width: min(92vw, 640px);
  --bs-modal-margin: calc(var(--nav-h, 64px) + 1rem);
}
#eventModal .modal-dialog { max-width: min(92vw, 640px) !important; width: auto !important; }
#eventModal .modal-content { min-width: 300px; } /* safety floor */
