  /* ============================================================
   MBI CE Calendar Styles
   Brand green: #2c5f2d
   
   Note: Colors are set explicitly to override the parent theme
   which can cause light-on-light conflicts.
   ============================================================ */

/* ---- Base / Shared ---- */

#ce-calendar-app {
  --ce-green: #2c5f2d;
  --ce-green-light: #3a7a3b;
  --ce-green-dark: #1e4420;
  --ce-green-bg: #edf4ed;
  --ce-green-border: #c5d8c5;
  --ce-text: #2a2a2a;
  --ce-text-light: #555555;
  --ce-bg: #ffffff;
  --ce-border: #d4d0cb;
  --ce-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --ce-radius: 6px;

  font-family: inherit;
  color: var(--ce-text);
  line-height: 1.6;
}

/* Tighten top spacing on calendar page */
.box.large:has(#ce-calendar-app) {
    padding-top: 2.5em !important;
}

/* Shrink the page header — no subtitle needed on this page */
header.major.special {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

header.major.special h2 {
  margin-bottom: 0 !important;
  padding-bottom: 1.2em !important;
}

/* Fix button vertical text alignment (parent theme resets line-height) */
#ce-calendar-app .ce-cal-nav,
#ce-calendar-app .ce-today-btn,
#ce-calendar-app .ce-toggle-btn {
  line-height: 1 !important;
  vertical-align: middle !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#ce-calendar-app *,
#ce-calendar-app *::before,
#ce-calendar-app *::after {
  box-sizing: border-box;
}

/* Override parent theme text colors within the calendar app */
#ce-calendar-app,
#ce-calendar-app h2,
#ce-calendar-app h3,
#ce-calendar-app h4,
#ce-calendar-app p,
#ce-calendar-app span,
#ce-calendar-app li,
#ce-calendar-app div,
#ce-calendar-app button,
#ce-calendar-app a {
  color: var(--ce-text) !important;
}

/* Restore specific colors after the blanket override */
#ce-calendar-app a:not(.ce-toggle-btn):not(.ce-detail-register):not(.ce-detail-provider-link) {
  color: var(--ce-green) !important;
}

#ce-calendar-app .ce-toggle-btn {
  color: var(--ce-green) !important;
}

#ce-calendar-app .ce-toggle-btn.active {
  color: #ffffff !important;
}

#ce-calendar-app .ce-cal-nav,
#ce-calendar-app .ce-today-btn,
#ce-calendar-app .ce-detail-back {
  color: var(--ce-green) !important;
}

#ce-calendar-app .ce-cal-nav:hover,
#ce-calendar-app .ce-today-btn:hover {
  color: #ffffff !important;
}

/* Headings and labels */
#ce-calendar-app .ce-cal-title,
#ce-calendar-app .ce-card-title,
#ce-calendar-app .ce-detail-title,
#ce-calendar-app .ce-cal-events-title,
#ce-calendar-app .ce-detail-section-title,
#ce-calendar-app .ce-card-cost,
#ce-calendar-app .ce-detail-fact-value.cost {
  color: var(--ce-green-dark) !important;
}

/* Light/muted text */
#ce-calendar-app .ce-contact,
#ce-calendar-app .ce-card-meta li,
#ce-calendar-app .ce-card-hosted,
#ce-calendar-app .ce-detail-fact-label,
#ce-calendar-app .ce-cal-day-number,
#ce-calendar-app .ce-cal-weekdays span {
  color: var(--ce-text-light) !important;
}

/* Other-month day numbers */
#ce-calendar-app .ce-cal-day.other-month .ce-cal-day-number {
  color: #bbb !important;
}

/* Today circle */
#ce-calendar-app .ce-cal-day.today .ce-cal-day-number {
  color: #ffffff !important;
}

/* Event pills */
#ce-calendar-app .ce-cal-event-pill {
  color: #ffffff !important;
}

/* FYI callout */
#ce-calendar-app .ce-detail-fyi {
  color: var(--ce-green-dark) !important;
}

/* Hosted callout */
#ce-calendar-app .ce-detail-hosted {
  color: #4a4236 !important;
}

#ce-calendar-app .ce-detail-hosted strong {
  color: #3a3228 !important;
}

/* Early bird */
#ce-calendar-app .ce-card-early-bird {
  color: #7a5a10 !important;
}

