/* ==========================================================================
   Pack 874 Unified Calendar (Staging Styles)
   Scoped completely under #cal-app to prevent theme collisions
   ========================================================================== */

#cal-app {
  margin: 1.5rem 0 3rem 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#cal-app * {
  box-sizing: border-box;
}

#cal-app .app-wrapper {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

/* Header & Controls */
#cal-app .cal-header {
  background: #1e293b;
  color: #ffffff;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

#cal-app .cal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  letter-spacing: 1px;
  line-height: 1;
  color: #ffffff;
}

#cal-app .cal-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.25rem;
}

#cal-app .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#cal-app .nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#cal-app .nav-btn,
#cal-app .tool-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff !important;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: none;
  height: auto;
  line-height: normal;
  text-decoration: none;
  transition: all 0.2s ease;
}

#cal-app .nav-btn:hover,
#cal-app .tool-btn:hover,
#cal-app .tool-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff !important;
}

#cal-app .month-label {
  font-weight: 600;
  min-width: 140px;
  text-align: center;
  font-size: 1.05rem;
  color: #ffffff;
}

/* Collapsible Filter Panel */
#cal-app .filter-panel {
  display: none;
  background: #f8fafc;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

#cal-app .filter-panel.open {
  display: block;
}

#cal-app .filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

#cal-app .filter-row:last-child {
  margin-bottom: 0;
}

#cal-app .filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  min-width: 50px;
}

#cal-app .filter-chip {
  background: #e2e8f0;
  color: #475569;
  border: none;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  height: auto;
  line-height: normal;
  box-shadow: none;
  transition: all 0.15s ease;
}

#cal-app .filter-chip.active {
  background: #003f87;
  color: #ffffff;
}

#cal-app .filter-reset {
  background: transparent;
  border: none;
  color: #2563eb;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0 0.5rem;
  height: auto;
  line-height: normal;
  box-shadow: none;
}

/* 7-Column Month Grid View */
#cal-app .day-names {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #475569;
  text-transform: uppercase;
}

#cal-app .day-name {
  padding: 0.6rem 0;
}

#cal-app .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-collapse: collapse;
}

#cal-app .cal-day {
  min-height: 105px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.4rem;
  position: relative;
  background: #ffffff;
}

#cal-app .cal-day:nth-child(7n) {
  border-right: none;
}

#cal-app .cal-day.other-month {
  background: #f8fafc;
  color: #94a3b8;
}

#cal-app .cal-day.today {
  background: #eff6ff;
}

#cal-app .cal-day.today .day-num {
  background: #2563eb;
  color: #ffffff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#cal-app .day-num {
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 0.35rem;
}

#cal-app .day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#cal-app .event-chip {
  font-size: 0.7rem;
  color: #ffffff;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.25;
}

#cal-app .more-link {
  font-size: 0.7rem;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  margin-top: 2px;
  display: inline-block;
}

/* Agenda View */
#cal-app #agendaView {
  padding: 1.5rem;
}

#cal-app .agenda-item {
  display: flex;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e2e8f0;
}

#cal-app .agenda-item:last-child {
  border-bottom: none;
}

#cal-app .agenda-date {
  text-align: center;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  min-width: 60px;
}

#cal-app .agenda-day {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

#cal-app .agenda-month {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

#cal-app .agenda-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

#cal-app .agenda-meta {
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

#cal-app .pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}

/* Modals */
/* --- Modal Description Cleanups --- */

/* 1. Remove HTML5 UP default borders and fix links */
.modal-desc a,
.modal a {
  border-bottom: none !important;
  text-decoration: underline !important;
  color: #0b57d0;
  word-break: break-all;
}

/* 2. Format Shift & Sign-up Tables */
.modal-desc table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
  background: #ffffff;
}

.modal-desc th,
.modal-desc td {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  line-height: 1.35;
}

.modal-desc tr:nth-child(even) {
  background-color: #f8fafc;
}

/* 3. Text, Spacing & Lists */
.modal-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #334155;
  overflow-wrap: break-word;
}

.modal-desc p {
  margin: 0 0 10px 0;
}

.modal-desc ul, .modal-desc ol {
  padding-left: 20px;
  margin: 8px 0;
}

/* Spinner */
#cal-app .spinner {
  border: 3px solid #e2e8f0;
  border-top: 3px solid #2563eb;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.5rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
