/* Каталог: боковая панель, подборки и строки меток. */

#sidebar {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  transition: margin-left 0.3s ease;
  display: flex;

  @media (max-width: 760px) {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    min-width: 100%;
    border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--line);
    border-right: 0;
    transition: height 0.25s;
    margin-left: 0 !important;
    height: 46%;
  }

  &.collapsed {
    margin-left: -350px;

    @media (max-width: 760px) {
      margin-left: 0 !important;
    }

    :where([data-layout="desktop"]) & {
      @media (pointer: fine) {
        margin-left: calc(-1 * var(--sidebar-width, 380px));
      }
    }
  }

  :where(body:has(.maparea.selecting)) & {
    @media (max-width: 760px) {
      display: none;
    }
  }

  :where([data-layout="mobile"]) & {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(74px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: 100% !important;
    height: min(66dvh, 650px) !important;
    margin: 0 !important;
    z-index: 40;
    display: none !important;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -16px 60px #0003;
    overflow: hidden;
  }

  :where(body.mobile-list) & {
    :where([data-layout="mobile"]) & {
      display: flex !important;
      bottom: var(--m-nav) !important;
      max-height: calc(100dvh - var(--m-nav) - 80px) !important;
      height: 62dvh !important;
      transition: height 0.22s ease;

      @media (prefers-reduced-motion: reduce) {
        transition: none;
      }
    }
  }

  &::before {
    :where([data-layout="mobile"]) & {
      content: none !important;
      display: none !important;
    }
  }

  :where(body.mobile-list.mobile-list-expanded) & {
    :where([data-layout="mobile"]) & {
      height: calc(100dvh - var(--m-nav) - env(safe-area-inset-top) - 12px) !important;
      max-height: calc(100dvh - var(--m-nav) - env(safe-area-inset-top) - 12px) !important;
      z-index: 75;
    }
  }
}

.sidebarContent {
  width: var(--sidebar-width, 380px);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: opacity 0.2s;

  @media (max-width: 760px) {
    width: 100%;
    border-right: none;
    border-radius: 22px 22px 0 0;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  :where([data-layout="mobile"]) & {
    width: 100% !important;
    height: 100% !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    border: 0;
  }
}

aside.collapsed .sidebarContent {
  opacity: 0;
  pointer-events: none;
}

.collapseBtn {
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 54px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 8px 8px 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  z-index: 20;
  color: var(--muted);
  cursor: pointer;

  @media (max-width: 760px) {
    display: none;
  }

  :where([data-layout="mobile"]) & {
    display: none !important;
  }
}

aside.collapsed .collapseBtn {
  right: -36px;
  width: 36px;
  border-left: 1px solid var(--line);
  border-radius: 8px;
}

.sidehead {
  padding: 24px 20px 0;
  position: relative;

  @media (max-width: 760px) {
    padding: 0 15px;
  }

  @media (min-width: 761px) {
    padding: 22px 20px 0;
  }

  :where([data-layout="mobile"]) & {
    padding: 10px 16px 0 !important;
  }
}

.titleline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;

  @media (max-width: 760px) {
    margin-bottom: 4px;
  }

  @media (min-width: 761px) {
    gap: 8px;
    justify-content: flex-start;
    margin-bottom: 12px;
  }

  :where([data-layout="mobile"]) & {
    margin-bottom: 10px !important;
  }
}

.city {
  font-size: 10px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--soft);
  border-radius: 12px;
  padding: 4px;
  margin-top: 14px;

  @media (max-width: 760px) {
    margin-top: 0;
    gap: 25px;
  }
}

.tabs button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  transition: all 0.2s;
  text-align: center;
  border: none;
  background: transparent;
  cursor: pointer;

  @media (max-width: 760px) {
    min-height: 42px;
    padding: 10px 0;
  }

  @media (min-width: 761px) {
    min-height: 36px;
    font-size: 13px;
  }

  :where([data-layout="mobile"]) & {
    min-height: 42px;
    font-size: 13px;
  }
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 4px #0001;
  font-weight: 800;
}

body.dark .tabs button.active {
  background: #303030;
  color: #fff;
}

.collectionlist {
  flex: 1;
  overflow: auto;
  padding: 9px 10px;

  @media (max-width: 760px) {
    padding: 4px 8px;
    padding-top: 2px;
  }

  :where([data-layout="mobile"]) & {
    padding: 10px 12px !important;
    overscroll-behavior: contain;
  }
}

.collectionrow {
  cursor: pointer;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cast);
  border-radius: 14px;
  padding: 0;
  margin-bottom: 8px;
  overflow: visible;
  background: var(--panel);
}

