/**
 * Afisha v2 - List Page Filters & Grid
 * Filter bar, card grid layout, infinite scroll, empty state
 * @version 2.0.0
 * @date 2026-02-27
 */

/* ===================================
   FILTER BAR — sticky, glassmorphism (matches masters-v2/listing.css)
   =================================== */

.afisha-filter-bar {
  margin: 24px 0;
  position: sticky;
  top: var(--header-h, 56px);
  z-index: var(--z-sticky, 20);
}

.afisha-filter-inner {
  background: rgba(26, 26, 27, 0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--color-border, #333);
  border-radius: var(--radius-lg, 12px);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  transition: box-shadow var(--transition-fast, 150ms);
}

:root:not(.dark-theme) .afisha-filter-inner {
  background: rgba(255, 255, 255, 0.92);
}

.afisha-filter-fields {
  display: contents;
}

.afisha-filter-dropdown {
  position: relative;
}

.afisha-filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border, #333);
  border-radius: var(--radius-md, 8px);
  padding: 10px 36px 10px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition-fast, 150ms);
  font-family: inherit;
}

:root:not(.dark-theme) .afisha-filter-select {
  background: rgba(0, 0, 0, 0.03);
  color: var(--color-text);
}

.afisha-filter-dropdown::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-text-muted, #666);
  pointer-events: none;
}

/* CustomSelect trigger inherits filter width */
.afisha-filter-dropdown .custom-select-trigger {
  min-width: 140px;
}

.afisha-filter-select:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

:root:not(.dark-theme) .afisha-filter-select:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

.afisha-filter-select:focus {
  outline: none;
  border-color: var(--color-brand-accent, #E8C547);
}

/* ===================================
   CARD GRID — CSS Grid, equal cards (Founder 2026-05-11 decision)
   Row-by-row reading order, infinite-scroll-safe, no reflow on append.
   Cards align-self:start so short content doesn't stretch to row height.
   =================================== */

.afisha-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--afisha-grid-gap);
  align-items: start;
}

.afisha-grid > .afisha-card,
.afisha-grid > .ev-card {
  align-self: start;
}

@media (max-width: 1280px) {
  .afisha-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .afisha-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .afisha-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .afisha-grid { grid-template-columns: 1fr; }
  .afisha-filter-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .afisha-filter-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .afisha-filter-select {
    width: 100%;
  }
  .afisha-filter-dropdown .custom-select-trigger {
    min-width: 100%;
  }
  .afisha-filter-count {
    margin-left: 0;
    width: 100%;
  }
  .afisha-view-toggle {
    margin-left: 0;
  }
}

/* ===================================
   INFINITE SCROLL LOADING SPINNER
   =================================== */

.afisha-scroll-loader {
  display: none;
  justify-content: center;
  padding: var(--space-xl, 24px) 0;
}

.afisha-scroll-loader--active {
  display: flex;
}

.afisha-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color, #444);
  border-top-color: var(--color-brand-accent);
  border-radius: 50%;
  animation: afisha-spin 0.7s linear infinite;
}

@keyframes afisha-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===================================
   EMPTY STATE
   =================================== */

.afisha-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
  grid-column: 1 / -1;
}

.afisha-empty__icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.afisha-empty__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-sm) 0;
}

.afisha-empty__text {
  font-size: var(--font-size-base);
  color: var(--text-muted);
}

/* ===================================
   PAGE HERO (matches masters-v2/listing.css)
   =================================== */

.afisha-page-hero {
  padding: 0;
  margin-bottom: 0;
}

.afisha-page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 8px;
  color: var(--color-text);
}

.afisha-subtitle {
  color: var(--color-text-secondary);
  font-size: 15px;
  margin: 0;
}

.afisha-subtitle strong {
  color: var(--color-brand-accent, #E8C547);
  font-weight: 600;
}

.afisha-filter-count strong {
  color: var(--color-brand-accent, #E8C547);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ===================================
   FILTER COUNT (inside filter bar)
   =================================== */

.afisha-filter-count {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--color-text-muted, #666);
  white-space: nowrap;
}

/* ===================================
   FILTER ACTIONS (reset button)
   =================================== */

.afisha-filter-reset {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid rgba(245, 197, 24, 0.3);
  border-radius: 20px;
  background: rgba(245, 197, 24, 0.1);
  color: var(--color-accent, #f5c518);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}

.afisha-filter-reset:hover {
  background: rgba(245, 197, 24, 0.2);
  border-color: rgba(245, 197, 24, 0.5);
}

.afisha-filter-reset.is-visible {
  display: inline-flex;
}

.afisha-filter-reset svg {
  flex-shrink: 0;
}

/* ===================================
   VIEW TOGGLE BUTTONS
   =================================== */

.afisha-view-toggle {
  display: flex;
  gap: 4px;
  margin-left: 8px;
  flex-shrink: 0;
}

.afisha-view-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 4px);
  background: transparent;
  border: 1px solid var(--color-border, #333);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast, 150ms);
  line-height: 1;
}

.afisha-view-toggle-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text);
}

:root:not(.dark-theme) .afisha-view-toggle-btn:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--color-text);
}

