/* ===== Design tokens ===== */
:root {
  --fg-primary: #1a1d21;
  --fg-secondary: #606977;
  --fg-tertiary: #88909f;
  --fg-quaternary: #9da4b0;
  --fg-placeholder: #afbaca;

  --brand: #e34d1e;
  --brand-secondary: #ff7141;
  --brand-soft: #fef5ee;
  --brand-light: rgba(227, 77, 30, 0.05);

  --bg-white: #ffffff;
  --bg-soft: #f4f5f6;
  --neutral-dark: #1a1d21;
  --neutral-light: rgba(26, 29, 33, 0.04);

  --border-xsubtle: #ebedef;
  --border-subtle: #c9cdd3;

  --radius-xsm: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-2xl: 16px;
  --radius-3xl: 20px;
  --radius-full: 9999px;

  --shadow-md: 0 2px 4px -1px rgba(18, 18, 23, 0.06), 0 4px 6px -1px rgba(18, 18, 23, 0.08);
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input { font: inherit; }
ul { list-style: none; }

body {
  font-family: 'Manrope', sans-serif;
  background: #eef0f2;
  color: var(--fg-primary);
  -webkit-font-smoothing: antialiased;
  padding: 72px 40px;
}

/* ===== Root card ===== */
.events {
  width: 1184px;
  margin: 0 auto;
  background: var(--bg-soft);
  border-radius: var(--radius-3xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== Header ===== */
.events__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 20px;
}
.events__title {
  font-size: 24px;
  font-weight: 600;
  line-height: 34px;
  letter-spacing: -0.4px;
  color: var(--fg-primary);
}
.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 112px;
  padding: 10px 16px;
  background: var(--brand-light);
  border-radius: var(--radius-md);
}
.btn-add__icon { width: 18px; height: 18px; }
.btn-add__text {
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--brand);
}

/* ===== Panel (white) ===== */
.panel {
  background: var(--bg-white);
  border-radius: var(--radius-3xl);
  padding: 20px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.panel__filters {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 20px;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  padding: 6px;
  background: var(--bg-soft);
  border-radius: var(--radius-2xl);
}
.tabs__item {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.3px;
  color: var(--fg-secondary);
  white-space: nowrap;
}
.tabs__item--active {
  background: var(--bg-white);
  color: var(--brand);
  box-shadow: var(--shadow-md);
}

/* ===== Filter row ===== */
.filter-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.filter-bar {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
}
.filter-bar__divider {
  width: 1px;
  align-self: stretch;
  margin: 4px;
  background: var(--border-xsubtle);
}

/* Search */
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 344px;
  height: 48px;
  padding: 0 12px;
}
.search__icon { width: 24px; height: 24px; flex-shrink: 0; }
.search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--fg-primary);
}
.search__input::placeholder { color: var(--fg-placeholder); }