.collection {
  text-align: left;
  min-height: 60px;
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  margin: 0;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;

  &:hover {
    background: var(--soft);
  }

  :where(body.dark) &.on {
    background: #303030;
  }
}

.tile {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--ink);
  flex-shrink: 0;
  font-size: 18px;
  overflow: hidden;

  @media (max-width: 760px) {
    border-radius: 7px;
    font-size: 15px;
    width: 25px;
    height: 25px;
  }

  @media (min-width: 761px) {
    width: 31px;
    height: 31px;
    font-size: 19px;
  }

  :where([data-layout="mobile"]) & {
    height: 40px;
    width: 40px;
  }
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.on .tile {
  background: var(--accent);
  color: var(--onaccent);
}

.coltext {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.coltext strong {
  display: block;
  font-size: 12px;
  font-weight: 650;

  @media (min-width: 761px) {
    font-size: 14px;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    font-size: 13px;
  }

  :where([data-layout="mobile"]) & {
    font-size: 14px;
  }
}

.coltext small {
  color: var(--muted);
  font-size: 11px;
}

.switch {
  width: 25px;
  height: 15px;
  border-radius: 20px;
  background: var(--line);
  position: relative;
  flex-shrink: 0;
}

.switch:after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--panel);
}

.on .switch {
  background: var(--accent);
}

.on .switch:after {
  left: 13px;
  background: #183424;
}

.rowactions {
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 2px 8px 8px;
  margin: 0;
  font-size: 11px;
}

.rowactions button {
  transition: background 0.2s;
  min-width: 0;
  min-height: 34px;
  padding: 6px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 11px;
  border-radius: 8px;
  color: var(--muted);

  :where([data-layout="mobile"]) & {
    font-size: 12px !important;
  }

  &:disabled {
    cursor: default;
    opacity: 0.6;
  }

  &:hover {
    color: var(--ink);
    background: var(--soft);
  }

  &[aria-pressed="true"] {
    color: var(--ink);
  }
}

.rowactions button svg {
  width: 14px;
  height: 14px;
}

.rowactions .trash-btn {
  margin-left: auto;
  color: #e95e63;
}

.sidefooter {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);

  @media (max-width: 760px) {
    font-size: 9px;
    padding: 5px 14px;
    min-height: 37px;
  }

  @media (min-width: 761px) {
    font-size: 12px;
    min-height: 48px;
  }

  :where([data-layout="mobile"]) & {
    padding: 10px 14px;
    font-size: 11px;
  }
}

.sidefooter button {
  margin-left: auto;
  font-size: 10px;

  @media (max-width: 760px) {
    min-height: 32px;
  }

  @media (min-width: 761px) {
    font-size: 11px;
  }

  :where([data-layout="mobile"]) & {
    min-height: 38px;
    font-size: 11px !important;
  }
}

.liveDot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.emptylist {
  padding: 20px 12px;
  color: var(--muted);
  font-size: 12px;
}

#expand {
  display: none;

  @media (max-width: 760px) {
    display: block;
    flex-shrink: 0;
    padding: 0;
    border-radius: 4px;
    height: 22px;
    width: 60px;
    margin: 2px auto 1px;
    background: none;
    position: relative;
  }

  :where([data-layout="mobile"]) & {
    display: block !important;
    flex-shrink: 0;
    padding: 0;
    width: 100% !important;
    height: 24px !important;
    min-height: 0;
    margin: 0 !important;
    background: none !important;
    border-radius: 0;
    touch-action: none;
  }

  &::after {
    @media (max-width: 760px) {
      content: "";
      display: block;
      width: 42px;
      height: 5px;
      border-radius: 5px;
      background: var(--line);
      position: absolute;
      left: 9px;
      top: 9px;
    }

    :where([data-layout="mobile"]) & {
      left: 50% !important;
      top: 10px !important;
      transform: translateX(-50%);
      width: 36px;
      height: 4px;
    }
  }
}

.on .collection .tile {
  background: var(--accent);
}

.titleline .city {
  display: none;
}

aside.expanded {

  @media (max-width: 760px) {
    height: 86%;
  }
}

.sidehead h1 {

  @media (max-width: 760px) {
    font-size: 20px;
  }

  :where([data-layout="mobile"]) & {
    font-size: 21px;
  }
}

.openCastLink {
  height: 36px;
  width: 36px;
  display: grid;
  place-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 20px;

  @media (max-width: 760px) {
    width: 40px;
    height: 40px;
  }

  @media (min-width: 761px) {
    width: 40px;
    height: 40px;
  }
}

