/* ============================================================================
   Community Calendar — Frontend Styles
   Phase 3.1 — Full implementation
   ============================================================================ */

/* ── CSS Custom Properties ───────────────────────────────────────────────── */

:root {
}

#community-calendar,
#community-calendar-create-event {
  --cc-primary:       #4A6FA5;
  --cc-primary-dark:  #3a5a8a;
  --cc-primary-light: #e8f0f9;
  --cc-success:       #28a745;
  --cc-warning:       #ffc107;
  --cc-danger:        #dc3545;
  --cc-bg:            #ffffff;
  --cc-surface:       #f8f9fa;
  --cc-border:        #dee2e6;
  --cc-text:          #212529;
  --cc-text-muted:    #6c757d;
  --cc-today-bg:      #4A6FA5;
  --cc-today-text:    #ffffff;
  --cc-input-bg:      #ffffff;
  --cc-modal-bg:      #ffffff;
  --cc-overlay:       rgba(0, 0, 0, 0.5);
  --cc-radius:        8px;
  --cc-shadow:        0 2px 8px rgba(0, 0, 0, 0.12);
  --cc-font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Dark theme overrides ────────────────────────────────────────────────── */

#community-calendar[data-cc-theme="dark"],
#community-calendar-create-event[data-cc-theme="dark"] {
  --cc-primary:       #6a9fd8;
  --cc-primary-dark:  #5a8fc8;
  --cc-primary-light: #2a3a50;
  --cc-success:       #6bcf7f;
  --cc-warning:       #ffc107;
  --cc-danger:        #f07070;
  --cc-bg:            #1e1e2e;
  --cc-surface:       #2a2a3c;
  --cc-border:        #3a3a50;
  --cc-text:          #e0e0ef;
  --cc-text-muted:    #9090aa;
  --cc-today-bg:      #6a9fd8;
  --cc-today-text:    #1e1e2e;
  --cc-input-bg:      #2a2a3c;
  --cc-modal-bg:      #252535;
  --cc-overlay:       rgba(0, 0, 0, 0.7);
  --cc-shadow:        0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */

.cc-btn-theme-toggle {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       4px 10px;
  font-size:     0.78rem;
  font-family:   inherit;
  color:         var(--cc-text-muted);
  cursor:        pointer;
  transition:    border-color 0.15s, color 0.15s, background 0.15s;
  white-space:   nowrap;
}

.cc-btn-theme-toggle:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
  background:   var(--cc-primary-light);
}

.cc-btn-theme-toggle:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-toolbar-theme {
  margin-left: auto;
  display:     flex;
  align-items: center;
}

/* ── General Reset (scoped) ──────────────────────────────────────────────── */

#community-calendar,
#community-calendar *,
#community-calendar *::before,
#community-calendar *::after,
#community-calendar-create-event,
#community-calendar-create-event *,
#community-calendar-create-event *::before,
#community-calendar-create-event *::after {
  box-sizing: border-box;
}

#community-calendar,
#community-calendar-create-event {
  font-family: var(--cc-font);
  color:       var(--cc-text);
  background:  var(--cc-bg);
  line-height: 1.5;
  position:    relative;
  width:       100%;
  max-width:   100%;
  box-sizing:  border-box;
  padding-top:    var(--cc-pad-top, 0px);
  padding-bottom: var(--cc-pad-bottom, 0px);
  padding-left:  var(--cc-pad-left,  0%);
  padding-right: var(--cc-pad-right, 0%);
  transition:  background 0.2s, color 0.2s;
}

#community-calendar button {
  font-family: inherit;
  cursor:      pointer;
}

#community-calendar a {
  color: var(--cc-primary);
}

/* ── Loading state ───────────────────────────────────────────────────────── */

#community-calendar.cc-loading .cc-calendar-area {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* ── Screen-reader only utility ──────────────────────────────────────────── */

#community-calendar .sr-only {
  position:   absolute;
  width:      1px;
  height:     1px;
  padding:    0;
  margin:     -1px;
  overflow:   hidden;
  clip:       rect(0, 0, 0, 0);
  white-space: nowrap;
  border:     0;
}

/* ============================================================================
   TOOLBAR
   ============================================================================ */

.cc-toolbar {
  display:         flex;
  flex-wrap:       wrap;
  align-items:     center;
  gap:             10px;
  padding:         12px 0 14px;
  border-bottom:   1px solid var(--cc-border);
  margin-bottom:   4px;
}

/* ── View buttons ────────────────────────────────────────────────────────── */

.cc-toolbar-views {
  display:       flex;
  background:    var(--cc-surface);
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  overflow:      hidden;
  flex-shrink:   0;
}

.cc-view-btn {
  background:    transparent;
  border:        none;
  padding:       6px 14px;
  font-size:     0.85rem;
  font-weight:   500;
  color:         var(--cc-text-muted);
  transition:    background 0.15s, color 0.15s;
  white-space:   nowrap;
  outline:       none;
}

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

.cc-view-btn.active,
.cc-view-btn:hover {
  background: var(--cc-primary);
  color:      #fff;
}

.cc-view-btn:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: -2px;
}

/* ── Nav section ─────────────────────────────────────────────────────────── */

.cc-toolbar-nav {
  display:     flex;
  align-items: center;
  gap:         6px;
  flex:        1;
  justify-content: center;
}

.cc-nav-prev,
.cc-nav-next {
  width:         34px;
  height:        34px;
  border-radius: 50%;
  border:        1px solid var(--cc-border);
  background:    var(--cc-bg);
  color:         var(--cc-text);
  font-size:     1.3rem;
  display:       flex;
  align-items:   center;
  justify-content: center;
  transition:    background 0.15s, border-color 0.15s;
  flex-shrink:   0;
}

.cc-nav-prev:hover,
.cc-nav-next:hover {
  background:   var(--cc-primary-light);
  border-color: var(--cc-primary);
  color:        var(--cc-primary-dark);
}

.cc-nav-prev:focus-visible,
.cc-nav-next:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-nav-title {
  display:     flex;
  align-items: center;
  gap:         8px;
}

.cc-nav-label {
  font-size:   1.05rem;
  font-weight: 600;
  white-space: nowrap;
  min-width:   160px;
  text-align:  center;
}

.cc-today-btn {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: 4px;
  padding:       3px 10px;
  font-size:     0.78rem;
  color:         var(--cc-text-muted);
  transition:    border-color 0.15s, color 0.15s;
}

.cc-today-btn:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
}

.cc-today-btn:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* ── Toolbar actions (search + filter) ───────────────────────────────────── */

.cc-toolbar-actions {
  display:     flex;
  align-items: center;
  gap:         8px;
  margin-left: auto;
}

/* Search */

.cc-search-wrap {
  display:     flex;
  align-items: center;
  gap:         6px;
}

/* The magnifying-glass toggle button */
.cc-search-toggle {
  width:         34px;
  height:        34px;
  border-radius: 50%;
  border:        1px solid var(--cc-border);
  background:    var(--cc-bg);
  font-size:     1rem;
  display:       flex;
  align-items:   center;
  justify-content: center;
  transition:    background 0.15s, border-color 0.15s;
  flex-shrink:   0;
}