/* Dropdown */
.dropdown {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 48px;
  padding-left: 8px;
  padding-right: 4px;
}
.dropdown__icon { width: 28px; height: 28px; flex-shrink: 0; }
.dropdown__label {
  flex: 1;
  min-width: 0;
  padding-left: 10px;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--fg-quaternary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown__caret {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
}
.dropdown__border {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
}
.dropdown__caret img {
  width: 16px;
  height: 16px;
  margin: 0 8px;
}

/* Search button */
.btn-search {
  padding: 12px 24px; /* px20 + inner text-area px4 */
  background: var(--brand);
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.3px;
  color: #fff;
  white-space: nowrap;
}

/* ===== Toolbar (badges + sort) ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toolbar__badges { display: flex; gap: 8px; }
.badge {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 2px 8px;
  background: var(--brand-soft);
  border-radius: var(--radius-md);
}
.badge__text {
  padding: 0 2px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--brand-secondary);
}
.badge__icon { width: 16px; height: 16px; }
.btn-sort {
  display: flex;
  align-items: center;
  gap: 0;
  height: 36px;
  padding: 8px 10px;
  background: var(--neutral-light);
  border-radius: var(--radius-md);
}
.btn-sort__text {
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--fg-secondary);
}
.btn-sort__icon { width: 18px; height: 18px; }

/* ===== Divider ===== */
.divider {
  border: none;
  height: 1px;
  background: var(--border-xsubtle);
  margin: 4px 0;
}

/* ===== Events list ===== */
.events-list { display: flex; flex-direction: column; gap: 8px; }
.events-list__divider {
  border: none;
  height: 1px;
  background: var(--border-xsubtle);
  margin: 4px 0;
}

/* ===== Event card ===== */
.event-card {
  display: flex;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-white);
}
.event-card__image-wrap {
  width: 174px;
  height: 120px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.event-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 0.35s ease;
}
.event-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Header inside card */
.event-card__header { display: flex; }
.event-card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event-card__top { display: flex; align-items: flex-start; gap: 20px; }
.event-card__titles {
  flex: 1;
  min-width: 0;
  height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.event-card__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.3px;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-card__subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--fg-quaternary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions */
.event-card__actions {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.event-card__buttons { display: flex; align-items: center; gap: 8px; }
.event-card__menu {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-xsm);
}
.event-card__menu img { width: 16px; height: 16px; }

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.pill__icon { width: 14px; height: 14px; }
.pill__text {
  padding: 0 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: -0.2px;
}
.pill--outline {
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
}
.pill--outline .pill__text { color: var(--fg-secondary); }
.pill--dark { background: var(--neutral-dark); }
.pill--dark .pill__text { color: #fff; }

/* Organizers line */
.event-card__organizers {
  display: flex;
  gap: 4px;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.event-card__organizers-label { font-weight: 400; color: var(--fg-quaternary); }
.event-card__organizers-name { font-weight: 600; color: var(--fg-secondary); }

/* Details */
.event-card__details {
  display: flex;
  align-items: center;
  gap: 12px;
}
.event-card__detail {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.2px;
  color: var(--fg-primary);
  white-space: nowrap;
}
.event-card__details-divider {
  width: 1px;
  height: 12px;
  background: var(--border-xsubtle);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}
.pagination__spinner {
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Interactivity — hover / focus / active states + transitions
   ========================================================================== */

/* Base transitions for interactive elements */
.btn-add,
.btn-search,
.btn-sort,
.btn-sort__icon,
.tabs__item,
.badge,
.badge__icon,
.pill,
.event-card,
.event-card__menu,
.event-card__menu img,
.dropdown__label,
.dropdown__icon,
.search__icon {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    transform 0.12s ease;
}

/* Keyboard focus ring for accessibility */
:where(button, input, a, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* ----- Header: "Додати" ----- */
.btn-add:hover { background: rgba(227, 77, 30, 0.1); }
.btn-add:active { transform: scale(0.97); }

/* ----- Tabs ----- */
.tabs__item { cursor: pointer; }
.tabs__item:not(.tabs__item--active):hover { color: var(--fg-primary); }
.tabs__item--active { cursor: default; }

/* ----- Search field ----- */
.search { cursor: text; }
.filter-bar:focus-within { box-shadow: inset 0 0 0 1px var(--border-subtle); }
.search:focus-within .search__icon { opacity: 0.7; }

/* ----- Dropdowns ----- */
.dropdown { cursor: pointer; }
.dropdown:hover .dropdown__label { color: var(--fg-secondary); }
.dropdown:hover .dropdown__icon { opacity: 0.75; }

/* ----- "Шукати" ----- */
.btn-search:hover { background: #c8441a; }
.btn-search:active { transform: scale(0.98); }

/* ----- Active filter badges ----- */
.badge:hover { background: #fde9dc; }
.badge:hover .badge__icon { transform: rotate(90deg); }

/* ----- Sort ----- */
.btn-sort:hover { background: rgba(26, 29, 33, 0.08); }
.btn-sort:hover .btn-sort__icon { transform: translateY(2px); }
.btn-sort:active { transform: scale(0.98); }

/* ----- Card action pills ----- */
.pill--outline:hover { background: var(--bg-soft); border-color: var(--fg-placeholder); }
.pill--dark:hover { background: #2e333a; }
.pill:active { transform: scale(0.96); }

/* ----- Card overflow menu (…) ----- */
.event-card__menu { cursor: pointer; }
.event-card__menu:hover { background: var(--neutral-light); }
.event-card__menu:active { transform: scale(0.9); }

/* ----- Event card row ----- */
.event-card { cursor: pointer; }
.event-card:hover { background: #f9fafb; }

/* ----- Event card image zoom ----- */
.event-card:hover .event-card__image-wrap .event-card__image { transform: scale(1.15); }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .pagination__spinner { animation: none; }
}