.castIdentity {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 1px;

  @media (min-width: 761px) {
    font-size: 11px;
  }
}

.tile.castTile {
  color: var(--cast);
  background: color-mix(in srgb, var(--cast) 15%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--cast) 55%, transparent);
}

.collection.on .tile.castTile {
  color: var(--cast);
  background: color-mix(in srgb, var(--cast) 15%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--cast) 55%, transparent);
}

.castLabel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 9px;
  color: var(--muted);
  margin: 3px 4px 0 0;
  max-width: 100%;
  overflow-wrap: anywhere;

  @media (max-width: 760px) {
    font-size: 10px;
  }

  @media (min-width: 761px) {
    font-size: 11px;
    padding: 4px 7px;
  }
}

.castLabel i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.placeRowCasts {
  display: flex;
  flex-wrap: wrap;
}

.placesSummary {
  font-size: 10px;
  color: var(--muted);
  padding: 10px;

  @media (max-width: 760px) {
    padding: 8px 10px;
  }

  @media (min-width: 761px) {
    font-size: 12px;
  }
}

.placeRowWrapper {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.placeRowWrapper .placeRow {
  border-bottom: none;
  flex: 1;
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 10px;
  border-radius: 9px;
}

.placeRowWrapper .placeRow:hover {
  background: var(--soft);
}

.placeRowTitle {
  display: block;
  font-size: 13px;
  font-weight: 650;

  @media (min-width: 761px) {
    font-size: 15px;
  }
}

.placeRowAddress {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0;

  @media (min-width: 761px) {
    font-size: 13px;
  }
}

.togglePlaceBtn {
  width: 44px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--muted);
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  transition: all 0.2s;
}

.togglePlaceBtn:hover {
  background: var(--soft);
  color: var(--ink);
}

.togglePlaceBtn.is-hidden {
  color: #e95e63;
  opacity: 0.8;
}

.titleline h1 {
  font-size: 22px;

  @media (max-width: 760px) {
    font-size: 20px;
  }

  @media (min-width: 761px) {
    font-size: 24px;
    flex: 1;
  }
}

#placesList {
  padding-top: 3px;
}

.placeRow {

  @media (max-width: 760px) {
    padding: 13px 10px;
    min-height: 88px;
  }
}

body.dark .castLabel {
  border-color: #424242;
}

body.dark .switch {
  background: #454545;
}

body.dark .on .switch {
  background: var(--accent);
}

body.dark .on .switch:after {
  background: #171717;
}

.sidehead .titleline .openCastLink {
  width: 100%;
  height: auto;
  min-height: 44px;
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  transition: border-color .15s, background .15s;

  @media (min-width: 761px) {
    margin-left: auto;
  }
}

.sidehead .titleline {

  @media (min-width: 761px) {
    margin-bottom: 12px;
  }
}

#castContents {
  max-height: 50vh;
  overflow: auto;
}

#castContents .placeRow {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  margin: 6px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

#castContents .placeRow:hover {
  background: var(--accent-soft);
}

.collectionContents {
  margin: 0 10px 10px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.collectionContents .placeRow {
  width: 100%;
  text-align: left;
  padding: 10px;
}

.collectionContents .placeRowAddress {
  display: block;
}

.resultsHeading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resultsHeading h2 {
  margin: 0;
  font-size: 15px;
}

.resultsHeading button {
  padding: 8px;
  text-decoration: underline;
  font-size: 12px;
}

.collectionHeader {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 4px 0 0;
}

.collectionHeader .castTile {
  background: color-mix(in srgb, var(--cast) 15%, transparent);
  color: var(--cast);
  border: 1px solid color-mix(in srgb, var(--cast) 45%, transparent);
}

.collectionChevron {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s;
}

.collection[aria-expanded="true"] .collectionChevron {
  transform: rotate(180deg);
}

.collectionToggle {
  flex: 0 0 44px;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 4px;
  background: none;
}

.collectionToggle > span {
  display: block;
  width: 32px;
  height: 19px;
  padding: 3px;
  border-radius: 12px;
  background: var(--line);
}

.collectionToggle > span:after {
  content: '';
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 1px 3px #0003;
  transition: transform .15s;
}

.collectionToggle[aria-checked="true"] > span {
  background: var(--accent);
}

.collectionToggle[aria-checked="true"] > span:after {
  transform: translateX(13px);
  background: var(--onaccent);
}

.collectionrow .rowactions svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collectionOptions {
  position: relative;
  flex: 0 0 24px;
}

.collectionOptions summary {
  cursor: pointer;
  padding: 8px 2px;
  list-style: none;
  font-size: 20px;
}

.collectionOptions summary::-webkit-details-marker {
  display: none;
}

.collectionOptions > div {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 5;
  display: grid;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 30px #0003;
}

.collectionOptions button {
  padding: 10px;
  text-align: left;
  border-radius: 6px;
}

.collectionOptions button:hover {
  background: var(--soft);
}

.sidehead .titleline .openCastLink:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.openCastLink > svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.openCastLink > span {
  display: grid;
  gap: 1px;
  text-align: left;
}

.openCastLink strong {
  font-size: 14px;
  font-weight: 650;
}

.openCastLink small {
  font-size: 11px;
  color: var(--muted);
}

.openCastLink .linkArrow {
  margin-left: auto;
  width: 18px;
  flex-basis: 18px;
  color: var(--muted);
}

#openCastLinkForm input {
  min-height: 52px;
  border-radius: 12px;
}