.cc-search-toggle:hover,
.cc-search-wrap.cc-search-open .cc-search-toggle {
  background:   var(--cc-primary-light);
  border-color: var(--cc-primary);
  color:        var(--cc-primary-dark);
}

.cc-search-toggle:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* Expandable row: input + submit button + "Nur Titel" label */
.cc-search-expandable {
  display:     flex;
  align-items: center;
  gap:         6px;
  flex-shrink: 1;
  min-width:   0;
}

.cc-search-input {
  min-width:     140px;
  border:        1px solid var(--cc-border);
  border-radius: 4px;
  padding:       6px 10px;
  font-size:     0.85rem;
  font-family:   inherit;
  color:         var(--cc-text);
  background:    var(--cc-bg);
}

.cc-search-input:focus {
  outline:        2px solid var(--cc-primary);
  outline-offset: -1px;
  border-color:   var(--cc-primary);
}

/* Submit button inside the expandable row */
.cc-search-submit {
  width:         30px;
  height:        30px;
  border-radius: 4px;
  border:        1px solid var(--cc-primary);
  background:    var(--cc-primary);
  color:         #fff;
  font-size:     0.9rem;
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex-shrink:   0;
  transition:    background 0.15s, border-color 0.15s;
}

.cc-search-submit:hover {
  background:   var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
}

.cc-search-submit:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-search-title-only {
  font-size:   0.78rem;
  color:       var(--cc-text-muted);
  white-space: nowrap;
  display:     flex;
  align-items: center;
  gap:         4px;
  cursor:      pointer;
}

/* Filter button */

.cc-filter-toggle {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       6px 14px;
  font-size:     0.85rem;
  font-weight:   500;
  color:         var(--cc-text-muted);
  display:       flex;
  align-items:   center;
  gap:           6px;
  transition:    border-color 0.15s, color 0.15s, background 0.15s;
}

.cc-filter-toggle:hover,
.cc-filter-toggle.cc-active {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
  background:   var(--cc-primary-light);
}

.cc-filter-toggle:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-filter-count {
  background:    var(--cc-primary);
  color:         #fff;
  border-radius: 10px;
  padding:       1px 6px;
  font-size:     0.7rem;
  font-weight:   700;
  line-height:   1.4;
}

/* Export bar */

.cc-export-bar {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex-wrap:   wrap;
}

.cc-export-month,
.cc-export-6months {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       5px 12px;
  font-size:     0.8rem;
  color:         var(--cc-text-muted);
  transition:    border-color 0.15s, color 0.15s, background 0.15s;
}

.cc-export-month:hover,
.cc-export-6months:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
  background:   var(--cc-primary-light);
}

.cc-export-month:focus-visible,
.cc-export-6months:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* ============================================================================
   FILTER PANEL
   ============================================================================ */

.cc-filter-panel {
  background:    var(--cc-surface);
  border-bottom: 1px solid var(--cc-border);
  padding:       16px;
  display:       grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:           16px;
  margin-bottom: 8px;
}

.cc-filter-section {
  display:        flex;
  flex-direction: column;
  gap:            8px;
}

.cc-filter-label {
  font-size:      0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color:          var(--cc-text-muted);
  font-weight:    600;
}

.cc-filter-pills {
  display:   flex;
  flex-wrap: wrap;
  gap:       6px;
}

.cc-filter-pill {
  padding:       4px 12px;
  border:        1px solid var(--cc-border);
  border-radius: 20px;
  background:    var(--cc-bg);
  cursor:        pointer;
  font-size:     0.8rem;
  color:         var(--cc-text);
  font-family:   inherit;
  transition:    background 0.12s, border-color 0.12s, color 0.12s;
}

.cc-filter-pill:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
}

.cc-filter-pill:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* Three-state pill: include */
.cc-filter-pill--include {
  background:   var(--cc-primary);
  color:        #fff;
  border-color: var(--cc-primary);
}

.cc-filter-pill--include::before {
  content: '✓ ';
}

/* Three-state pill: exclude */
.cc-filter-pill--exclude {
  background:      var(--cc-surface);
  color:           var(--cc-text-muted);
  border-color:    var(--cc-border);
  border-style:    dashed;
  text-decoration: line-through;
}

.cc-filter-pill--exclude::before {
  content: '✗ ';
}

/* Match-mode buttons */
.cc-filter-match-mode {
  display: flex;
  gap:     6px;
}

.cc-match-btn {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       4px 10px;
  font-size:     0.78rem;
  color:         var(--cc-text-muted);
  font-family:   inherit;
  cursor:        pointer;
  transition:    background 0.12s, border-color 0.12s, color 0.12s;
}

.cc-match-btn.active,
.cc-match-btn:hover {
  background:   var(--cc-primary-light);
  border-color: var(--cc-primary);
  color:        var(--cc-primary-dark);
}

.cc-match-btn:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* Dual range slider */
.cc-time-range-wrap {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex-wrap:   wrap;
}

.cc-time-from-label,
.cc-time-to-label {
  font-size:   0.8rem;
  color:       var(--cc-text-muted);
  white-space: nowrap;
  min-width:   38px;
  text-align:  center;
}

.cc-dual-range {
  position: relative;
  flex:     1;
  height:   20px;
  min-width: 100px;
}

.cc-dual-range input[type="range"] {
  position:           absolute;
  width:              100%;
  height:             100%;
  opacity:            1;
  cursor:             pointer;
  pointer-events:     all;
  background:         transparent;
  -webkit-appearance: none;
}

.cc-dual-range input[type="range"].cc-range-to {
  z-index: 2;
}

.cc-dual-range input[type="range"].cc-range-from {
  z-index: 1;
}

.cc-range-track {
  position:      absolute;
  height:        4px;
  background:    var(--cc-border);
  border-radius: 2px;
  top:           50%;
  transform:     translateY(-50%);
  width:         100%;
}

.cc-range-fill {
  position:      absolute;
  height:        100%;
  background:    var(--cc-primary);
  border-radius: 2px;
  left:          0%;
  right:         0%;
}

.cc-range-reset {
  font-size: 0.75rem;
  color:     var(--cc-text-muted);
}

/* "Newly added" (created-within-days) slider — stacked layout: the slider
   sits on its own full-width row, and the label + reset link sit on a
   second row below that can wrap independently. This keeps the row's
   minimum content width to whichever is narrower (the slider's own
   column, or the label/reset pair), so it can never overflow into the
   neighboring filter section the way a single unwrapped row could. */
.cc-days-range-wrap {
  display:        flex;
  flex-direction: column;
  gap:            6px;
}

.cc-days-range {
  width: 100%;
}

.cc-days-range-footer {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             8px;
  flex-wrap:       wrap;
}

.cc-days-range-label {
  font-size: 0.85rem;
  color:     var(--cc-text);
}