#ce-calendar-app .ce-detail-early-bird-note {
  color: #7a5a10 !important;
}

/* Register button */
#ce-calendar-app .ce-detail-register {
  color: #ffffff !important;
}

#ce-calendar-app .ce-detail-provider-link {
  color: var(--ce-green) !important;
}

/* Provider info */
#ce-calendar-app .ce-detail-provider-info span {
  color: var(--ce-text-light) !important;
}

#ce-calendar-app .ce-detail-provider-info strong {
  color: var(--ce-text) !important;
}

#ce-calendar-app .ce-detail-provider-info a {
  color: var(--ce-green) !important;
}

/* Error state */
#ce-calendar-app .ce-error,
#ce-calendar-app .ce-error p {
  color: #7a2020 !important;
}

/* Loading state */
#ce-calendar-app .ce-loading,
#ce-calendar-app .ce-loading p {
  color: var(--ce-text-light) !important;
}

.ce-contact {
  text-align: center;
  color: var(--ce-text-light);
  margin-top: 2.5em;
  margin-bottom: 0;
  padding-top: 1.5em;
  border-top: 1px solid var(--ce-border);
  font-size: 0.95em;
}

.ce-contact a {
  color: var(--ce-green);
  text-decoration: none;
  font-weight: 600;
}

.ce-contact a:hover {
  text-decoration: underline;
}

/* ---- Toolbar: view toggle left, calendar nav right ---- */

.ce-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  margin-bottom: 1.5em;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #EFECE6;
  padding: 0.75em 0;
  border-bottom: 1px solid var(--ce-border);
}

.ce-view-toggle {
  display: flex;
  gap: 0;
  border: 2px solid var(--ce-green);
  border-radius: var(--ce-radius);
  overflow: hidden;
  flex-shrink: 0;
}

.ce-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.6em 1.4em;
  border: none;
  background: var(--ce-bg);
  color: var(--ce-green);
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  line-height: 1;
}

.ce-toggle-btn + .ce-toggle-btn {
  border-left: 2px solid var(--ce-green);
}

.ce-toggle-btn.active {
  background: var(--ce-green);
  color: #ffffff;
}

.ce-toggle-btn:hover:not(.active) {
  background: var(--ce-green-bg);
}

.ce-toggle-btn svg {
  flex-shrink: 0;
}

/* ---- Loading ---- */

.ce-loading {
  text-align: center;
  padding: 3em 1em;
  color: var(--ce-text-light);
}

.ce-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ce-border);
  border-top-color: var(--ce-green);
  border-radius: 50%;
  margin: 0 auto 1em;
  animation: ce-spin 0.8s linear infinite;
}

@keyframes ce-spin {
  to { transform: rotate(360deg); }
}

/* ---- Error ---- */

.ce-error {
  text-align: center;
  padding: 2em 1em;
  color: #7a2020;
  background: #fdf0f0;
  border: 1px solid #e0b0b0;
  border-radius: var(--ce-radius);
}

/* ============================================================
   CALENDAR GRID VIEW
   ============================================================ */

.ce-cal-nav-group {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.ce-cal-nav-group[hidden] {
  display: none;
}

.ce-cal-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--ce-green-dark);
  margin: 0;
  min-width: 170px;
  text-align: center;
  letter-spacing: 0.01em;
}

.ce-cal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ce-green);
  border-radius: var(--ce-radius);
  background: var(--ce-bg);
  color: var(--ce-green);
  font-size: 1.1em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  line-height: 1;
  padding: 0;
}

.ce-cal-nav:hover {
  background: var(--ce-green);
  color: #ffffff;
}