#openCastLinkForm .primary {
  min-height: 46px;
  width: 100%;
  border-radius: 12px;
}

#clusterPlaces .placeRow {
  width: 100%;
  text-align: left;
}

#clusterPlaces .placeRowAddress {
  display: block;
}

.collectionPlaceRow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.collectionPlaceRow .placeRow {
  flex: 1 1 0;
  min-width: 0;
}

.collectionPlaceRow.placeIsHidden .placeRow {
  opacity: .5;
}

.placeVisibility {
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 4px;
}

.placeVisibility > span {
  display: block;
  width: 30px;
  height: 18px;
  padding: 3px;
  border-radius: 12px;
  background: var(--line);
}

.placeVisibility > span:after {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--panel);
  transition: transform .15s;
}

.placeVisibility[aria-checked="true"] > span {
  background: var(--accent);
}

.placeVisibility[aria-checked="true"] > span:after {
  transform: translateX(12px);
  background: var(--onaccent);
}

.collectionrow .rowactions button[data-copy][aria-pressed="true"] {
  color: #a86b00;
  background: #ffd34d18;
}

.collectionrow .rowactions button[data-copy][aria-pressed="true"] svg {
  fill: #ffd34d;
  stroke: #ba7c00;
}

body.dark .collectionrow .rowactions button[data-copy][aria-pressed="true"] {
  color: #ffdc68;
}

.sidebarResize {
  display: none;

  :where([data-layout="desktop"]) & {
    @media (pointer: fine) {
      display: block;
      position: absolute;
      right: -5px;
      top: 0;
      bottom: 0;
      width: 10px;
      z-index: 12;
      cursor: col-resize;
      touch-action: none;
    }
  }
}

.resizingSidebar {
  cursor: col-resize !important;
  user-select: none !important;
}

.resizingSidebar * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sidebarResize:hover {

  :where([data-layout="desktop"]) & {
    @media (pointer: fine) {
      background: var(--accent-soft);
      border-left: 2px solid var(--accent);
    }
  }
}

.sidebarResize:focus-visible {

  :where([data-layout="desktop"]) & {
    @media (pointer: fine) {
      background: var(--accent-soft);
      border-left: 2px solid var(--accent);
    }
  }
}

.resizingSidebar .sidebarResize {

  :where([data-layout="desktop"]) & {
    @media (pointer: fine) {
      background: var(--accent-soft);
      border-left: 2px solid var(--accent);
    }
  }
}

#sidebar.collapsed .sidebarResize {

  :where([data-layout="desktop"]) & {
    @media (pointer: fine) {
      display: none;
    }
  }
}

.sidebarContent:before {

  :where([data-layout="mobile"]) & {
    display: none !important;
  }
}

body.mobile-list .sidebarContent::before {

  :where([data-layout="mobile"]) & {
    content: none !important;
    display: none !important;
  }
}

body.mobile-list .sidehead .tabs {

  :where([data-layout="mobile"]) & {
    overflow: hidden;
    max-height: 56px;
    transition: max-height 0.18s ease,
    margin 0.18s ease,
    padding 0.18s ease;
  }

  :where([data-layout="mobile"]) & {
    @media (prefers-reduced-motion: reduce) {
      transition: none;
    }
  }
}

body.mobile-list.mobile-list-scrolling .sidehead .tabs {

  :where([data-layout="mobile"]) & {
    max-height: 0;
    min-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

body.mobile-list .collectionlist {

  :where([data-layout="mobile"]) & {
    min-height: 0;
    overscroll-behavior: contain;
  }
}

#showAllLayers {
  margin-left: 10px;
}
