/* ============================================================
   McPherson Lab Calendar – Custom Styles
   ============================================================ */

#quarto-header,
#quarto-header .navbar {
  background: linear-gradient(135deg, #003366 0%, #004080 50%, #003366 100%);
}

/* Full-width calendar area */
.calendar-wrap {
  max-width: none;
  width: 100vw;
  box-sizing: border-box;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 24px 40px;
}

.calendar-layout,
.calendar-layout.page-columns {
  display: grid;
  grid-template-columns: minmax(220px, 25%) minmax(0, 50%) minmax(220px, 25%);
  gap: 20px;
  align-items: start;
  margin-bottom: 36px;
}

.calendar-sidebar {
  min-width: 0;
}

.calendar-sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calendar-layout.page-columns > * {
  grid-column: auto !important;
}

.calendar-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  padding: 18px;
}

.calendar-panel h2,
.calendar-panel h3,
.agenda-group h3,
.agenda-group h4,
.agenda-done-wrapper h3 {
  margin: 0;
}

.calendar-panel h2,
.calendar-panel h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.calendar-panel-note {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: #6c757d;
}

.calendar-main {
  min-width: 0;
  grid-column: 2 !important;
}

.calendar-sidebar-left {
  grid-column: 1 !important;
}

.calendar-sidebar-right {
  grid-column: 3 !important;
}

/* FullCalendar overrides */
#calendar {
  margin-top: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  padding: 12px;
}

.fc .fc-toolbar-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.fc .fc-event {
  cursor: pointer;
  font-size: 0.78rem;
  padding: 1px 3px;
  border-radius: 3px;
  border: none;
}

.fc .fc-event:hover {
  opacity: 0.85;
}

.calendar-error {
  margin: 0;
  padding: 24px 16px;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  text-align: center;
  color: #6b7280;
  font-size: 0.92rem;
}

/* Category filter bar */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
  align-items: stretch;
}

.filter-bar label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: opacity 0.15s;
}

.filter-bar label:hover { opacity: 0.8; }

.filter-bar label.filter-nih { background: #fde7d6; border-color: #BF5700; color: #5c2500; }
.filter-bar label.filter-trainee { background: rgba(102,16,242,0.08); border-color: rgba(102,16,242,0.35); color: #3d0a91; }
.filter-bar label.filter-conference { background: #cfe2ff; border-color: #0d6efd; color: #052c65; }
.filter-bar label.filter-abstract { background: rgba(13,202,240,0.08); border-color: rgba(13,202,240,0.3); color: #003640; }
.filter-bar label.filter-cfp { background: #f8d7da; border-color: #dc3545; color: #58151c; }
.filter-bar label.filter-lablife { background: #d1e7dd; border-color: #198754; color: #0a3622; }
.filter-bar label.filter-venue { background: #e2d9f3; border-color: #6f42c1; color: #2c0d6b; }
.filter-bar label.filter-all { background: #e2e3e5; border-color: #6c757d; color: #212529; }

.filter-bar input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: inherit;
  flex-shrink: 0;
}

/* Legend dots */
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.agenda-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.agenda-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-group + .agenda-group,
.agenda-done-wrapper {
  padding-top: 18px;
  border-top: 1px solid #eef0f3;
}

.agenda-group h3,
.agenda-group h4,
.agenda-done-wrapper h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
}

.agenda-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  padding: 12px;
}

.agenda-item-done {
  background: #f3f4f6;
}

.agenda-item-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.agenda-item-content {
  min-width: 0;
}

.agenda-item-title {
  display: inline-block;
  color: #111827;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

a.agenda-item-title:hover {
  text-decoration: underline;
}

.agenda-item-done .agenda-item-title {
  color: #4b5563;
}

.agenda-item-meta,
.agenda-item-detail,
.agenda-empty {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: #6b7280;
  line-height: 1.4;
}

.agenda-item-projects {
  margin-top: 8px;
}

.agenda-item-projects-label,
.agenda-item-projects-empty {
  margin: 0;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
}

.agenda-item-projects-label {
  font-weight: 600;
}

.agenda-item-project-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agenda-item-project {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-size: 0.8rem;
  line-height: 1.4;
}

.agenda-item-project-name {
  color: #374151;
  font-weight: 500;
  text-decoration: none;
}

a.agenda-item-project-name:hover {
  text-decoration: underline;
}

.agenda-item-project-completion {
  color: #6b7280;
}

.agenda-action {
  border: 1px solid #0d6efd;
  background: #0d6efd;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.agenda-action:hover {
  opacity: 0.92;
}

.agenda-action-secondary {
  border-color: #6b7280;
  background: #fff;
  color: #374151;
}

/* Modal overlay */
#event-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}

#event-modal-overlay.open {
  display: flex;
}

#event-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  padding: 28px 32px;
  max-width: 520px;
  width: 92%;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 9999;
}

#event-modal h4 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.1rem;
  line-height: 1.3;
}

#event-modal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

#event-modal table td {
  padding: 5px 8px;
  vertical-align: top;
  border-bottom: 1px solid #f0f0f0;
}

#event-modal table td:first-child {
  font-weight: 600;
  white-space: nowrap;
  width: 110px;
  color: #555;
}

#event-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  line-height: 1;
}

#event-modal-close:hover { color: #222; }

/* Color bar on modal header */
#event-modal-colorbar {
  height: 5px;
  border-radius: 4px 4px 0 0;
  margin: -28px -32px 18px;
}

/* Projects table */
#projects-section,
#unlinked-cfps-section {
  margin-top: 36px;
}

#projects-section h2,
#unlinked-cfps-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.projects-note {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: #6c757d;
}

.projects-table-wrapper {
  overflow-x: auto;
}

.projects-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 0.88rem;
}

.projects-table thead {
  background: #f3f4f6;
}

.projects-table th,
.projects-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #eef0f3;
}

.projects-table th {
  font-weight: 600;
  color: #374151;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.table-sort:hover,
.table-sort[aria-pressed="true"] {
  color: #111827;
}

.sort-indicator {
  font-size: 0.8em;
}

.projects-table tbody tr:hover {
  background: #f9fafb;
}

.projects-table tbody tr.past-deadline-row {
  background: #f3f4f6;
}

.projects-table tbody tr.past-deadline-row:hover {
  background: #e5e7eb;
}

.projects-loading,
.projects-error {
  text-align: center;
  color: #6c757d;
  padding: 16px;
}

.completion-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #374151;
}

/* Responsive */
@media (max-width: 1100px) {
  .calendar-layout,
  .calendar-layout.page-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #calendar {
    padding: 8px;
  }

  .agenda-item-header {
    flex-direction: column;
  }

  .agenda-action {
    width: 100%;
  }

  .filter-bar label { font-size: 0.78rem; padding: 6px 8px; }
  .fc .fc-toolbar-title { font-size: 1rem; }
}