.cc-days-range-reset {
  font-size:   0.8rem;
  color:       var(--cc-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Filter actions */
.cc-filter-actions {
  display:     flex;
  align-items: center;
  gap:         10px;
  flex-wrap:   wrap;
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top:  1px solid var(--cc-border);
}

.cc-apply-filters,
.cc-reset-filters {
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       6px 16px;
  font-size:     0.85rem;
  font-family:   inherit;
  cursor:        pointer;
  transition:    background 0.15s, border-color 0.15s, color 0.15s;
}

.cc-apply-filters {
  background: var(--cc-primary);
  border-color: var(--cc-primary);
  color:      #fff;
}

.cc-apply-filters:hover {
  background: var(--cc-primary-dark);
}

.cc-reset-filters {
  background: transparent;
  color:      var(--cc-text-muted);
}

.cc-reset-filters:hover {
  border-color: var(--cc-danger);
  color:        var(--cc-danger);
}

.cc-apply-filters:focus-visible,
.cc-reset-filters:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-active-filter-count {
  font-size: 0.8rem;
  color:     var(--cc-text-muted);
}

/* ============================================================================
   CALENDAR GRID — MONTH & WEEKS VIEWS
   ============================================================================ */

.cc-calendar-area {
  min-height: 400px;
  width:      100%;
  flex:       1;
}

/* Day name header row */
.cc-day-headers {
  display:               grid;
  grid-template-columns: repeat(7, 1fr);
  gap:                   0;
  border-left:           1px solid var(--cc-border);
  border-top:            1px solid var(--cc-border);
  margin-bottom:         0;
}

.cc-day-header {
  border-right:  1px solid var(--cc-border);
  border-bottom: 1px solid var(--cc-border);
  padding:       6px 8px;
  font-size:     0.75rem;
  font-weight:   600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color:         var(--cc-text-muted);
  text-align:    center;
}

/* Month/Weeks grid */
.cc-month-grid,
.cc-weeks-grid {
  display:               grid;
  grid-template-columns: 2rem repeat(7, 1fr);
  gap:                   0;
  border-left:           1px solid var(--cc-border);
}

/* Day cell */
.cc-day-cell {
  border-right:  1px solid var(--cc-border);
  border-bottom: 1px solid var(--cc-border);
  padding:       8px;
  min-height:    100px;
  vertical-align: top;
  cursor:        pointer;
  background:    var(--cc-bg);
  transition:    background 0.1s;
  position:      relative;
  overflow:      hidden;
}

.cc-day-cell:hover {
  background: var(--cc-surface);
}

.cc-weeks-grid .cc-day-cell {
  min-height: 140px;
}

/* Other-month days */
.cc-day-cell.cc-other-month {
  opacity:    0.4;
  background: var(--cc-surface);
}

/* Day number */
.cc-day-number {
  font-size:   0.82rem;
  font-weight: 600;
  color:       var(--cc-text);
  margin-bottom: 4px;
  display:     inline-flex;
  align-items: center;
  justify-content: center;
  width:       24px;
  height:      24px;
  border-radius: 50%;
  line-height:  1;
}

/* Today */
.cc-day-cell.cc-today .cc-day-number {
  background: var(--cc-today-bg);
  color:      var(--cc-today-text);
  font-weight: 700;
}

/* Week view day header label */
.cc-week-day-label {
  font-size:   0.72rem;
  color:       var(--cc-text-muted);
  font-weight: 600;
  display:     block;
  margin-bottom: 2px;
}

/* ── Event bars ──────────────────────────────────────────────────────────── */

.cc-event-bar {
  display:         flex;
  align-items:     center;
  gap:             2px;
  position:        relative;
  height:          18px;
  line-height:     18px;
  padding:         0 5px;
  border-radius:   4px;
  font-size:       0.72rem;
  color:           #fff;
  overflow:        hidden;
  text-overflow:   ellipsis;
  white-space:     nowrap;
  cursor:          pointer;
  margin-bottom:   2px;
  text-decoration: none;
  background:      var(--cc-primary); /* overridden inline per category */
  transition:      filter 0.1s;
}

.cc-event-bar:hover {
  filter: brightness(0.88);
  color:  #fff;
}

.cc-event-bar:focus-visible {
  outline:        2px solid #fff;
  outline-offset: -2px;
}

/* ── Cancellation cross-out patterns ─────────────────────────────────────
   Applied (via classList, in JS) to .cc-event-bar, .cc-day-event-card, and
   .cc-event-category-pill whenever an event's is_canceled flag is true and
   the admin has NOT enabled the solid "override block" mode. The JS helper
   (applyCancelStyling) sets --cc-cancel-thickness and --cc-cancel-color as
   inline custom properties on the element; these rules just consume them
   via a ::after overlay so the underlying category color stays visible
   underneath the cross-out / border treatment.
   All four host selectors above already carry position:relative so this
   absolutely-positioned overlay anchors correctly. ────────────────────── */

.cc-cancel-horizontal::after,
.cc-cancel-diagonal::after,
.cc-cancel-stripes::after {
  content:        '';
  position:       absolute;
  inset:          0;
  pointer-events: none;
  border-radius:  inherit;
}

.cc-cancel-horizontal::after {
  background: linear-gradient(
    to bottom,
    transparent calc(50% - var(--cc-cancel-thickness, 3px) / 2),
    var(--cc-cancel-color, #000) calc(50% - var(--cc-cancel-thickness, 3px) / 2),
    var(--cc-cancel-color, #000) calc(50% + var(--cc-cancel-thickness, 3px) / 2),
    transparent calc(50% + var(--cc-cancel-thickness, 3px) / 2)
  );
}

.cc-cancel-diagonal::after {
  background:
    linear-gradient(
      to bottom right,
      transparent calc(50% - var(--cc-cancel-thickness, 3px) / 2),
      var(--cc-cancel-color, #000) calc(50% - var(--cc-cancel-thickness, 3px) / 2),
      var(--cc-cancel-color, #000) calc(50% + var(--cc-cancel-thickness, 3px) / 2),
      transparent calc(50% + var(--cc-cancel-thickness, 3px) / 2)
    ),
    linear-gradient(
      to top right,
      transparent calc(50% - var(--cc-cancel-thickness, 3px) / 2),
      var(--cc-cancel-color, #000) calc(50% - var(--cc-cancel-thickness, 3px) / 2),
      var(--cc-cancel-color, #000) calc(50% + var(--cc-cancel-thickness, 3px) / 2),
      transparent calc(50% + var(--cc-cancel-thickness, 3px) / 2)
    );
}

.cc-cancel-stripes::after {
  background: repeating-linear-gradient(
    45deg,
    var(--cc-cancel-color, #000) 0,
    var(--cc-cancel-color, #000) var(--cc-cancel-thickness, 3px),
    transparent var(--cc-cancel-thickness, 3px),
    transparent calc(var(--cc-cancel-thickness, 3px) * 3)
  );
  opacity: 0.55;
}

.cc-cancel-border {
  outline:        var(--cc-cancel-thickness, 3px) dashed var(--cc-cancel-color, #000);
  outline-offset: calc(var(--cc-cancel-thickness, 3px) * -1);
}

/* ── Week number column ───────────────────────────────────────────────── */

.cc-week-number-header {
  border-right:  1px solid var(--cc-border);
  border-bottom: 1px solid var(--cc-border);
  background:    var(--cc-surface);
}

.cc-week-number {
  border-right:  1px solid var(--cc-border);
  border-bottom: 1px solid var(--cc-border);
  background:    var(--cc-surface);
  font-size:     0.65rem;
  font-weight:   600;
  color:         var(--cc-text-muted);
  display:       flex;
  align-items:   flex-start;
  justify-content: center;
  padding-top:   6px;
  cursor:        default;
  user-select:   none;
}

.cc-more-link {
  display:     block;
  font-size:   0.72rem;
  color:       var(--cc-primary);
  cursor:      pointer;
  margin-top:  2px;
  font-weight: 500;
}

.cc-more-link:hover {
  text-decoration: underline;
}

/* ============================================================================
   YEAR VIEW
   ============================================================================ */

.cc-year-grid {
  display:               grid;
  grid-template-columns: repeat(3, 1fr);
  gap:                   20px;
  padding:               16px 0;
}

.cc-mini-month {
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  overflow:      hidden;
  background:    var(--cc-bg);
}

.cc-mini-month-header {
  background:  var(--cc-surface);
  padding:     8px;
  text-align:  center;
  font-weight: 700;
  font-size:   0.82rem;
  color:       var(--cc-text);
  border-bottom: 1px solid var(--cc-border);
  cursor:      pointer;
}

.cc-mini-month-header:hover {
  background: var(--cc-primary-light);
  color:      var(--cc-primary-dark);
}

.cc-mini-grid {
  display:               grid;
  grid-template-columns: repeat(7, 1fr);
  padding:               4px;
  gap:                   0;
}

.cc-mini-day-name {
  width:        30px;
  height:       22px;
  display:      flex;
  align-items:  center;
  justify-content: center;
  font-size:    0.65rem;
  color:        var(--cc-text-muted);
  font-weight:  600;
  text-transform: uppercase;
}

.cc-mini-day {
  width:         30px;
  height:        30px;
  display:       flex;
  flex-direction: column;
  align-items:   center;
  justify-content: flex-start;
  font-size:     0.72rem;
  color:         var(--cc-text);
  padding-top:   4px;
  cursor:        pointer;
  border-radius: 4px;
  position:      relative;
  transition:    background 0.1s;
}

.cc-mini-day:hover {
  background: var(--cc-primary-light);
}

.cc-mini-day.cc-other-month {
  opacity: 0.3;
}

.cc-mini-day.cc-today > span:first-child {
  background:    var(--cc-today-bg);
  color:         var(--cc-today-text);
  border-radius: 50%;
  width:         20px;
  height:        20px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-weight:   700;
}

/* Event dots */
.cc-mini-dots {
  display:     flex;
  gap:         2px;
  margin-top:  2px;
  align-items: center;
}

.cc-mini-dot {
  width:         6px;
  height:        6px;
  border-radius: 50%;
  background:    var(--cc-primary);
  flex-shrink:   0;
}

.cc-mini-dot-more {
  font-size:  0.55rem;
  color:      var(--cc-text-muted);
  line-height: 1;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.cc-modal-overlay {
  position:        fixed;
  inset:           0;
  z-index:         9999;
  background:      var(--cc-overlay);
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         20px;
  animation:       cc-overlay-in 0.2s ease;
}

@keyframes cc-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cc-modal-container {
  background:    var(--cc-modal-bg);
  border-radius: var(--cc-radius);
  box-shadow:    0 8px 40px rgba(0, 0, 0, 0.22);
  max-width:     640px;
  width:         100%;
  max-height:    90vh;
  overflow-y:    auto;
  position:      relative;
  animation:     cc-modal-in 0.22s ease;
}

@keyframes cc-modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.cc-modal-close {
  position:   absolute;
  top:        10px;
  right:      12px;
  width:      40px;
  height:     40px;
  border:     none;
  background: transparent;
  font-size:  1.5rem;
  line-height: 1;
  color:      var(--cc-text-muted);
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  z-index:    1;
  display:    flex;
  align-items: center;
  justify-content: center;
}

.cc-modal-close:hover {
  background: var(--cc-surface);
  color:      var(--cc-text);
}

.cc-modal-close:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-modal-content {
  padding: 24px;
}

/* ── Canceled event notice banner ─────────────────────────────────────────
   Rendered by renderEventDetail() as the very first element in the modal
   body, before the share bar — uses the same negative-margin full-bleed
   trick as .cc-modal-admin-toolbar to break out of .cc-modal-content's
   24px padding. No top margin (it sits flush against the modal's top
   edge) and no border-radius (square corners against the modal box). ──── */

.cc-canceled-banner {
  margin:      -24px -24px 16px;
  padding:     10px 16px;
  font-weight: 600;
  font-size:   0.92rem;
  color:       #fff;
  text-align:  center;
  border-radius: 0;
}

/* ── Modal loading spinner ────────────────────────────────────────────────── */

.cc-modal-loading {
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         60px 24px;
}

.cc-spinner {
  width:         36px;
  height:        36px;
  border:        3px solid var(--cc-border);
  border-top-color: var(--cc-primary);
  border-radius: 50%;
  animation:     cc-spin 0.7s linear infinite;
}

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

/* ── Modal sections ───────────────────────────────────────────────────────── */

.cc-modal-admin-toolbar {
  display:         flex;
  gap:             8px;
  padding:         12px 24px;
  background:      var(--cc-surface);
  border-bottom:   1px solid var(--cc-border);
  margin:          -24px -24px 20px;
}

.cc-modal-admin-toolbar button {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       5px 14px;
  font-size:     0.82rem;
  font-family:   inherit;
  color:         var(--cc-text);
  transition:    background 0.12s, border-color 0.12s;
}

.cc-modal-admin-toolbar button:hover {
  background:   var(--cc-primary-light);
  border-color: var(--cc-primary);
  color:        var(--cc-primary-dark);
}

.cc-modal-admin-toolbar .cc-btn-delete-event {
  border-color: var(--cc-danger);
  color:        var(--cc-danger);
}

.cc-modal-admin-toolbar .cc-btn-delete-event:hover {
  background: var(--cc-danger);
  color:      #fff;
}

.cc-modal-admin-toolbar .cc-btn-edit-event {
  background: var(--cc-primary-light);
  color:      var(--cc-primary-dark);
}

.cc-modal-admin-toolbar .cc-btn-copy-event {
  background: var(--cc-surface);
  color:      var(--cc-text);
}

.cc-btn-moderate-comment {
  background: none;
  border:     none;
  cursor:     pointer;
  padding:    0;
  color:      var(--cc-text-muted);
  font-size:  0.8rem;
}

/* Official badge */
.cc-official-badge {
  padding:       8px 16px;
  font-size:     0.82rem;
  font-weight:   600;
  border-radius: 4px;
  margin-bottom: 14px;
  display:       flex;
  align-items:   center;
  gap:           6px;
}

.cc-official-badge--official {
  background: #d4edda;
  color:      #155724;
}

.cc-official-badge--members {
  background: #fff3cd;
  color:      #856404;
}

.cc-official-badge--external {
  background: #ede7f6;
  color:      #4527a0;
}

/* Category pill */
.cc-event-category-pill {
  display:       inline-flex;
  position:      relative;
  align-items:   center;
  gap:           5px;
  padding:       3px 10px;
  border-radius: 12px;
  font-size:     0.75rem;
  font-weight:   600;
  margin-bottom: 8px;
  cursor:        pointer;
  text-decoration: none;
  transition:    filter 0.12s;
}

.cc-event-category-pill:hover {
  filter: brightness(0.9);
}

/* Info grid */
.cc-event-info-grid {
  display:               grid;
  grid-template-columns: auto 1fr;
  gap:                   6px 12px;
  margin:                14px 0;
  align-items:           start;
}

.cc-info-icon {
  font-size: 1rem;
  line-height: 1.5;
}

.cc-info-value {
  font-size:   0.88rem;
  line-height: 1.5;
  color:       var(--cc-text);
}

.cc-info-value a {
  color: var(--cc-primary);
}

/* Description */
.cc-event-description {
  font-size:   0.88rem;
  line-height: 1.7;
  color:       var(--cc-text);
  max-width:   500px;
  word-break:  break-word;
  margin:      14px 0;
  white-space: pre-line;
}

/* Borough pills */
.cc-borough-pills {
  display:   flex;
  flex-wrap: wrap;
  gap:       6px;
  margin:    10px 0;
}

.cc-borough-pill {
  background:    var(--cc-primary-light);
  color:         var(--cc-primary-dark);
  border-radius: 12px;
  padding:       3px 10px;
  font-size:     0.75rem;
  font-weight:   500;
}

/* Ride boxes */
.cc-ride-box {
  border:        2px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       12px;
  margin:        10px 0;
  font-size:     0.85rem;
}

.cc-ride-box--request {
  border-color: var(--cc-danger);
}

.cc-ride-box--offer {
  border-color: var(--cc-success);
}

.cc-ride-box-title {
  font-weight:   600;
  margin-bottom: 6px;
}

/* Participants section */
.cc-participants-section,
.cc-comments-section {
  margin-top:  20px;
  padding-top: 16px;
  border-top:  1px solid var(--cc-border);
}

.cc-section-title {
  font-size:     0.9rem;
  font-weight:   700;
  margin-bottom: 10px;
  color:         var(--cc-text);
}

.cc-participant-row {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     5px 0;
  font-size:   0.85rem;
  border-bottom: 1px solid var(--cc-surface);
}

/* Likelihood indicators */
.cc-likelihood-dot {
  width:            12px;
  height:           12px;
  border-radius:    50%;
  flex-shrink:      0;
  background-color: #4caf50; /* green — very likely */
}

.cc-likelihood-hex {
  width:            12px;
  height:           12px;
  flex-shrink:      0;
  clip-path:        polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background-color: #ffc107; /* amber — try */
}

.cc-likelihood-sq {
  width:            12px;
  height:           12px;
  flex-shrink:      0;
  background-color: #9e9e9e; /* grey — interested / undecided */
}

/* Register/Deregister buttons */
.cc-btn-register,
.cc-btn-deregister {
  border:        1px solid;
  border-radius: var(--cc-radius);
  padding:       6px 16px;
  font-size:     0.82rem;
  font-family:   inherit;
  cursor:        pointer;
  transition:    background 0.15s, color 0.15s;
}

.cc-btn-register {
  background:   var(--cc-primary);
  border-color: var(--cc-primary);
  color:        #fff;
}

.cc-btn-register:hover {
  background:   var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
}

.cc-btn-deregister {
  background:   transparent;
  border-color: var(--cc-danger);
  color:        var(--cc-danger);
}

.cc-btn-deregister:hover {
  background: var(--cc-danger);
  color:      #fff;
}

.cc-btn-register:focus-visible,
.cc-btn-deregister:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* Export bar (modal bottom) */
.cc-modal-export-bar {
  position:      sticky;
  bottom:        0;
  background:    var(--cc-surface);
  border-top:    1px solid var(--cc-border);
  padding:       12px 24px;
  margin:        20px -24px -24px;
  display:       flex;
  gap:           8px;
  flex-wrap:     wrap;
}

.cc-modal-export-bar button {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       5px 14px;
  font-size:     0.8rem;
  font-family:   inherit;
  color:         var(--cc-text-muted);
  cursor:        pointer;
  transition:    border-color 0.12s, color 0.12s;
}

.cc-modal-export-bar button:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
}

/* ============================================================================
   COMMENTS
   ============================================================================ */

.cc-comment {
  border-left:   3px solid var(--cc-border);
  padding:       8px 12px;
  margin-bottom: 12px;
}

.cc-comment--hidden {
  opacity:      0.6;
  border-left-color: var(--cc-text-muted);
}

.cc-comment-header {
  display:     flex;
  gap:         8px;
  align-items: center;
  flex-wrap:   wrap;
  margin-bottom: 4px;
}

.cc-comment-author {
  font-size:   0.85rem;
  font-weight: 600;
}

.cc-comment-date {
  font-size: 0.75rem;
  color:     var(--cc-text-muted);
}

.cc-comment-actions {
  margin-left: auto;
  display:     flex;
  gap:         8px;
}

.cc-comment-actions button {
  background:  transparent;
  border:      none;
  font-size:   0.72rem;
  color:       var(--cc-text-muted);
  cursor:      pointer;
  padding:     0;
  font-family: inherit;
  transition:  color 0.12s;
}

.cc-comment-actions button:hover {
  color: var(--cc-danger);
}

.cc-comment-body {
  font-size:   0.85rem;
  line-height: 1.6;
  color:       var(--cc-text);
}

.cc-comment-hidden-text {
  font-style: italic;
  color:      var(--cc-text-muted);
}

/* Comment form */
.cc-comment-form {
  margin-top: 16px;
}

.cc-comment-input {
  width:         100%;
  resize:        vertical;
  min-height:    80px;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       8px 10px;
  font-family:   inherit;
  font-size:     0.85rem;
  color:         var(--cc-text);
  background:    var(--cc-input-bg);
  transition:    border-color 0.15s;
}

.cc-comment-input:focus {
  outline:      none;
  border-color: var(--cc-primary);
  box-shadow:   0 0 0 2px rgba(74, 111, 165, 0.15);
}

.cc-comment-footer {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-top:      6px;
}

.cc-char-count {
  font-size: 0.75rem;
  color:     var(--cc-text-muted);
}

.cc-post-comment {
  background:    var(--cc-primary);
  border:        1px solid var(--cc-primary);
  border-radius: var(--cc-radius);
  padding:       6px 16px;
  font-size:     0.82rem;
  font-family:   inherit;
  color:         #fff;
  cursor:        pointer;
  transition:    background 0.15s;
}

.cc-post-comment:hover {
  background: var(--cc-primary-dark);
}

.cc-post-comment:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* ============================================================================
   DAY POPUP
   ============================================================================ */

.cc-day-popup-header {
  font-size:     1.05rem;
  font-weight:   700;
  margin-bottom: 16px;
  color:         var(--cc-text);
}

.cc-day-event-card {
  position:      relative;
  border:        1px solid var(--cc-border);
  border-left:   4px solid var(--cc-primary);
  border-radius: var(--cc-radius);
  padding:       12px 14px;
  margin-bottom: 10px;
  cursor:        pointer;
  transition:    background 0.12s, box-shadow 0.12s;
  background:    var(--cc-bg);
}
  background:  var(--cc-surface);
  box-shadow:  var(--cc-shadow);
}

.cc-day-event-card:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-day-event-meta {
  display:   flex;
  gap:       8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.cc-day-event-title {
  font-size:   0.95rem;
  font-weight: 600;
  margin:      2px 0;
}

.cc-day-event-time {
  font-size: 0.82rem;
  color:     var(--cc-text-muted);
}

.cc-day-event-location {
  font-size: 0.8rem;
  color:     var(--cc-text-muted);
  margin-top: 2px;
}

.cc-official-tag {
  font-size:   0.72rem;
  font-weight: 600;
  color:       var(--cc-success);
}

.cc-day-popup-empty {
  text-align: center;
  color:      var(--cc-text-muted);
  padding:    24px 0;
  font-size:  0.88rem;
}

/* renderDayPopup-specific layout */
.cc-day-popup-date {
  font-size:   1rem;
  font-weight: 600;
  margin:      0;
  color:       var(--cc-text);
}

.cc-day-popup-events {
  display:        flex;
  flex-direction: column;
  gap:            8px;
  margin-top:     12px;
}

.cc-day-popup-card-badges {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             6px;
  margin-bottom:   4px;
}

.cc-official-star {
  color:       #2e7d32;
  font-size:   0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.cc-official-star--external {
  color:       #4527a0;
  font-size:   0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.cc-day-popup-footer {
  margin-top:  16px;
  padding-top: 14px;
  border-top:  1px solid var(--cc-border);
  text-align:  center;
}

.cc-day-popup-login {
  font-size: 0.85rem;
  color:     var(--cc-text-muted);
  margin:    0;
}

.cc-day-popup-login a {
  color: var(--cc-primary);
}

/* Utility helpers used by renderDayPopup (safe no-ops if already defined) */
.cc-text-muted  { color: var(--cc-text-muted); }
.cc-text-center { text-align: center; }

.cc-day-popup-add {
  margin-top:  16px;
  padding-top: 14px;
  border-top:  1px solid var(--cc-border);
}

.cc-btn-add-event {
  background:    var(--cc-primary);
  border:        none;
  border-radius: var(--cc-radius);
  padding:       8px 18px;
  font-size:     0.88rem;
  font-family:   inherit;
  color:         #fff;
  cursor:        pointer;
  transition:    background 0.15s;
}

.cc-btn-add-event:hover {
  background: var(--cc-primary-dark);
}

.cc-btn-add-event:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-login-prompt {
  font-size: 0.82rem;
  color:     var(--cc-text-muted);
}

/* ============================================================================
   EVENT CREATION FORM
   ============================================================================ */

.cc-form-info {
  background:    var(--cc-primary-light);
  border-left:   3px solid var(--cc-primary);
  border-radius: 0 var(--cc-radius) var(--cc-radius) 0;
  padding:       10px 14px;
  font-size:     0.85rem;
  color:         var(--cc-text);
  margin-bottom: 16px;
}

.cc-form-group {
  margin-bottom: 16px;
}

.cc-form-label {
  display:       block;
  font-size:     0.85rem;
  font-weight:   600;
  margin-bottom: 5px;
  color:         var(--cc-text);
}

.cc-form-label .required {
  color: var(--cc-danger);
  margin-left: 2px;
}

.cc-form-input,
.cc-form-select,
.cc-form-textarea {
  width:         100%;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       7px 10px;
  font-size:     0.88rem;
  font-family:   inherit;
  color:         var(--cc-text);
  background:    var(--cc-input-bg);
  transition:    border-color 0.15s, box-shadow 0.15s;
}

.cc-form-input:focus,
.cc-form-select:focus,
.cc-form-textarea:focus {
  outline:      none;
  border-color: var(--cc-primary);
  box-shadow:   0 0 0 2px rgba(74, 111, 165, 0.15);
}

.cc-form-input--error,
.cc-form-select--error,
.cc-form-textarea--error {
  border-color: var(--cc-danger);
}

.cc-form-error {
  font-size:  0.78rem;
  color:      var(--cc-danger);
  margin-top: 3px;
}

.cc-form-textarea {
  resize:     vertical;
  min-height: 100px;
}

.cc-form-char-count {
  font-size:   0.75rem;
  color:       var(--cc-text-muted);
  text-align:  right;
  margin-top:  2px;
}

/* Visibility radios */
.cc-visibility-group {
  display: flex;
  gap:     16px;
}

.cc-visibility-option {
  display:     flex;
  align-items: center;
  gap:         6px;
  cursor:      pointer;
  font-size:   0.88rem;
}

/* Time row */
.cc-time-row {
  display:   flex;
  gap:       10px;
  flex-wrap: wrap;
}

.cc-time-row .cc-form-select {
  flex: 1;
  min-width: 100px;
}

/* Borough checkboxes */
.cc-borough-grid {
  display:               grid;
  grid-template-columns: repeat(3, 1fr);
  gap:                   6px;
}

.cc-borough-checkbox-label {
  display:     flex;
  align-items: center;
  gap:         6px;
  font-size:   0.82rem;
  cursor:      pointer;
}

/* ── Meta-field radio buttons (boolean_2 / boolean_3 form options) ── */
.cc-meta-radio-group {
  display:        flex;
  flex-direction: column;
  gap:            0.45rem;
  margin-top:     0.35rem;
}

.cc-meta-radio-option {
  display:     flex;
  align-items: center;
  gap:         0.5rem;
  font-size:   0.925rem;
  cursor:      pointer;
  min-height:  2rem;
  padding:     0.1rem 0;
  color:       var(--cc-text);
}

.cc-meta-radio-option input[type="radio"] {
  flex-shrink:   0;
  width:         1rem;
  height:        1rem;
  cursor:        pointer;
  accent-color:  var(--cc-primary);
}

.cc-meta-radio-label {
  line-height: 1.3;
}

@media (max-width: 600px) {
  .cc-meta-radio-option {
    min-height: 2.75rem;
  }
}

/* Additional options toggle */
.cc-additional-toggle {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       6px 14px;
  font-size:     0.82rem;
  font-family:   inherit;
  color:         var(--cc-text-muted);
  cursor:        pointer;
  transition:    border-color 0.12s, color 0.12s;
}

.cc-additional-toggle:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
}

.cc-additional-fields {
  margin-top: 12px;
  padding:    12px;
  background: var(--cc-surface);
  border-radius: var(--cc-radius);
  border:     1px solid var(--cc-border);
}

/* Description editor toolbar */
.cc-desc-toolbar {
  display:       flex;
  gap:           6px;
  margin-bottom: 4px;
}

.cc-desc-link-btn {
  padding:       3px 8px;
  font-size:     0.8rem;
  border:        1px solid var(--cc-border);
  border-radius: 4px;
  background:    var(--cc-surface);
  color:         var(--cc-text);
  cursor:        pointer;
  font-family:   inherit;
  transition:    border-color 0.12s, color 0.12s;
}

.cc-desc-link-btn:hover {
  border-color: var(--cc-primary);
  color:        var(--cc-primary);
}

/* Form buttons */
.cc-form-buttons {
  display:    flex;
  gap:        10px;
  margin-top: 20px;
  flex-wrap:  wrap;
}

.cc-btn-save-event {
  background:    var(--cc-primary);
  border:        1px solid var(--cc-primary);
  border-radius: var(--cc-radius);
  padding:       8px 22px;
  font-size:     0.88rem;
  font-family:   inherit;
  color:         #fff;
  cursor:        pointer;
  font-weight:   600;
  transition:    background 0.15s;
}

.cc-btn-save-event:hover {
  background: var(--cc-primary-dark);
}

.cc-btn-cancel-form {
  background:    transparent;
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       8px 18px;
  font-size:     0.88rem;
  font-family:   inherit;
  color:         var(--cc-text-muted);
  cursor:        pointer;
  transition:    border-color 0.12s, color 0.12s;
}

.cc-btn-cancel-form:hover {
  border-color: var(--cc-danger);
  color:        var(--cc-danger);
}

.cc-btn-save-event:focus-visible,
.cc-btn-cancel-form:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* ── Generic form button base + BEM modifiers (used in renderEventForm) ─── */

.cc-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  border-radius:   var(--cc-radius);
  padding:         8px 18px;
  font-size:       0.88rem;
  font-family:     inherit;
  font-weight:     500;
  cursor:          pointer;
  border:          1px solid transparent;
  transition:      background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  white-space:     nowrap;
  line-height:     1.4;
}

.cc-btn--primary {
  background:   var(--cc-primary);
  border-color: var(--cc-primary);
  color:        #fff;
  font-weight:  600;
}

.cc-btn--primary:hover {
  background:   var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
}

.cc-btn--danger {
  background:   transparent;
  border-color: var(--cc-danger);
  color:        var(--cc-danger);
}

.cc-btn--danger:hover {
  background: var(--cc-danger);
  color:      #fff;
}

/* Plain .cc-btn with no modifier → ghost/secondary style (matches .cc-btn-cancel-form) */
.cc-btn:not(.cc-btn--primary):not(.cc-btn--danger) {
  background:   transparent;
  border-color: var(--cc-border);
  color:        var(--cc-text-muted);
}

.cc-btn:not(.cc-btn--primary):not(.cc-btn--danger):hover {
  border-color: var(--cc-danger);
  color:        var(--cc-danger);
}

.cc-btn:focus-visible {
  outline:        2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-form-error-banner {
  background:    #f8d7da;
  border:        1px solid #f5c6cb;
  border-radius: var(--cc-radius);
  padding:       10px 14px;
  font-size:     0.85rem;
  color:         #721c24;
  margin-bottom: 14px;
}

/* ============================================================================
   RECURRENCE UI
   ============================================================================ */

.cc-recurrence-wrap {
  margin-top:  12px;
  padding:     16px;
  background:  var(--cc-surface);
  border:      1px solid var(--cc-border);
  border-radius: var(--cc-radius);
}

.cc-recur-pattern {
  background:    var(--cc-bg);
  border:        1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding:       12px;
  margin-bottom: 10px;
}

.cc-recur-remove-pattern {
  background:    transparent;
  border:        1px solid var(--cc-danger);
  border-radius: 4px;
  padding:       3px 8px;
  font-size:     0.75rem;
  color:         var(--cc-danger);
  cursor:        pointer;
  margin-top:    8px;
  font-family:   inherit;
}

.cc-recur-remove-pattern:hover {
  background: var(--cc-danger);
  color:      #fff;
}

.cc-add-pattern-btn {
  background:    transparent;
  border:        1px dashed var(--cc-primary);
  border-radius: var(--cc-radius);
  padding:       6px 14px;
  font-size:     0.82rem;
  font-family:   inherit;
  color:         var(--cc-primary);
  cursor:        pointer;
  margin-top:    6px;
}

.cc-add-pattern-btn:hover {
  background: var(--cc-primary-light);
}

.cc-recur-preview {
  margin-top:  12px;
  font-size:   0.82rem;
  color:       var(--cc-text-muted);
}

.cc-recur-preview-dates {
  list-style: none;
  padding:    0;
  margin:     6px 0 0;
}

.cc-recur-preview-dates li {
  padding:     2px 0;
  font-weight: 500;
  color:       var(--cc-text);
}

/* ============================================================================
   PARTICIPANT FORM
   ============================================================================ */

.cc-participant-form-wrap {
  max-width: 500px;
}

.cc-likelihood-options {
  display:        flex;
  flex-direction: column;
  gap:            10px;
  margin-top:     6px;
}

.cc-likelihood-option {
  display:     flex;
  align-items: center;
  gap:         10px;
  cursor:      pointer;
  font-size:   0.88rem;
}

.cc-likelihood-indicator {
  flex-shrink:    0;
  width:          14px;
  height:         14px;
  margin-right:   5px;
  vertical-align: middle;
}

.cc-ride-toggle-section {
  margin-top:  14px;
  padding-top: 14px;
  border-top:  1px solid var(--cc-border);
}

/* ============================================================================
   TOAST NOTIFICATION
   ============================================================================ */

.cc-toast {
  position:      fixed;
  bottom:        24px;
  right:         24px;
  z-index:       10000;
  background:    #1d2327;
  color:         #fff;
  border-radius: var(--cc-radius);
  padding:       12px 20px;
  font-size:     0.88rem;
  font-family:   var(--cc-font);
  box-shadow:    0 4px 16px rgba(0, 0, 0, 0.2);
  transform:     translateX(calc(100% + 32px));
  opacity:       0;
  transition:    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                 opacity   0.28s ease;
  pointer-events: none;
  max-width:     320px;
}

.cc-toast.cc-toast--show {
  transform:      translateX(0);
  opacity:        1;
  pointer-events: auto;
}

.cc-toast--success { border-left: 3px solid var(--cc-success); }
.cc-toast--error   { border-left: 3px solid var(--cc-danger);  }
.cc-toast--info    { border-left: 3px solid var(--cc-primary); }

/* ============================================================================
   PHASE 7.1 — FILTER PANEL ENHANCEMENTS
   ============================================================================ */

/* Dual range: visible thumb on top input when it has pointer events */
.cc-dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width:         16px;
  height:        16px;
  border-radius: 50%;
  background:    var(--cc-primary);
  border:        2px solid #fff;
  box-shadow:    0 1px 4px rgba(0,0,0,0.25);
  cursor:        pointer;
  position:      relative;
  z-index:       2;
}

.cc-dual-range input[type="range"]::-moz-range-thumb {
  width:         16px;
  height:        16px;
  border-radius: 50%;
  background:    var(--cc-primary);
  border:        2px solid #fff;
  box-shadow:    0 1px 4px rgba(0,0,0,0.25);
  cursor:        pointer;
}

/* Make both inputs have visible track only via the fill div; hide native track */
.cc-dual-range input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
}
.cc-dual-range input[type="range"]::-moz-range-track {
  background: transparent;
}

/* Active-filter count shown beside Reset in the filter actions bar */
.cc-active-filter-count {
  font-size:   0.8rem;
  font-weight: 600;
  color:       var(--cc-primary);
  margin-left: auto;
}

/* ============================================================================
   RESPONSIVE — 768px
   ============================================================================ */

@media (max-width: 768px) {

  /* Full-page sizing on mobile */
  #community-calendar {
    padding-top:    var(--cc-pad-top, 0px);
    padding-bottom: var(--cc-pad-bottom, 0px);
  }

  /* Toolbar stacks */
  .cc-toolbar {
    flex-direction: column;
    align-items:    stretch;
    gap:            8px;
  }

  .cc-toolbar-views,
  .cc-toolbar-nav,
  .cc-toolbar-actions,
  .cc-toolbar-theme,
  .cc-export-bar {
    justify-content: center;
  }

  .cc-toolbar-actions {
    margin-left: 0;
  }

  .cc-toolbar-theme {
    margin-left: 0;
  }

  /* Shorter day cells */
  .cc-day-cell {
    min-height: 60px;
    padding:    4px;
  }

  .cc-weeks-grid .cc-day-cell {
    min-height: 80px;
  }

  /* Modal becomes bottom sheet */
  .cc-modal-overlay {
    align-items: flex-end;
    padding:     0;
  }

  .cc-modal-container {
    max-width:     100%;
    border-radius: 16px 16px 0 0;
    animation:     cc-sheet-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height:    90vh;
  }

  @keyframes cc-sheet-in {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Year grid: 2 columns on tablet */
  .cc-year-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Filter panel single column */
  .cc-filter-panel {
    grid-template-columns: 1fr;
  }

  /* Borough grid: 2 cols */
  .cc-borough-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Toast full width */
  .cc-toast {
    left:   16px;
    right:  16px;
    bottom: 16px;
    max-width: none;
    transform: translateY(calc(100% + 24px));
  }

  .cc-toast.cc-toast--show {
    transform: translateY(0);
  }
}

/* ============================================================================
   RESPONSIVE — 480px
   ============================================================================ */

@media (max-width: 480px) {

  .cc-day-cell {
    min-height: 44px;
    padding:    3px;
  }

  .cc-event-bar {
    font-size: 0.68rem;
    height:    16px;
    line-height: 16px;
  }

  .cc-day-number {
    font-size: 0.72rem;
    width:     20px;
    height:    20px;
  }

  .cc-day-header {
    font-size: 0.62rem;
    padding:   4px 2px;
  }

  /* Year grid: 1 column on phone */
  .cc-year-grid {
    grid-template-columns: 1fr;
  }

  /* Borough grid: 1 col */
  .cc-borough-grid {
    grid-template-columns: 1fr;
  }

  .cc-modal-content {
    padding: 16px;
  }

  .cc-modal-admin-toolbar {
    margin: -16px -16px 14px;
    padding: 10px 16px;
  }

  .cc-modal-export-bar {
    margin:  14px -16px -16px;
    padding: 10px 16px;
  }
}

/* ── Standalone create-event page ──────────────────────────────────────── */
#community-calendar-create-event {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 0;
}

#community-calendar-create-event .cc-event-form,
#community-calendar-create-event [class*="cc-form"] {
  background: var(--cc-surface, #fff);
  border-radius: var(--cc-radius, 6px);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.cc-standalone-success {
  background: var(--cc-surface, #fff);
  border-radius: var(--cc-radius, 6px);
  padding: 40px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

/* ─────────────────────────────────────────────────────────────────
   Nested / Threaded Comments (v1.14)
   ───────────────────────────────────────────────────────────────── */

/* Depth indentation — each level indents by 20px on mobile, 28px on desktop */
.cc-comment--depth-0 { margin-left: 0; }
.cc-comment--depth-1 { margin-left: 20px; border-left: 2px solid var(--cc-border, #e0e0e0); padding-left: 10px; }
.cc-comment--depth-2 { margin-left: 20px; border-left: 2px solid var(--cc-border, #e0e0e0); padding-left: 10px; }
.cc-comment--depth-3 { margin-left: 20px; border-left: 2px solid var(--cc-border, #e0e0e0); padding-left: 10px; }

@media (min-width: 600px) {
  .cc-comment--depth-1 { margin-left: 28px; }
  .cc-comment--depth-2 { margin-left: 28px; }
  .cc-comment--depth-3 { margin-left: 28px; }
}

/* Children container */
.cc-comment-children { margin-top: 8px; }
.cc-children--hidden { display: none; }

/* Collapsed note */
.cc-thread-collapsed-note {
  font-size: 0.8rem;
  color: var(--cc-text-muted, #888);
  margin-top: 4px;
  cursor: pointer;
}

/* Collapse toggle button */
.cc-thread-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px 0 0;
  font-size: 0.8rem;
  color: var(--cc-text-muted, #888);
  vertical-align: middle;
  line-height: 1;
}
.cc-thread-toggle:hover { color: var(--cc-primary, #3a86ff); }

/* Reply button */
.cc-btn-reply {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--cc-text-muted, #888);
  padding: 0;
  margin-top: 4px;
  text-decoration: underline;
}
.cc-btn-reply:hover { color: var(--cc-primary, #3a86ff); }

/* Comment footer row (holds Reply button) */
.cc-comment-footer {
  margin-top: 4px;
  min-height: 20px;
}

/* Inline reply form */
.cc-inline-reply-form {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--cc-bg-subtle, #f8f8f8);
  border: 1px solid var(--cc-border, #e0e0e0);
  border-radius: 6px;
}
.cc-reply-to-label {
  font-size: 0.8rem;
  color: var(--cc-text-muted, #888);
  margin-bottom: 6px;
}
.cc-reply-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
}
.cc-reply-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.cc-cancel-reply {
  background: none;
  border: 1px solid var(--cc-border, #ccc);
  border-radius: 4px;
  cursor: pointer;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--cc-text-muted, #555);
}
.cc-cancel-reply:hover { background: var(--cc-bg-subtle, #f0f0f0); }

/* Reply-form placeholder resets */
.cc-reply-form-placeholder { display: block; }

/* ============================================================================
   NOTIFICATION BADGES — new-comment / new-participant icons on event bars,
   and the "mark all read" toolbar buttons
   ============================================================================ */

/* Text label inside .cc-event-bar (which is now a flex container — see the
   base .cc-event-bar rule above). Carries the ellipsis truncation that used
   to live directly on the bar, since the bar can now also contain badges. */
.cc-bar-label {
  flex:          1 1 auto;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  min-width:     0;
}

.cc-bar-badge {
  flex:        0 0 auto;
  font-size:   0.72em;
  line-height: 1;
  border-radius: 3px;
  padding:     1px 2px;
  /* Default: inherits the white icon color from .cc-event-bar's color. */
}

.cc-bar-badge--pending {
  /* Color & background are set inline by JS (category color on white,
     the visual inverse of the bar) — this rule only adds the layout. */
  border:        1px solid currentColor;
  border-radius: 3px;
}

/* ── Mark-all-read buttons, shown above the calendar toolbar ────────────── */

.cc-mark-all-wrap {
  display:       flex;
  gap:           8px;
  margin-bottom: 8px;
  flex-wrap:     wrap;
}

.cc-mark-all-btn {
  font-size: 0.82rem !important;
}

/* ── Borough category separator ─────────────────────────────────────────── */

/* Used in filter pills, event form, ride grids, and template admin */
.cc-borough-cat-sep {
  display:     flex;
  align-items: center;
  gap:         8px;
  width:       100%;
  margin:      10px 0 4px;
}

/* First separator in a container needs less top margin */
.cc-borough-cat-sep:first-child {
  margin-top: 2px;
}

.cc-borough-cat-sep__line {
  flex:             1;
  height:           0;
  border:           none;
  border-top:       1px solid var(--cc-border);
}

.cc-borough-cat-sep__label {
  flex-shrink:    0;
  font-size:      0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight:    600;
  color:          var(--cc-text-muted);
  white-space:    nowrap;
}
