/* Calendar container */
.calendar-container {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Calendar header with nav */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--primary);
  color: white;
}

.calendar-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  /* The global h1-h5 rule in main.css forces color: var(--ink); without
     this override the month label renders dark-on-dark and disappears. */
  color: white;
  margin: 0;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-nav button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.calendar-nav button:hover {
  background: rgba(255,255,255,0.25);
}

.calendar-nav .btn-today {
  width: auto;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Day-of-week header */
.calendar-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.calendar-dow span {
  text-align: center;
  padding: 0.6rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.calendar-day {
  min-height: 90px;
  padding: 0.4rem;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

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

.calendar-day:hover {
  background: var(--accent-bg);
}

.calendar-day.outside-month {
  background: var(--bg);
  opacity: 0.4;
  cursor: default;
}

.calendar-day.outside-month:hover {
  background: var(--bg);
}

.calendar-day.today {
  background: var(--accent-bg);
}

.calendar-day.today .day-number {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.day-number {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
}

/* Meeting dots */
.day-events {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* Each meeting category gets its own basic shape so dots are distinguishable
   without relying on color alone (helps colorblind users + reads better at
   6–8px on the calendar grid). Default base = circle for NYC Council
   committee meetings; modifier classes override the shape. */
.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.event-dot.hearing {
  background: #6B21A8;
}

.event-dot.stated {
  background: var(--success);
}

/* NY State Senate / Assembly hearings — upward triangle */
.event-dot.state {
  background: #2C5F7A;
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

/* Community board meetings — square */
.event-dot.cb {
  background: #7A6B2C;
  border-radius: 0;
}

/* Saved council member's committee meetings — diamond. Clay color + thin
   ink ring so it still stands out as "your" item even at 6px. */
.event-dot.member {
  background: #C97D1F;
  border-radius: 0;
  transform: rotate(45deg);
  outline: 1px solid var(--ink);
}

/* Legend strip above the calendar grid */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  padding: 0.4rem 0 0.85rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0.75rem;
}
.calendar-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
/* Legend swatches mirror the calendar dot shapes one-for-one so the legend
   actually teaches what each shape means — circle, triangle, square, diamond. */
.calendar-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-legend .legend-dot.committee {
  background: var(--accent);
}
.calendar-legend .legend-dot.state {
  background: #2C5F7A;
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}
.calendar-legend .legend-dot.cb {
  background: #7A6B2C;
  border-radius: 0;
}
.calendar-legend .legend-dot.member {
  background: #C97D1F;
  border-radius: 0;
  transform: rotate(45deg);
  outline: 1px solid var(--ink);
}
.calendar-legend .legend-dot.stated { background: var(--success); }

.event-count {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 0.15rem;
}

/* Day detail panel */
.day-detail {
  display: none;
  background: var(--bg);
  border-top: 2px solid var(--accent);
  padding: 1.5rem;
}

.day-detail.open {
  display: block;
}

.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.day-detail-header h3 {
  font-size: 1.1rem;
  color: var(--primary);
}

.day-detail-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
}

.day-detail-close:hover {
  color: var(--text);
}

/* View toggle */
.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle button {
  padding: 0.4rem 0.8rem;
  border: none;
  background: var(--bg-white);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font);
}

.view-toggle button:not(:last-child) {
  border-right: 1px solid var(--border);
}

.view-toggle button.active {
  background: var(--accent);
  color: white;
}

/* List view */
.meetings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.meeting-date-group {
  margin-bottom: 1.5rem;
}

.meeting-date-group h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.75rem;
}

/* Responsive calendar */
@media (max-width: 768px) {
  .calendar-day {
    min-height: 60px;
    padding: 0.25rem;
  }

  .day-number {
    font-size: 0.75rem;
  }

  .event-dot {
    width: 6px;
    height: 6px;
  }

  .calendar-header {
    padding: 0.75rem 1rem;
  }

  .calendar-header h2 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .calendar-day {
    min-height: 44px;
  }

  .day-events {
    display: none;
  }

  .event-count {
    display: block;
  }

  .calendar-dow span {
    font-size: 0.65rem;
  }
}
