/* ===================================================================
   TENNISON — p5-schedule-override.css
   Страница: /tournament/schedule, /tournament/
   Дата: 24 июня 2026

   6 dropdown-фильтров в одной панели + «Мои» / «Календарь» в шапке.
   =================================================================== */

/* ===== 1. ПРЯЧЕМ СТАРЫЙ БЛОК ФИЛЬТРОВ ===== */
/* Строка селектов — скрыта, UI строит p5-schedule.js */
.sched-v2 .mainV2__filters-row {
  display: none !important;
}
/* Кнопку «Мои» тоже убираем из старой позиции — переносим в топ */
.sched-v2 .mainV2__search-row--schedule-top {
  display: none !important;
}

/* ===== 2. НОВАЯ ТОП-СТРОКА (заголовок + кнопки) ===== */
.sched-v2__toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  padding-bottom: 0;
  position: relative;
  z-index: 120 !important;
  overflow: visible;
}
.sched-v2__toprow.is-calendar-open {
  z-index: 480 !important;
}

/* Заголовок — оставляем h1 на месте, просто убираем его margin-bottom */
.sched-v2 .mainV2__page-title {
  margin-bottom: 0 !important;
  flex: 1;
}

/* Кнопки справа от заголовка */
.sched-v2__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

/* Кнопка «Мои» — лёгкая */
.sched-v2__btn-my {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mv2-secondary, #6F6F6F);
  background: var(--mv2-card, #fff);
  border: 0.5px solid rgba(31,31,31,.12);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-family: var(--mv2-font);
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.sched-v2__btn-my.is-active {
  background: var(--mv2-win-bg, #E8F5A3);
  color: var(--mv2-accent-dark, #6B8E00);
  border-color: rgba(107,142,0,.2);
}
.sched-v2__btn-my i { font-size: 15px; }

/* Кнопка «Календарь» — выпадающее меню рядом с «Мои» */
.sched-v2__calendar-wrap {
  display: block;
  position: relative;
  z-index: 481 !important;
}
.sched-v2 .mainV2__season-actions,
.sched-v6-page .mainV2__season-actions {
  display: none !important;
}
.sched-v2__btn-calendar {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mv2-text, #1F1F1F);
  background: var(--mv2-card, #fff);
  border: 0.5px solid rgba(31,31,31,.12);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-family: var(--mv2-font);
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.sched-v2__btn-calendar.is-active,
.sched-v2__btn-calendar[aria-expanded="true"] {
  background: var(--mv2-bg, #F4F5F6);
  border-color: rgba(31,31,31,.18);
}
.sched-v2__btn-calendar i { font-size: 15px; color: var(--mv2-secondary, #6F6F6F); }
.sched-v2__calendar-menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 200px;
  background: var(--mv2-card, #fff);
  border: 0.5px solid rgba(31,31,31,.10);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(31,31,31,.12);
  padding: 6px;
  z-index: 10050 !important;
}
.sched-v2__calendar-menu[hidden] {
  display: none !important;
}
.sched-v2__calendar-item {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mv2-text, #1F1F1F);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}
.sched-v2__calendar-item:hover,
.sched-v2__calendar-item:focus-visible {
  background: var(--mv2-bg, #F4F5F6);
  color: var(--mv2-text, #1F1F1F);
}

/* ===== 3. ПАНЕЛЬ DROPDOWN-ФИЛЬТРОВ ===== */
/* mobile WebKit: список категорий не должен уходить под карточки экспресса */
body.v2-page .mainV2__shell .sched-v2 .sched-v6__layout,
body.v2-page .mainV2__shell .sched-v2 .sched-v6__main,
body.v2-page .mainV2__shell .sched-v2 .mainV2__schedule,
body.v2-page .mainV2__shell .sched-v2 .mainV2__month-block,
body.v2-page .mainV2__shell .sched-v2 .mainV2__month-body {
  position: relative;
  z-index: 0 !important;
}

.sched-v2__filters-bar {
  margin: 10px 0 12px;
  position: relative;
  z-index: 120 !important;
  overflow: visible;
}
.sched-v2__filters-bar[hidden] {
  display: none !important;
}

.sched-v2__filters-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sched-v2__dd {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1 1 calc(16.666% - 6px);
  max-width: calc(16.666% - 4px);
}
.sched-v2__dd:has(.sched-v2__dd-btn.is-open) {
  z-index: 130 !important;
}
.sched-v2__dd.is-hidden {
  display: none !important;
}

.sched-v2__dd-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 0.5px solid rgba(31,31,31,.12);
  background: var(--mv2-card, #fff);
  color: var(--mv2-secondary, #6F6F6F);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--mv2-font);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
  -webkit-tap-highlight-color: transparent;
}
.sched-v2__dd-btn.is-set {
  color: var(--mv2-text, #1F1F1F);
  font-weight: 600;
  border-color: rgba(31,31,31,.2);
}
.sched-v2__dd-btn.is-open {
  background: var(--mv2-bg, #F4F5F6);
  border-color: rgba(31,31,31,.2);
  position: relative;
  z-index: 201 !important;
}
.sched-v2__dd-btn .ti-map-pin {
  font-size: 13px;
  flex-shrink: 0;
}
.sched-v2__dd-btn-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.sched-v2__dd-btn .ti-chevron-down {
  font-size: 13px;
  color: var(--mv2-muted, #A0A0A0);
  flex-shrink: 0;
  transition: transform .15s;
}
.sched-v2__dd-btn.is-open .ti-chevron-down {
  transform: rotate(180deg);
}

.sched-v2__dd-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(280px, 92vw);
  background: var(--mv2-card, #fff);
  border: 0.5px solid rgba(31,31,31,.10);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(31,31,31,.12);
  padding: 4px;
  z-index: 200 !important;
}
.sched-v2__dd-menu[hidden] {
  display: none !important;
}
body.v2-page .mainV2__shell .sched-v2 .sched-v2__dd-menu.is-ported.is-fixed {
  position: fixed !important;
  z-index: 10050 !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

.sched-v2__dd-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--mv2-text, #1F1F1F);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--mv2-font);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-v2__dd-item:hover,
.sched-v2__dd-item.is-active {
  background: var(--mv2-bg, #F4F5F6);
}
.sched-v2__dd-item.is-active {
  font-weight: 600;
}

.sched-v2__dd-menu--city {
  min-width: 220px;
}
.sched-v2__dd-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 0.5px solid rgba(31,31,31,.08);
}
.sched-v2__dd-search i {
  font-size: 14px;
  color: var(--mv2-muted, #A0A0A0);
}
.sched-v2__dd-search input {
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
  color: var(--mv2-text, #1F1F1F);
  width: 100%;
  font-family: var(--mv2-font);
}
.sched-v2__dd-list {
  max-height: min(240px, 40vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Старые табы и «Для меня» — заменены dropdown-панелью */
.sched-v2 .sched-v6__tabs,
.sched-v2 .sched-v6__ctx {
  display: none !important;
}

@media (max-width: 990px) {
  .sched-v2__dd {
    flex: 1 1 calc(33.333% - 6px);
    max-width: calc(33.333% - 4px);
  }
  body.v2-page .mainV2__shell .sched-v2 .sched-v2__dd-menu.is-ported.is-fixed {
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  body.v2-page .mainV2__shell .sched-v2 .sched-v2__dd-menu--city.is-ported.is-fixed {
    overflow-y: hidden !important;
  }
}

@media (max-width: 480px) {
  .sched-v2__dd-btn {
    padding: 7px 8px;
    font-size: 11px;
  }
}

/* ===== 4. «МОИ ТУРНИРЫ» НАВЕРХУ ===== */
/* ingame-блок JS переносит в начало .mainV2__schedule.
   Здесь только убираем margin-top который был для нижнего положения */
.sched-v2 .mainV2__sched-ingame-header.sched-v2--top {
  margin-top: 0 !important;
  border-radius: var(--mv2-r-lg, 12px) var(--mv2-r-lg, 12px) 0 0 !important;
}
.sched-v2 .mainV2__sched-ingame-body.sched-v2--top {
  margin-bottom: 16px;
  border-radius: 0 0 var(--mv2-r-lg, 12px) var(--mv2-r-lg, 12px) !important;
}

/* ===== 6. ДЕДЛАЙН — строка под датами ===== */
.sched-v2__deadline {
  font-size: 11px;
  font-weight: 600;
  color: var(--mv2-sens-text, #633806);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sched-v2__deadline i { font-size: 11px; }
/* Когда много времени — серый */
.sched-v2__deadline--normal {
  color: var(--mv2-muted, #A0A0A0);
  font-weight: 400;
}

/* ===== 7. СЧЁТЧИК УЧАСТНИКОВ НА МОБАЙЛЕ ===== */
.sched-v2__count {
  display: none; /* показывается JS только если есть участники */
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--mv2-secondary, #6F6F6F);
  flex-shrink: 0;
}
.sched-v2__count.visible { display: flex; }

.sched-v2__count-num {
  font-weight: 600;
  color: var(--mv2-text, #1F1F1F);
}
.sched-v2__count-badge--last {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--mv2-sens-bg, #FAEEDA);
  color: var(--mv2-sens-text, #633806);
  white-space: nowrap;
}

@media (max-width: 990px) {
  /* На мобайле прячем аватарки, показываем счётчик */
  .mainV2__sched-slots { display: none !important; }
  .sched-v2__count { display: flex; }
  .sched-v2__count:not(.visible) { display: none; }

}

@media (min-width: 991px) {
  /* На десктопе счётчик не нужен — аватарки видны */
  .sched-v2__count { display: none !important; }
}

/* ===== 8. НЕБОЛЬШИЕ УЛУЧШЕНИЯ КАРТОЧЕК ===== */
/* season-banner — убираем лишний нижний отступ */
.sched-v2 .mainV2__season-banner {
  margin-bottom: 16px;
}

/* Кнопки баннера сезона — чуть ярче обводка */
.sched-v2 .mainV2__season-banner .mainV2__btn-outline,
.sched-v6-page .mainV2__season-banner .mainV2__btn-outline {
  border: 1px solid rgba(31, 31, 31, 0.24);
  font-weight: 600;
  color: var(--mv2-text, #1F1F1F);
}

.sched-v2 .mainV2__season-banner .mainV2__btn-outline:hover,
.sched-v6-page .mainV2__season-banner .mainV2__btn-outline:hover {
  border-color: rgba(31, 31, 31, 0.36);
  background: var(--mv2-bg, #F4F5F6);
}

/* Убираем лишний gap в sched-row на десктопе с новым счётчиком */
.sched-v2 .mainV2__sched-row {
  position: relative;
}

/* Wrapper для page — нужен для position: absolute overlay */
.sched-v2 .mainV2__page--inner {
  position: relative;
}
