/* Community subsystem styles */

.community-page {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  height: calc(100dvh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Filter bar */
.community-filter-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--viewer-controls-bg, #fff);
  border-bottom: 1px solid var(--viewer-controls-border, #e2e8f0);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.community-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.community-filter-collapsible {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Top filter group: mobile stacked, desktop single row */
.community-filter-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Type row: label inline with chips, chips wrap naturally */
.community-filter-top > .community-filter-row:first-child .community-content-toggle {
  display: contents;
}

/* Unified control height */
.community-content-toggle,
.community-view-toggle,
.community-sort-toggle,
.community-quick-days {
  display: flex;
  height: 30px;
  box-sizing: border-box;
  background: var(--viewer-input-bg, #f1f5f9);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
}

/* Content toggle: chip style — wraps to fit any language */
.community-content-toggle {
  height: auto;
  flex-wrap: wrap;
  overflow: visible;
  background: none;
  border: none;
  gap: 5px;
  padding: 0;
}

.community-content-toggle button {
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  background: var(--viewer-input-bg, #f1f5f9);
  border-radius: 16px;
  padding: 0 12px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  color: var(--viewer-text-muted, #64748b);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.community-content-toggle button.active {
  background: var(--viewer-accent, #0088ee);
  border-color: var(--viewer-accent, #0088ee);
  color: var(--viewer-accent-contrast, #fff);
}

.community-view-toggle button,
.community-sort-toggle button,
.community-quick-days button {
  border: none;
  background: none;
  padding: 0 12px;
  height: 100%;
  font-size: 12px;
  cursor: pointer;
  color: var(--viewer-text-muted, #64748b);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.community-view-toggle button.active,
.community-sort-toggle button.active,
.community-quick-days button.active {
  background: var(--viewer-accent, #0088ee);
  color: var(--viewer-accent-contrast, #fff);
}

.community-filter-bar .community-filter-select,
.community-filter-bar .community-filter-input {
  padding: 0 6px !important;
  height: 30px !important;
  min-height: 30px !important;
  line-height: 30px !important;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  background: var(--viewer-input-bg, #fff);
  color: var(--viewer-input-text, #0f172a);
  font-size: 12px !important;
  min-width: 0;
}

.community-filter-select {
  max-width: 110px;
}

.community-filter-input {
  width: 72px;
}

.community-filter-name {
  width: 96px;
}

.community-custom-days {
  width: 60px;
}

.community-filter-label {
  font-size: 12px;
  color: var(--viewer-text-muted, #64748b);
  white-space: nowrap;
  line-height: 30px;
}

.community-filter-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.community-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.community-csv-btn {
  padding: 0 10px;
  height: 30px;
  line-height: 30px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  background: var(--viewer-input-bg, #fff);
  color: var(--viewer-text-muted, #64748b);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

@media (hover: hover) {
  .community-csv-btn:hover {
    background: var(--viewer-accent, #0088ee);
    color: var(--viewer-accent-contrast, #fff);
  }
}

/* Filter collapse (mobile only) */
.community-filter-collapse-btn {
  display: none; /* hidden on desktop */
}

.community-filter-summary {
  display: none; /* shown on mobile when collapsed */
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

/* Chips look like text labels, not buttons: pill shape + subtle style */
.community-filter-summary-chip {
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px;
  white-space: nowrap;
  line-height: 18px;
  color: var(--viewer-accent, #0088ee);
  background: transparent;
  border: 1px solid var(--viewer-accent, #0088ee);
}

.community-filter-summary-chip.is-default {
  color: var(--viewer-text-muted, #64748b);
  border-color: var(--viewer-input-border, #e2e8f0);
  background: transparent;
}

@media (max-width: 640px) {
  .community-filter-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: 1px solid var(--viewer-input-border, #e2e8f0);
    border-radius: 50%;
    background: var(--viewer-input-bg, #f1f5f9);
    color: var(--viewer-text-muted, #64748b);
    cursor: pointer;
  }

  /* Reserve space so chips don't render under the button */
  .community-filter-top > .community-filter-row:first-child {
    padding-right: 32px;
  }

  .community-filter-collapse-btn::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(1px) rotate(-135deg); /* chevron up */
    transition: transform 0.2s ease;
  }

  .community-filter-bar.is-collapsed .community-filter-collapse-btn::before {
    transform: translateY(-1px) rotate(45deg); /* chevron down */
  }

  .community-filter-collapsible {
    overflow: hidden;
    max-height: 400px;
    opacity: 1;
    transition: max-height 0.2s ease, opacity 0.15s ease;
  }

  .community-filter-bar.is-collapsed .community-filter-collapsible {
    max-height: 0;
    opacity: 0;
  }

  .community-filter-bar.is-collapsed {
    gap: 0;
  }

  .community-filter-bar.is-collapsed .community-filter-summary {
    display: flex;
  }

  .community-filter-bar.is-collapsed .community-csv-btn,
  .community-filter-bar.is-collapsed #viewToggle {
    display: none;
  }

  @media (hover: hover) {
    .community-filter-collapse-btn:hover {
      background: var(--viewer-accent, #0088ee);
      color: var(--viewer-accent-contrast, #fff);
      border-color: var(--viewer-accent, #0088ee);
    }
  }
}

/* Map */
.community-map-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

.community-map {
  width: 100%;
  height: 100%;
}

/* List */
.community-list-container {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  min-height: 0;
}

/* User location marker */
.community-user-marker {
  background: none !important;
  border: none !important;
}

.community-user-marker-dot {
  width: 12px;
  height: 12px;
  background: #4285f4;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.community-user-marker-pulse {
  width: 28px;
  height: 28px;
  background: rgba(66, 133, 244, 0.25);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: community-pulse 2s ease-out infinite;
  z-index: 1;
}

@keyframes community-pulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.community-list-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.community-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* List cards */
.community-card {
  background: var(--viewer-card-bg, #fff);
  border: 1px solid var(--viewer-card-border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

@media (hover: hover) {
  .community-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
}

.community-card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--viewer-text, #0f172a);
  margin-bottom: 4px;
}

.community-card-meta {
  font-size: 13px;
  color: var(--viewer-text-muted, #475569);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.community-card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.community-card-badge.tournament {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.community-card-badge.tournament-open {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.community-card-badge.tournament-regular {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.community-card-badge.shop {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.community-card-badge.stadium {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.community-card-badge.distance {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.community-card-badge.city {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
}

.community-card-address {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--viewer-text-muted, #64748b);
  text-decoration: none;
}

@media (hover: hover) {
  .community-card-address:hover {
    text-decoration: underline;
    color: var(--viewer-link, #0088ee);
  }
}

.community-card-badge.tournament-private {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.community-card-badge.tournament-practice {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
}

.community-card-badge.view-count {
  background: rgba(100, 116, 139, 0.08);
  color: var(--viewer-text-muted, #64748b);
  font-weight: 500;
}

/* Detail overlay */
.community-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.community-detail-panel {
  background: var(--viewer-card-bg, #fff);
  border-radius: 16px 16px 0 0;
  max-height: 80vh;
  width: 100%;
  max-width: 600px;
  overflow-y: auto;
  padding: 16px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.community-detail-header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.community-detail-back {
  border: none;
  background: none;
  color: var(--viewer-accent, #0088ee);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.community-detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--viewer-input-border, #e2e8f0);
  font-size: 14px;
}

.community-detail-label {
  color: var(--viewer-text-muted, #475569);
  min-width: 100px;
  flex-shrink: 0;
}

.community-detail-value {
  color: var(--viewer-text, #0f172a);
  word-break: break-word;
}

.community-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.community-detail-actions button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  background: var(--viewer-input-bg, #fff);
  color: var(--viewer-text, #0f172a);
  font-size: 13px;
  cursor: pointer;
}

.community-detail-actions .action-primary {
  background: var(--viewer-accent, #0088ee);
  color: var(--viewer-accent-contrast, #fff);
  border-color: var(--viewer-accent, #0088ee);
  transition: background 0.2s, border-color 0.2s;
}

.community-detail-actions .action-copied {
  background: #059669;
  border-color: #059669;
}

.community-detail-actions .favorite-btn.active {
  background: rgba(239, 68, 68, 0.1);
  border-color: #dc2626;
  color: #dc2626;
}

/* Submit modal overlay */
.community-submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.community-submit-panel {
  background: var(--viewer-card-bg, #fff);
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  width: 100%;
  max-width: 600px;
  overflow-y: auto;
  padding: 16px;
  animation: slideUp 0.25s ease-out;
}

.community-submit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.community-submit-header h2 {
  font-size: 18px;
  margin: 0;
  color: var(--viewer-text, #0f172a);
}

.community-submit-close {
  border: none;
  background: none;
  font-size: 24px;
  color: var(--viewer-text-muted, #64748b);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.community-submit-form label {
  display: block;
  font-size: 13px;
  color: var(--viewer-text-muted, #475569);
  margin-bottom: 4px;
  margin-top: 12px;
}

.community-submit-form input,
.community-submit-form select,
.community-submit-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  background: var(--viewer-input-bg, #fff);
  color: var(--viewer-input-text, #0f172a);
  font-size: 14px;
  box-sizing: border-box;
}

.community-submit-form input:focus,
.community-submit-form select:focus {
  outline: none;
  border-color: var(--viewer-input-focus, #0088ee);
  box-shadow: 0 0 0 3px var(--viewer-input-focus-shadow, rgba(0, 136, 238, 0.25));
}

.community-submit-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.community-submit-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  cursor: pointer;
}

.community-submit-actions .btn-primary {
  background: var(--viewer-accent, #0088ee);
  color: var(--viewer-accent-contrast, #fff);
}

.community-submit-actions .btn-secondary {
  background: var(--viewer-input-bg, #f1f5f9);
  color: var(--viewer-text, #0f172a);
  border: 1px solid var(--viewer-input-border, #e2e8f0);
}

/* Favorites */
.community-favorites-container {
  padding: 16px;
}

.community-favorites-container h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

/* Bottom-right action buttons (stacked) */
.community-bottom-actions {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Locate me button */
.community-locate-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--viewer-card-border, #e2e8f0);
  background: var(--viewer-card-bg, #fff);
  color: var(--viewer-text, #0f172a);
  cursor: pointer;
  font-size: 1.1em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
  .community-locate-btn:hover {
    transform: translateY(-2px);
    border-color: var(--viewer-accent, #0088ee);
  }
}

/* Copy link button */
.community-copy-link-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--viewer-card-border, #e2e8f0);
  background: var(--viewer-card-bg, #fff);
  color: var(--viewer-text, #0f172a);
  cursor: pointer;
  font-size: 1.1em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
  .community-copy-link-btn:hover {
    transform: translateY(-2px);
    border-color: var(--viewer-accent, #0088ee);
  }
}

/* FAB */
.community-fab {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--viewer-accent, #0088ee);
  color: var(--viewer-accent-contrast, #fff);
  font-size: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
  .community-fab:hover {
    transform: scale(1.1);
  }
}


/* Empty state */
.community-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--viewer-text-muted, #64748b);
  font-size: 14px;
}

/* Map marker icons */
.community-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: none;
  border: none;
  border-radius: 50%;
  box-sizing: border-box;
  transition: box-shadow 0.2s;
}

/* Shop with 盤 — blue glow follows the emoji silhouette, not the container box */
.community-marker.has-stadium {
  filter:
    drop-shadow(0 0 4px rgba(14, 165, 233, 0.95))
    drop-shadow(0 0 10px rgba(14, 165, 233, 0.7));
}

/* Combined with hotness tiers: add the accent glow layer on top of the blue */
.community-marker.has-stadium.hot {
  filter:
    drop-shadow(0 0 4px rgba(14, 165, 233, 0.95))
    drop-shadow(0 0 10px rgba(234, 179, 8, 0.85));
}
.community-marker.has-stadium.viral {
  filter:
    drop-shadow(0 0 4px rgba(14, 165, 233, 0.95))
    drop-shadow(0 0 12px rgba(249, 115, 22, 0.95));
}

/* Tiered hotness by view_count — set in community.js */
.community-marker.hot {
  font-size: 32px;
  filter:
    drop-shadow(0 0 4px rgba(234, 179, 8, 0.95))
    drop-shadow(0 0 10px rgba(234, 179, 8, 0.7));
}

.community-marker.viral {
  font-size: 36px;
  filter:
    drop-shadow(0 0 4px rgba(249, 115, 22, 0.95))
    drop-shadow(0 0 12px rgba(249, 115, 22, 0.85));
}

@keyframes community-marker-pulse {
  0%, 100% {
    filter:
      drop-shadow(0 0 4px rgba(220, 38, 38, 0.95))
      drop-shadow(0 0 10px rgba(220, 38, 38, 0.6));
  }
  50% {
    filter:
      drop-shadow(0 0 6px rgba(220, 38, 38, 1))
      drop-shadow(0 0 20px rgba(220, 38, 38, 0.9));
  }
}

.community-popup-views {
  margin-top: 4px;
  font-size: 12px;
  color: var(--viewer-text-muted, #64748b);
}

.community-detail-yes {
  color: #059669;
  font-weight: 600;
}

.community-detail-no {
  color: #dc2626;
  font-weight: 600;
}

/* Leaflet popup theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--viewer-card-bg, #fff) !important;
  color: var(--viewer-text, #1e293b) !important;
}
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}
.leaflet-popup-content {
  color: var(--viewer-text, #1e293b) !important;
}
.leaflet-popup-close-button {
  color: var(--viewer-text-muted, #64748b) !important;
}

/* Lighten dark map tiles */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .leaflet-tile-pane {
    filter: brightness(1.5) contrast(0.85);
  }
}
[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(1.5) contrast(0.85);
}

/* Map popup detail */
.community-popup-detail .community-detail-row {
  padding: 4px 0;
  border-bottom: 1px solid var(--viewer-input-border, #e2e8f0);
  font-size: 13px;
}

.community-popup-detail .community-detail-label {
  font-size: 11px;
  color: var(--viewer-text-muted, #64748b);
  margin-bottom: 1px;
}

.community-popup-detail .community-detail-value {
  color: var(--viewer-text, #1e293b);
  word-break: break-word;
}

.community-popup-detail .community-detail-actions {
  margin-top: 8px;
  gap: 4px;
}

.community-popup-detail .community-detail-actions button {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--viewer-input-bg, #f1f5f9);
  color: var(--viewer-text, #1e293b);
  border: 1px solid var(--viewer-input-border, #e2e8f0);
}

/* When detail overlay is open, lower filter bar stacking context */
body.detail-open .community-filter-bar {
  position: relative;
  z-index: auto;
}
body.detail-open .app-header {
  z-index: auto;
}

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 72px;
  background: var(--viewer-toast-bg, rgba(15, 23, 42, 0.95));
  border: 1px solid var(--viewer-toast-border, rgba(0, 136, 238, 0.5));
  color: var(--viewer-toast-text, #f0f9ff);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: var(--viewer-toast-error-border, rgba(220, 38, 38, 0.6));
  color: var(--viewer-toast-error-text, #fecaca);
}

/* Utility */
.is-hidden {
  display: none !important;
}

/* Calendar View */
.community-calendar-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.community-calendar-widget {
  background: var(--viewer-card-bg, #fff);
  border: 1px solid var(--viewer-card-border, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
}

.community-calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.community-calendar-nav button {
  border: none;
  background: none;
  color: var(--viewer-accent, #0088ee);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.community-calendar-month-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--viewer-text, #0f172a);
  flex: 1;
  text-align: center;
}

.community-calendar-today-btn {
  font-size: 12px !important;
  padding: 4px 10px !important;
  border-radius: 6px;
  border: 1px solid var(--viewer-input-border, #e2e8f0) !important;
  background: var(--viewer-input-bg, #fff) !important;
  color: var(--viewer-text-muted, #64748b) !important;
}

.community-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--viewer-text-muted, #64748b);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--viewer-input-border, #e2e8f0);
}

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

.community-calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  position: relative;
  min-height: 36px;
}

.community-calendar-day.empty {
  cursor: default;
}

.community-calendar-day-num {
  font-size: 14px;
  color: var(--viewer-text, #0f172a);
}

.community-calendar-day.today .community-calendar-day-num {
  color: var(--viewer-accent, #0088ee);
  font-weight: 700;
}

.community-calendar-day.selected {
  background: var(--viewer-accent, #0088ee);
}

.community-calendar-day.selected .community-calendar-day-num {
  color: var(--viewer-accent-contrast, #fff);
  font-weight: 700;
}

.community-calendar-day.has-events {
  font-weight: 600;
}

@media (hover: hover) {
  .community-calendar-day:not(.empty):hover {
    background: var(--viewer-accent-tint, rgba(0, 136, 238, 0.1));
  }
  .community-calendar-day.selected:hover {
    background: var(--viewer-accent, #0088ee);
  }
}

.community-calendar-dots {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}

.community-calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.community-calendar-dot.open {
  background: #dc2626;
}

.community-calendar-dot.regular {
  background: #2563eb;
}

.community-calendar-dot.other {
  background: #64748b;
}

.community-calendar-dot.private {
  background: #7c3aed;
}

.community-calendar-dot.practice {
  background: #ea580c;
}

.community-calendar-day.selected .community-calendar-dot.open {
  background: #fca5a5;
}

.community-calendar-day.selected .community-calendar-dot.regular {
  background: #93c5fd;
}

.community-calendar-day.selected .community-calendar-dot.other {
  background: #cbd5e1;
}

.community-calendar-day.selected .community-calendar-dot.private {
  background: #c4b5fd;
}

.community-calendar-day.selected .community-calendar-dot.practice {
  background: #fdba74;
}

.community-calendar-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.community-calendar-events-header {
  font-weight: 600;
  font-size: 14px;
  color: var(--viewer-text, #0f172a);
}

.community-calendar-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.community-filter-disabled-btn {
  opacity: 0.35;
  pointer-events: none;
}

/* Responsive */
@media (min-width: 768px) {
  .community-filter-top {
    gap: 8px;
  }

  .community-filter-top > .community-filter-row {
    gap: 8px;
  }

  .community-filter-location {
    flex-basis: 100%;
  }

  .community-detail-panel {
    max-height: 70vh;
    border-radius: 16px;
    margin-bottom: 10vh;
  }

  .community-detail-overlay {
    align-items: center;
  }

  .community-submit-panel {
    max-height: 75vh;
    border-radius: 16px;
    margin-bottom: 10vh;
  }

  .community-submit-overlay {
    align-items: center;
  }

  .community-calendar-container {
    flex-direction: row;
    align-items: flex-start;
    padding: 12px 24px;
    gap: 24px;
  }

  .community-calendar-widget {
    flex: 0 0 480px;
    position: sticky;
    top: 12px;
  }

  .community-calendar-events {
    flex: 1;
    min-width: 0;
  }
}

/* Submit modal tabs */
.community-submit-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--viewer-input-bg, #f1f5f9);
  border-radius: 10px;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  overflow-x: auto;
  scrollbar-width: none;
}

.community-submit-tabs::-webkit-scrollbar {
  display: none;
}

.community-submit-tabs button {
  flex: 1 1 auto;
  min-width: 72px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--viewer-text-muted, #64748b);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.community-submit-tabs button.active {
  background: var(--viewer-accent, #0088ee);
  color: var(--viewer-accent-contrast, #fff);
  box-shadow: 0 2px 6px rgba(0, 136, 238, 0.35);
}

.community-submit-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.community-submit-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--viewer-text, #0f172a);
  margin: 0;
  cursor: pointer;
}

.community-submit-checks input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.community-submit-notice {
  margin: 16px 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.12);
  color: #b45309;
  font-size: 13px;
  text-align: center;
}

/* Detail: view count + report */
.community-detail-views {
  font-size: 12px;
  color: var(--viewer-text-muted, #64748b);
  margin-bottom: 8px;
}

.community-detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--viewer-input-border, #e2e8f0);
}

.community-detail-footer .community-detail-report {
  background: transparent;
  color: #dc2626;
  border: 1px solid #dc2626;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.community-detail-footer .community-detail-report:hover {
  background: #dc2626;
  color: #fff;
}

.community-detail-footer .community-detail-delete {
  margin-left: auto;
}

/* Leaflet popup action bar */
.community-popup-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.community-popup-report,
.community-popup-detail {
  background: transparent;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.4;
  text-decoration: none;
}

.community-popup-report {
  color: #dc2626;
  border: 1px solid #dc2626;
}

.community-popup-detail {
  color: var(--viewer-accent, #0088ee);
  border: 1px solid var(--viewer-accent, #0088ee);
}

@media (hover: hover) {
  .community-popup-report:hover {
    background: #dc2626;
    color: #fff;
  }
  .community-popup-detail:hover {
    background: var(--viewer-accent, #0088ee);
    color: var(--viewer-accent-contrast, #fff);
  }
}

/* Card-level action bar */
.community-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.community-card-report,
.community-card-detail {
  background: transparent;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  font-weight: 600;
}

.community-card-report {
  color: #dc2626;
  border: 1px solid #dc2626;
}

.community-card-detail {
  color: var(--viewer-accent, #0088ee);
  border: 1px solid var(--viewer-accent, #0088ee);
}

@media (hover: hover) {
  .community-card-report:hover {
    background: #dc2626;
    color: #fff;
  }
  .community-card-detail:hover {
    background: var(--viewer-accent, #0088ee);
    color: var(--viewer-accent-contrast, #fff);
  }
}

.community-detail-footer .community-detail-delete {
  background: transparent;
  color: #dc2626;
  border: 1px solid #dc2626;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.community-detail-footer .community-detail-delete:hover {
  background: #dc2626;
  color: #fff;
}

/* Report modal */
.community-report-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.community-report-panel {
  background: var(--viewer-card-bg, #fff);
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 16px;
  animation: slideUp 0.2s ease-out;
}

.community-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.community-report-header h2 {
  font-size: 16px;
  margin: 0;
  color: var(--viewer-text, #0f172a);
}

.community-report-close {
  border: none;
  background: none;
  font-size: 22px;
  color: var(--viewer-text-muted, #64748b);
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.community-report-form label {
  display: block;
  font-size: 13px;
  color: var(--viewer-text-muted, #475569);
  margin-bottom: 4px;
  margin-top: 12px;
}

.community-report-form input,
.community-report-form select,
.community-report-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--viewer-input-border, #e2e8f0);
  background: var(--viewer-input-bg, #fff);
  color: var(--viewer-input-text, #0f172a);
  font-size: 14px;
  box-sizing: border-box;
}

/* Today-emphasis: red glow follows the emoji silhouette (like has-stadium's blue glow). */
.community-marker.today {
  font-size: 38px;
  filter:
    drop-shadow(0 0 4px rgba(220, 38, 38, 0.95))
    drop-shadow(0 0 10px rgba(220, 38, 38, 0.7));
  animation: community-marker-pulse 2s ease-in-out infinite;
}

.community-marker.today.hot,
.community-marker.today.viral {
  font-size: 42px;
}

/* Unified thin scrollbar for scrollable panels */
.community-list-container,
.community-detail-panel,
.community-submit-panel,
.community-calendar-container,
.community-report-panel {
  scrollbar-width: thin;
  scrollbar-color: var(--viewer-thumb-scrollbar) transparent;
}

.community-list-container::-webkit-scrollbar,
.community-detail-panel::-webkit-scrollbar,
.community-submit-panel::-webkit-scrollbar,
.community-calendar-container::-webkit-scrollbar,
.community-report-panel::-webkit-scrollbar {
  width: 6px;
}

.community-list-container::-webkit-scrollbar-track,
.community-detail-panel::-webkit-scrollbar-track,
.community-submit-panel::-webkit-scrollbar-track,
.community-calendar-container::-webkit-scrollbar-track,
.community-report-panel::-webkit-scrollbar-track {
  background: transparent;
}

.community-list-container::-webkit-scrollbar-thumb,
.community-detail-panel::-webkit-scrollbar-thumb,
.community-submit-panel::-webkit-scrollbar-thumb,
.community-calendar-container::-webkit-scrollbar-thumb,
.community-report-panel::-webkit-scrollbar-thumb {
  background: var(--viewer-thumb-scrollbar);
  border-radius: 999px;
}