.afisha-view-toggle-btn.active {
  background: var(--color-brand-accent, #E8C547);
  color: #0a0a0b;
  border-color: var(--color-brand-accent, #E8C547);
}

.afisha-view-toggle-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ===================================
   MAP CONTAINER — Split layout (matches masters-v2/map.css)
   =================================== */

.afisha-map-wrapper {
  margin: 24px 0 0;
}

.afisha-map-split {
  display: flex;
  gap: 0;
  height: 600px;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--color-border, #333);
  overflow: hidden;
  background: var(--color-bg-card);
}

#afisha-map {
  flex: 0 0 75%;
  width: 75%;
  height: 100%;
  border-radius: 0;
  border: none;
  background: var(--color-bg-card);
}

/* --- Card Panel (left sidebar) --- */

.afisha-map-panel {
  flex: 0 0 25%;
  width: 25%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border, #333);
  background: var(--color-bg, #0a0a0b);
}

:root:not(.dark-theme) .afisha-map-panel {
  background: #fafafa;
  border-right-color: rgba(0, 0, 0, 0.1);
}

.afisha-map-panel-header {
  padding: 12px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border, #333);
  flex-shrink: 0;
}

:root:not(.dark-theme) .afisha-map-panel-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  color: #666;
}

.afisha-map-cards {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

:root:not(.dark-theme) .afisha-map-cards {
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* --- Map Sidebar Card --- */

.afisha-map-card {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background var(--transition-fast, 150ms);
  cursor: pointer;
}

.afisha-map-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.afisha-map-card--active {
  background: rgba(232, 197, 71, 0.1);
  border-left: 3px solid var(--color-brand-accent, #E8C547);
  padding-left: 13px;
}

:root:not(.dark-theme) .afisha-map-card {
  color: var(--color-text);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

:root:not(.dark-theme) .afisha-map-card:hover {
  background: rgba(0, 0, 0, 0.04);
}

:root:not(.dark-theme) .afisha-map-card--active {
  background: rgba(232, 197, 71, 0.08);
}

.afisha-map-card__image {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm, 4px);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-bg-card);
}

.afisha-map-card__info {
  flex: 1;
  min-width: 0;
}

.afisha-map-card__name {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afisha-map-card__location {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afisha-map-card__date {
  font-size: var(--text-xs);
  color: var(--color-brand-accent, #E8C547);
  margin-top: 4px;
}

/* --- Zoom notice --- */

.afisha-map-zoom-notice {
  padding: 10px 16px;
  font-size: var(--text-xs);
  color: var(--color-text-muted, #666);
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

:root:not(.dark-theme) .afisha-map-zoom-notice {
  border-top-color: rgba(0, 0, 0, 0.06);
}

/* --- Empty state --- */

.afisha-map-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--color-text-muted, #666);
  font-size: var(--text-sm);
}

/* ===================================
   MAP-VIEW-ACTIVE (hide grid elements)
   =================================== */

.afisha-map-view-active .afisha-grid {
  display: none;
}

.afisha-map-view-active #afisha-scroll-sentinel {
  display: none;
}

.afisha-map-view-active .afisha-scroll-loader {
  display: none;
}

.afisha-map-view-active .afisha-seo-section {
  display: none;
}

/* ===================================
   ADDRESS SEARCH BAR
   =================================== */

.afisha-map-search {
  position: relative;
  margin-bottom: 12px;
}

.afisha-map-search input {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-md, 8px);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border, #333);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition-fast, 150ms);
  box-sizing: border-box;
}

.afisha-map-search input::placeholder {
  color: var(--color-text-muted, #666);
}

.afisha-map-search input:focus {
  outline: none;
  border-color: var(--color-brand-accent, #E8C547);
}

:root:not(.dark-theme) .afisha-map-search input {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--color-text);
}

.afisha-map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border, #333);
  border-radius: var(--radius-md, 8px);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  margin-top: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

:root:not(.dark-theme) .afisha-map-search-results {
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.afisha-map-search-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-fast, 150ms);
}

.afisha-map-search-item:last-child {
  border-bottom: none;
}

.afisha-map-search-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

:root:not(.dark-theme) .afisha-map-search-item {
  color: var(--color-text);
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

:root:not(.dark-theme) .afisha-map-search-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* ===================================
   MAPLIBRE POPUP OVERRIDES
   =================================== */

.afisha-popup-wrapper .maplibregl-popup-content {
  background: var(--color-bg-card) !important;
  color: var(--color-text) !important;
  border-radius: var(--radius-md, 8px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
  border: 1px solid var(--color-border, #333) !important;
  padding: 12px !important;
}

.afisha-popup-wrapper .maplibregl-popup-tip {
  border-top-color: var(--color-bg-card) !important;
}

:root:not(.dark-theme) .afisha-popup-wrapper .maplibregl-popup-content {
  background: #fff !important;
  color: var(--color-text) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

:root:not(.dark-theme) .afisha-popup-wrapper .maplibregl-popup-tip {
  border-top-color: #fff !important;
}

/* Popup close button */
.afisha-popup-wrapper .maplibregl-popup-close-button {
  color: var(--color-text-muted, #666) !important;
  font-size: var(--text-lg);
  padding: 4px 8px;
}

.afisha-popup-wrapper .maplibregl-popup-close-button:hover {
  color: var(--color-text) !important;
  background: transparent !important;
}

/* ===================================
   POPUP CARD (mini event card)
   =================================== */

.afisha-map-popup {
  display: flex;
  gap: 10px;
  max-width: 260px;
  text-decoration: none;
  color: inherit;
}

.afisha-popup-photo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm, 4px);
  object-fit: cover;
  flex-shrink: 0;
}

.afisha-popup-info {
  flex: 1;
  min-width: 0;
}

.afisha-popup-name {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afisha-popup-location {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afisha-popup-date {
  font-size: var(--text-xs);
  color: var(--color-brand-accent, #E8C547);
  margin-top: 4px;
}

/* ===================================
   MAPLIBRE NAVIGATION CONTROLS
   =================================== */

.afisha-map-wrapper .maplibregl-ctrl-group {
  background: var(--color-bg-card) !important;
  border: 1px solid var(--color-border, #333) !important;
  border-radius: var(--radius-sm, 4px) !important;
}

.afisha-map-wrapper .maplibregl-ctrl-group button {
  background-color: var(--color-bg-card) !important;
  border-bottom-color: var(--color-border, #333) !important;
}

.afisha-map-wrapper .maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--color-border, #333) !important;
}

.afisha-map-wrapper .maplibregl-ctrl-group button span {
  filter: invert(1);
}

.afisha-map-wrapper .maplibregl-ctrl-group button:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

:root:not(.dark-theme) .afisha-map-wrapper .maplibregl-ctrl-group {
  background: #fff !important;
  border-color: #ccc !important;
}

:root:not(.dark-theme) .afisha-map-wrapper .maplibregl-ctrl-group button {
  background-color: #fff !important;
  border-bottom-color: #ccc !important;
}

:root:not(.dark-theme) .afisha-map-wrapper .maplibregl-ctrl-group button + button {
  border-top-color: #ccc !important;
}

:root:not(.dark-theme) .afisha-map-wrapper .maplibregl-ctrl-group button span {
  filter: none;
}

:root:not(.dark-theme) .afisha-map-wrapper .maplibregl-ctrl-group button:hover {
  background-color: #f4f4f4 !important;
}

/* ===================================
   MAPLIBRE ATTRIBUTION
   =================================== */

.afisha-map-wrapper .maplibregl-ctrl-attrib {
  font-size: 10px !important;
  opacity: 0.6;
  background: transparent !important;
}

.afisha-map-wrapper .maplibregl-ctrl-attrib a {
  color: var(--color-text-muted, #666) !important;
}

/* ===================================
   WEBGL FALLBACK
   =================================== */

.map-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--color-text-secondary);
  padding: 40px 20px;
}

.map-unsupported p {
  margin: 4px 0;
  font-size: var(--text-sm);
}

/* ===================================
   BACK TO LIST BUTTON (mobile floating)
   =================================== */

.afisha-back-to-list {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 24px;
  border-radius: 100px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border, #333);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all var(--transition-fast, 150ms);
}

.afisha-back-to-list:hover {
  background: var(--color-brand-accent, #E8C547);
  color: #0a0a0b;
  border-color: var(--color-brand-accent, #E8C547);
}

:root:not(.dark-theme) .afisha-back-to-list {
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ===================================
   RESPONSIVE (map view)
   =================================== */

@media (max-width: 900px) {
  .afisha-map-split {
    height: 500px;
  }

  .afisha-view-toggle {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  /* Stack vertically: cards on top, map below */
  .afisha-map-split {
    flex-direction: column;
    height: auto;
    border-radius: var(--radius-md, 8px);
  }

  #afisha-map {
    flex: none;
    width: 100%;
    height: 50vh;
    min-height: 300px;
  }

  .afisha-map-panel {
    flex: none;
    width: 100%;
    height: auto;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--color-border, #333);
  }

  .afisha-map-cards {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0;
  }

  .afisha-map-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  :root:not(.dark-theme) .afisha-map-card {
    border-right-color: rgba(0, 0, 0, 0.06);
  }

  .afisha-map-card--active {
    border-left: none;
    padding-left: 16px;
    border-bottom: 3px solid var(--color-brand-accent, #E8C547);
  }

  .afisha-map-zoom-notice {
    flex: 0 0 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: none;
  }
}

@media (max-width: 540px) {
  .afisha-map-view-active .afisha-back-to-list {
    display: block;
  }

  .afisha-map-view-active .afisha-map-wrapper {
    padding: 0;
  }

  .afisha-map-view-active .afisha-map-search {
    padding: 0 16px;
  }

  #afisha-map {
    height: 45vh;
    min-height: 260px;
  }

  .afisha-map-split {
    border-radius: 0;
  }
}

/* ===================================
   SEO CONTENT SECTION
   =================================== */

.afisha-seo-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-color);
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.afisha-seo-section h2,
.afisha-seo-section h3 {
  color: var(--text-primary);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.afisha-seo-section p {
  margin-bottom: var(--space-md);
}

/* ===================================================================
   W2 (2026-05-11): Calendar widget + persona toggle + chip-row
   Per docs/design/afisha-v2.1/SPEC-calendar-filter-v2.1.md
   Tokens-only; zero hardcoded color/size. Subsystem-local primitives.
   =================================================================== */

/* --- Persona toggle (gold-underline tabs, D2 SPEC s5) -------------- */
.afisha-persona {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  margin-top: var(--space-4);
}
.afisha-persona__tab {
  background: none;
  border: 0;
  padding: var(--space-2) 0;
  min-height: 44px;
  color: var(--color-text-secondary);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.afisha-persona__tab:hover { color: var(--color-text); }
.afisha-persona__tab.is-active,
.afisha-persona__tab--active { color: var(--color-text); }
.afisha-persona__tab.is-active::after,
.afisha-persona__tab--active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--color-brand-accent);
}
.afisha-persona__tab:focus-visible {
  outline: 2px solid var(--color-brand-accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}
.afisha-persona__sep {
  color: var(--color-text-muted);
  user-select: none;
}

/* --- Calendar rail wrapper ----------------------------------------- */
.afisha-calendar-range {
  position: relative;
  display: inline-block;
  margin: var(--space-2) 0;
}

.afisha-cal-trigger {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  min-height: 44px;
}
.afisha-cal-trigger.is-active {
  background: var(--color-brand-accent);
  color: var(--color-gray-900);
  border-color: var(--color-brand-accent);
}

/* --- Calendar panel (popover desktop, sheet mobile) ---------------- */
.afisha-cal-panel {
  background: var(--color-bg-card, var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 320px;
}
.afisha-cal-panel.is-popover {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: var(--z-sticky, 20);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
@media (min-width: 1024px) {
  .afisha-cal-panel.is-popover { min-width: 680px; }
}
.afisha-cal-panel.is-in-sheet {
  position: static;
  border: 0;
  box-shadow: none;
  padding: var(--space-4) var(--space-2);
  min-width: 0;
  width: 100%;
}

.afisha-cal-panel__caption {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.afisha-cal-panel__caption-bullet { color: var(--color-brand-accent); }
.afisha-cal-reset {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  min-height: 44px;
  transition: color var(--transition-fast);
}
.afisha-cal-reset:hover { color: var(--color-brand-accent); }

/* --- Preset pills row ---------------------------------------------- */
.afisha-cal-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.afisha-cal-preset { min-height: 36px; }

/* --- Months grid --------------------------------------------------- */
.afisha-cal-months {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 1024px) {
  .afisha-cal-months { grid-template-columns: 1fr 1fr; }
}

.afisha-cal-month__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.afisha-cal-month__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-normal);
  color: var(--color-text);
  margin: 0;
}
.afisha-cal-month__year {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--letter-spacing-caps);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}
.afisha-cal-nav {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.afisha-cal-nav:hover { border-color: var(--color-brand-accent); }
.afisha-cal-nav:focus-visible {
  outline: 2px solid var(--color-brand-accent);
  outline-offset: 2px;
}

.afisha-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: var(--space-2);
}

.afisha-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.afisha-cal-grid [role="row"] {
  display: contents;
}

.afisha-cal-day {
  background: var(--color-bg-card, var(--color-surface));
  border: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text);
  min-height: 44px;
  cursor: pointer;
  position: relative;
  padding: var(--space-2) 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.afisha-cal-day:hover {
  background: color-mix(in srgb, var(--color-brand-accent) 18%, transparent);
}
.afisha-cal-day.is-muted { color: var(--color-text-muted); opacity: 0.45; }
.afisha-cal-day.is-today { font-weight: var(--font-weight-semibold); }
.afisha-cal-day.has-events::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--color-brand-accent);
}
.afisha-cal-day.is-in-range {
  background: color-mix(in srgb, var(--color-brand-accent) 12%, transparent);
}
.afisha-cal-day.is-range-start,
.afisha-cal-day.is-range-end {
  background: var(--color-brand-accent);
  color: var(--color-gray-900);
}
.afisha-cal-day.is-range-start.has-events::after,
.afisha-cal-day.is-range-end.has-events::after {
  background: var(--color-gray-900);
}
.afisha-cal-day:focus-visible {
  outline: 2px solid var(--color-brand-accent);
  outline-offset: -2px;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .afisha-cal-day { transition: none; }
}

/* --- Summary strip -------------------------------------------------- */
.afisha-cal-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.afisha-cal-summary__bullet { color: var(--color-brand-accent); margin-right: var(--space-2); }
.afisha-cal-summary strong { color: var(--color-brand-accent); font-weight: var(--font-weight-normal); }

/* --- Action bar ----------------------------------------------------- */
.afisha-cal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.afisha-cal-apply__count {
  font-family: var(--font-mono);
  color: var(--color-brand-accent);
  margin-left: var(--space-1);
}

/* --- Chip row (active filters) ------------------------------------- */
.afisha-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0;
  align-items: center;
}
.afisha-chip-row:empty { display: none; }
.afisha-chip-row .btn--pill--chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding-right: var(--space-2);
  min-height: 36px;
}
.afisha-chip-row .btn--pill__x {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}
.afisha-chip-row .btn--pill--chip:hover .btn--pill__x { color: var(--color-text); }
.afisha-chip-row .btn--pill--chip:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}
.afisha-clear-all {
  margin-left: auto;
  display: none;
}
.afisha-chip-row[data-active-count="2"] .afisha-clear-all,
.afisha-chip-row[data-active-count="3"] .afisha-clear-all,
.afisha-chip-row[data-active-count="4"] .afisha-clear-all,
.afisha-chip-row[data-active-count="5"] .afisha-clear-all,
.afisha-chip-row[data-active-count="6"] .afisha-clear-all,
.afisha-chip-row[data-active-count="7"] .afisha-clear-all,
.afisha-chip-row[data-active-count="8"] .afisha-clear-all {
  display: inline-flex;
}

/* --- Empty-state mount (W3B populates) ----------------------------- */
#afisha-empty-state[hidden] { display: none; }

/* --- Hide native select when ds-listbox wraps it (no-JS fallback in DOM) --- */
[data-ds-listbox] .ds-listbox__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ───────────────────────────────────────────────
   Mobile filter toggle (collapsed by default)
   ─────────────────────────────────────────────── */
.afisha-filter-toggle {
  display: none; /* visible only on mobile */
  align-items: center;
  gap: 8px;
  min-height: 44px;
  width: 100%;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-base, 1rem);
  font-weight: var(--font-weight-medium, 500);
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.light-theme .afisha-filter-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}
.afisha-filter-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}
.light-theme .afisha-filter-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
}
.afisha-filter-toggle__text {
  flex: 1;
  text-align: left;
}
.afisha-filter-toggle__badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--color-brand-accent);
  color: #0A0A0A;
  border-radius: 11px;
  font-size: var(--text-xs, 0.75rem);
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.afisha-filter-toggle__badge[hidden] {
  display: none;
}
.afisha-filter-toggle__chevron {
  transition: transform 200ms ease;
  flex-shrink: 0;
}
.afisha-filter-toggle[aria-expanded="true"] .afisha-filter-toggle__chevron {
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .afisha-filter-toggle {
    display: flex;
  }
  .afisha-filter-fields {
    display: none !important;
  }
  .afisha-filter-bar.is-expanded .afisha-filter-fields,
  .afisha-filter-fields.is-open {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
  }
}