.ce-today-btn {
  padding: 0.4em 1em;
  border: 2px solid var(--ce-green);
  border-radius: var(--ce-radius);
  background: var(--ce-bg);
  color: var(--ce-green);
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

.ce-today-btn:hover {
  background: var(--ce-green);
  color: #ffffff;
}

.ce-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.8em;
  font-weight: 700;
  color: var(--ce-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.6em;
  border-bottom: 2px solid var(--ce-border);
  margin-bottom: 0;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ce-cal-weekdays span {
  color: var(--ce-text-light);
}

.ce-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border-left: 1px solid var(--ce-border);
  background: var(--ce-bg);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ce-cal-day {
  min-height: 120px;
  min-width: 0;
  overflow: hidden;
  padding: 0.5em;
  border-right: 1px solid var(--ce-border);
  border-bottom: 1px solid var(--ce-border);
  position: relative;
  cursor: default;
  transition: background 0.15s;
  background: var(--ce-bg);
}

.ce-cal-day-number {
  font-size: 0.85em;
  color: var(--ce-text-light);
  font-weight: 500;
}

.ce-cal-day.today .ce-cal-day-number {
  background: var(--ce-green);
  color: #ffffff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.ce-cal-day.other-month {
  background: #f5f4f2;
}

.ce-cal-day.other-month .ce-cal-day-number {
  color: #bbb;
}

.ce-cal-day.has-events {
  cursor: pointer;
}

.ce-cal-day.has-events:hover {
  background: var(--ce-green-bg);
}

.ce-cal-day.selected {
  background: var(--ce-green-bg);
  box-shadow: inset 0 0 0 2px var(--ce-green);
}

.ce-cal-dots {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.ce-cal-event-pill {
  display: block;
  font-size: 0.75em;
  line-height: 1.2;
  color: #ffffff;
  background: var(--ce-green-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
}

.ce-cal-event-pill.external {
  background: #7a6d5d;
  color: #ffffff;
}

/* Calendar events below grid */

.ce-cal-events {
  margin-top: 2em;
  padding-top: 1.5em;
  border-top: 2px solid var(--ce-border);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ce-cal-events-title {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--ce-green-dark);
  margin: 0 0 1em 0;
}

/* ============================================================
   CARD FEED VIEW
   ============================================================ */

.ce-feed-list {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ce-feed-empty {
  text-align: center;
  padding: 3em 1em;
  color: var(--ce-text-light);
}

/* ---- Event Card (shared between feed and calendar day list) ---- */

.ce-card {
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-radius);
  padding: 1.4em 1.6em;
  background: var(--ce-bg);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6em 1.5em;
  align-items: start;
}

.ce-card:hover {
  border-color: var(--ce-green);
  box-shadow: var(--ce-shadow);
}

.ce-card-body {
  min-width: 0;
}

.ce-card-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--ce-green-dark);
  margin: 0 0 0.4em 0;
  line-height: 1.3;
}

.ce-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 1.2em;
  font-size: 0.88em;
  color: var(--ce-text-light);
  margin: 0;
  list-style: none;
  padding: 0;
}

.ce-card-meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0;
  margin: 0;
  color: var(--ce-text-light);
}

/* Override any parent theme list styling */
.ce-card-meta li::before {
  display: none !important;
  content: none !important;
}

.ce-card-aside {
  text-align: right;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4em;
}

.ce-card-cost {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--ce-green-dark);
}

.ce-card-early-bird {
  display: inline-block;
  background: #fdf5e6;
  color: #7a5a10;
  border: 1px solid #e0c878;
  border-radius: 999px;
  padding: 0.2em 0.75em;
  font-size: 0.78em;
  font-weight: 600;
  white-space: nowrap;
}

.ce-card-hosted {
  grid-column: 1 / -1;
  font-size: 0.82em;
  color: var(--ce-text-light);
  font-style: italic;
  margin-top: 0.3em;
  padding-top: 0.6em;
  border-top: 1px solid var(--ce-border);
}

/* ============================================================
   EVENT DETAIL VIEW
   ============================================================ */

.ce-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.5em 0;
  border: none;
  background: none;
  color: var(--ce-green);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 1em;
  max-width: 900px;
}

#ce-detail-content {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ce-detail-back:hover {
  text-decoration: underline;
}

.ce-detail-header {
  margin-bottom: 1em;
}

.ce-detail-title {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--ce-green-dark);
  margin: 0 0 0.3em 0;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: 0;
}

.ce-detail-fyi {
  background: var(--ce-green-bg);
  border-left: 4px solid var(--ce-green);
  padding: 0.75em 1.1em;
  font-size: 0.92em;
  color: var(--ce-green-dark);
  margin: 1.5em 0 0.5em;
  border-radius: 0 var(--ce-radius) var(--ce-radius) 0;
}

.ce-detail-hosted {
  background: #faf5ee;
  border-left: 4px solid #b8a07a;
  padding: 0.75em 1.1em;
  font-size: 0.92em;
  color: #4a4236;
  margin: 1em 0;
  border-radius: 0 var(--ce-radius) var(--ce-radius) 0;
}

