/* ═══════════════════════════════════════════════════
   Calendar — Pane Layout
   ═══════════════════════════════════════════════════ */

.calendar-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.calendar-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: var(--header-shadow);
  overflow: hidden;
}

/* ── Pane header ── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.calendar-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.calendar-header-icon {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.calendar-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Calendar body ── */
.calendar-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

/* ═══════════════════════════════════════════════════
   EventCalendar Theme
   ═══════════════════════════════════════════════════ */

.calendar-body .ec {
  --ec-bg-color: var(--bg-surface);
  --ec-border-color: var(--border-subtle);
  --ec-today-bg-color: color-mix(in srgb, var(--accent) 6%, var(--bg-surface));
  --ec-highlight-color: color-mix(in srgb, var(--accent) 9%, var(--bg-surface));
  --ec-event-bg-color: var(--accent);
  --ec-event-text-color: #ffffff;
  --ec-now-indicator-color: #e35d5d;
  font-family: inherit;
  font-size: 13px;
  height: 100%;
}

/* Hide the built-in EC toolbar */
.calendar-body .ec-toolbar {
  display: none;
}

/* All-day strip repositioned to bottom of ec-main via JS (repositionAllDay).  *
 * position: sticky; bottom: 0 keeps it pinned to the bottom of the visible    *
 * scroll area so it's always visible without scrolling to the end.            */
.calendar-body .ec-time-grid .ec-main > .ec-all-day {
  grid-area: 3 / 1 / auto / -1;
  position: sticky;
  bottom: 0;
  z-index: 3;
  border-top: 1px solid var(--border-subtle);
  border-bottom: none;
  background: var(--bg-surface-alt);
}

/* Day-of-week column headers */
.calendar-body .ec-col-head,
.calendar-body .ec-col-group {
  background-color: var(--bg-surface-alt);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Today column header */
.calendar-body .ec-col-head.ec-today {
  color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 7%, var(--bg-surface));
}

/* Time-slot labels */
.calendar-body .ec-slot {
  font-size: 11px;
  color: var(--text-muted);
}

/* Pastel event chips — overlay white to lighten any background color */
.calendar-body .ec-event:not(.ec-bg-event) {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.52) !important;
  color: rgba(0, 0, 0, 0.68) !important;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
}

/* Dark-mode pastel correction */
[data-theme="dark"] .calendar-body .ec-event:not(.ec-bg-event) {
  box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.38) !important;
  color: rgba(255, 255, 255, 0.82) !important;
}

/* ═══════════════════════════════════════════════════
   Header Controls
   ═══════════════════════════════════════════════════ */

.calendar-header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Navigation: ‹ Today › ── */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 9px;
  background: var(--page-btn-bg);
  border: 1px solid var(--page-btn-border);
  border-radius: 6px;
  color: var(--page-btn-color);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.calendar-nav-btn svg {
  width: 13px;
  height: 13px;
}

.calendar-nav-btn:hover {
  background: var(--page-btn-hover-bg);
  border-color: var(--page-btn-hover-border);
  color: var(--text-primary);
}

/* ── Date range title ── */
.calendar-range-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 152px;
  text-align: center;
  white-space: nowrap;
}

/* ── View switcher pill (matches sales-tab-bar pattern) ── */
.calendar-view-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.calendar-view-btn {
  height: 24px;
  padding: 0 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.calendar-view-btn:hover {
  color: var(--text-primary);
}

.calendar-view-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

