/* ========================================
   LITURGICAL CALENDAR — calendar.css
   ======================================== */

/* ---------- Calendar link button ---------- */
.calendar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  margin: 16px 0;
  border: 1.5px solid var(--color-border, #e0d8cf);
  border-radius: 12px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #2c2c2c);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-link:hover,
.calendar-link:active {
  background: var(--color-hover, #f5f0eb);
  border-color: var(--liturgical-color, #4a7c59);
}

/* ---------- Calendar header ---------- */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}

.calendar-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text, #2c2c2c);
  margin: 0;
  text-transform: capitalize;
}

.calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--color-surface, #fff);
  color: var(--color-text, #2c2c2c);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.2s;
}

.calendar-nav-btn:hover,
.calendar-nav-btn:active {
  background: var(--color-hover, #f5f0eb);
}

/* ---------- Weekday labels ---------- */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.calendar-weekday {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted, #888);
  padding: 6px 0;
  letter-spacing: 0.5px;
}

/* ---------- Calendar grid ---------- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

/* ---------- Day cell ---------- */
.calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: var(--color-surface, #fff);
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s ease;
  min-height: 44px;
}

.calendar-day:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
  pointer-events: none;
}

.calendar-day.empty:hover {
  transform: none;
  box-shadow: none;
}

/* Day number */
.cal-day-num {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text, #2c2c2c);
  line-height: 1;
  z-index: 1;
}

.calendar-day.is-sunday .cal-day-num {
  font-weight: 800;
}

/* Today ring */
.calendar-day.is-today {
  box-shadow: 0 0 0 2.5px #c9a930;
}

/* Liturgical color dot */
.cal-color-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 3px;
  z-index: 1;
}

/* Tinted backgrounds for ranks */
.calendar-day.rank-solemnity {
  background: rgba(201, 176, 55, 0.12);
}

.calendar-day.rank-feast {
  background: rgba(201, 176, 55, 0.07);
}

/* Liturgical color backgrounds (subtle) */
.calendar-day.color-green  { background-color: rgba(74, 124, 89, 0.06); }
.calendar-day.color-violet { background-color: rgba(107, 63, 160, 0.08); }
.calendar-day.color-white  { background-color: rgba(201, 176, 55, 0.06); }
.calendar-day.color-red    { background-color: rgba(178, 34, 34, 0.07); }
.calendar-day.color-rose   { background-color: rgba(212, 116, 138, 0.08); }

/* Solemnities and feasts override */
.calendar-day.rank-solemnity.color-white  { background-color: rgba(201, 176, 55, 0.14); }
.calendar-day.rank-solemnity.color-red    { background-color: rgba(178, 34, 34, 0.14); }
.calendar-day.rank-feast.color-white      { background-color: rgba(201, 176, 55, 0.10); }
.calendar-day.rank-feast.color-red        { background-color: rgba(178, 34, 34, 0.10); }

/* ---------- Day detail modal ---------- */
.calendar-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: calFadeIn 0.2s ease;
}

.calendar-modal {
  background: var(--color-surface, #fff);
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: calSlideUp 0.25s ease;
}

.calendar-modal-date {
  font-size: 0.8rem;
  color: var(--color-muted, #888);
  margin-bottom: 4px;
  text-transform: capitalize;
}

.calendar-modal-celebration {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text, #2c2c2c);
  margin-bottom: 12px;
  line-height: 1.3;
}

.calendar-modal-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.calendar-modal-color .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.calendar-modal-saint {
  font-size: 0.9rem;
  color: var(--color-text, #2c2c2c);
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--color-hover, #f5f0eb);
  border-radius: 8px;
}

.calendar-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-modal-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.calendar-modal-actions button:active {
  opacity: 0.7;
}

.cal-btn-office {
  background: var(--liturgical-color, #4a7c59);
  color: #fff;
}

.cal-btn-mass {
  background: var(--color-hover, #f5f0eb);
  color: var(--color-text, #2c2c2c);
  border: 1.5px solid var(--color-border, #e0d8cf) !important;
}

.calendar-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--color-hover, #f5f0eb);
  color: var(--color-muted, #888);
  font-size: 1.2rem;
  cursor: pointer;
  position: absolute;
  top: 12px;
  right: 12px;
}

.calendar-modal {
  position: relative;
}

/* ---------- Legend ---------- */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 16px 0 8px;
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--color-muted, #888);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Loading ---------- */
.calendar-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--color-muted, #888);
  font-size: 0.9rem;
}

/* ---------- Animations ---------- */
@keyframes calFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes calSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes calGridAppear {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.calendar-grid {
  animation: calGridAppear 0.3s ease;
}

/* ---------- Dark theme overrides ---------- */
.dark .calendar-day {
  background: var(--color-surface, #1e1e1e);
}

.dark .calendar-day.color-green  { background-color: rgba(74, 124, 89, 0.12); }
.dark .calendar-day.color-violet { background-color: rgba(107, 63, 160, 0.15); }
.dark .calendar-day.color-white  { background-color: rgba(201, 176, 55, 0.10); }
.dark .calendar-day.color-red    { background-color: rgba(178, 34, 34, 0.12); }
.dark .calendar-day.color-rose   { background-color: rgba(212, 116, 138, 0.12); }

.dark .calendar-modal {
  background: var(--color-surface, #1e1e1e);
}

.dark .calendar-nav-btn {
  background: var(--color-surface, #1e1e1e);
}