.ce-detail-hosted strong {
  color: #3a3228;
}

/* Quick Facts Grid */

.ce-detail-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.2em;
  margin: 1.5em 0;
  padding: 1.4em;
  background: var(--ce-bg);
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-radius);
}

.ce-detail-fact {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.ce-detail-fact-label {
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ce-text-light);
}

.ce-detail-fact-value {
  font-size: 1em;
  font-weight: 600;
  color: var(--ce-text);
  line-height: 1.4;
}

.ce-detail-fact-value.cost {
  color: var(--ce-green-dark);
  font-size: 1.2em;
}

.ce-detail-early-bird-note {
  font-size: 0.82em;
  color: #7a5a10;
  font-weight: 600;
  margin-top: 0.15em;
}

/* Register Button */

.ce-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  margin: 1.5em 0;
  justify-content: space-between;
  align-items: center;
}

.ce-detail-register {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.75em 2em;
  background: var(--ce-green);
  color: #ffffff !important;
  border: 2px solid var(--ce-green);
  border-radius: var(--ce-radius);
  font-size: 1em;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
  font-family: inherit;
  margin-left: auto;
}

.ce-detail-register:hover {
  background: var(--ce-green-dark);
  border-color: var(--ce-green-dark);
  color: #ffffff !important;
  text-decoration: none;
}

.ce-detail-provider-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.75em 1.5em;
  background: var(--ce-bg);
  color: var(--ce-green) !important;
  border: 2px solid var(--ce-green);
  border-radius: var(--ce-radius);
  font-size: 0.95em;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  font-family: inherit;
}

.ce-detail-provider-link:hover {
  background: var(--ce-green-bg);
  text-decoration: none;
}

/* Detail Sections */

.ce-detail-section {
  margin: 2em 0;
}

.ce-detail-section-title {
  font-size: 1em;
  font-weight: 700;
  color: var(--ce-green-dark);
  margin: 0 0 0.6em 0;
  padding-bottom: 0.4em;
  border-bottom: 2px solid var(--ce-green-bg);
  text-transform: none;
  letter-spacing: 0;
}

.ce-detail-section-body {
  font-size: 0.95em;
  line-height: 1.75;
  color: var(--ce-text);
}

/* Provider Info (subtitle position, below title) */

.ce-detail-provider-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 1.5em;
  font-size: 0.88em;
  color: var(--ce-text-light);
  margin-top: 0.25em;
}

.ce-detail-provider-info span {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: var(--ce-text-light);
}

.ce-detail-provider-info strong {
  color: var(--ce-text);
}

.ce-detail-provider-info a {
  color: var(--ce-green);
  text-decoration: none;
}

.ce-detail-provider-info a:hover {
  text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .ce-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75em;
  }

  .ce-view-toggle {
    align-self: center;
  }

  .ce-cal-nav-group {
    justify-content: center;
  }

  .ce-cal-day {
    min-height: 56px;
    padding: 0.3em;
  }

  .ce-cal-day-number {
    font-size: 0.78em;
  }

  .ce-cal-event-pill {
    font-size: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ce-green);
    display: inline-block;
    overflow: hidden;
    padding: 0;
  }

  .ce-cal-event-pill.external {
    background: #7a6d5d;
  }

  .ce-cal-dots {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
  }

  .ce-card {
    grid-template-columns: 1fr;
    gap: 0.5em;
    padding: 1.2em;
  }

  .ce-card-aside {
    flex-direction: row;
    align-items: center;
    gap: 0.75em;
  }

  .ce-detail-facts {
    grid-template-columns: 1fr 1fr;
    padding: 1em;
  }

  .ce-detail-title {
    font-size: 1.25em;
  }

  .ce-detail-actions {
    flex-direction: column;
  }

  .ce-detail-register,
  .ce-detail-provider-link {
    text-align: center;
    justify-content: center;
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .ce-detail-facts {
    grid-template-columns: 1fr;
  }

  .ce-cal-weekdays span {
    font-size: 0.7em;
  }

  .ce-toggle-btn {
    padding: 0.5em 1em;
    font-size: 0.8em;
  }

  .box.large:has(#ce-calendar-app) header.major.special h2 {
    font-size: 1.3em !important;
  }
}
