/* MD Магазини: вкладки й карта - вигляд "Карти магазинів" (shop_maps), картки - "Магазинів на сторінці контактів" */
.mdshops {
  --mdshops-accent: #d75032;
  --mdshops-tab: #ff7800;
  margin-bottom: 30px;
  /* посилання на вкладку (#kyiv) гортає до блоку - з відступом зверху */
  scroll-margin-top: 20px;
}

/* заголовок ("Найближчий салон" під ним) і вкладки: на ПК заголовок ліворуч, вкладки переносяться в кілька рядків; на
   телефоні - заголовок і кнопка одним рядком, під ними вкладки одним рядком зі смужкою прокрутки */
.mdshops__top {
  display: flex;
  align-items: flex-start;
  gap: 10px 20px;
  min-width: 0;
  margin-bottom: 14px;
}

.mdshops__head {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px 12px;
}

.mdshops__title {
  flex: none;
  margin: 0;
  color: #000;
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
}

.mdshops__near {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--mdshops-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
}

.mdshops__near:hover span {
  text-decoration: underline;
}

.mdshops__near:focus-visible {
  outline: 2px solid var(--mdshops-accent);
  outline-offset: 2px;
}

.mdshops__near:disabled {
  cursor: progress;
  opacity: .7;
}

.mdshops__near-icon {
  display: block;
  flex: none;
  width: 16px;
  height: 16px;
}

.mdshops__near.is-busy .mdshops__near-icon {
  animation: mdshops-spin 1s linear infinite;
}

@keyframes mdshops-spin {
  to {
    transform: rotate(360deg);
  }
}

.mdshops__tabs-box {
  flex: 1 1 auto;
  min-width: 0;
}

.mdshops__tabs {
  display: flex;
  position: relative;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 6px;
  min-width: 0;
}

/* смужка прокрутки вкладок - лише на телефоні (вкладки одним рядком) */
.mdshops__scroll {
  display: none;
}

/* "Найближчий до вас: ..." і помилки місцезнаходження */
.mdshops__note {
  margin: -4px 0 14px;
  padding: 8px 12px;
  border-left: 3px solid var(--mdshops-accent);
  background: #fff5ef;
  color: #333;
  font-size: 13px;
  line-height: 1.45;
}

.mdshops__note.is-error {
  border-left-color: #d93025;
  background: #fdecea;
  color: #a50e0e;
}

/* "Відкрито · до 19:00" / "Скоро зачиняється · о 19:00" / "Зачинено · відкриється о 10:00" */
.mdshops-status {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.mdshops-status[hidden] {
  display: none;
}

.mdshops-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.mdshops-status[data-state="open"] {
  color: #1e8e3e;
}

.mdshops-status[data-state="closing"] {
  color: #e37400;
}

.mdshops-status[data-state="closed"] {
  color: #d93025;
}

.mdshops-status__detail {
  color: #666;
  font-weight: 400;
}

/* відстань до магазину після "Найближчого салону" */
.mdshops-distance {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: #fff;
  color: #555;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}

.mdshops-distance[hidden] {
  display: none;
}

.mdshops-distance.is-nearest {
  background: var(--mdshops-accent);
  color: #fff;
}

.mdshops__tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 6px 4px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}

/* кількість магазинів вкладки */
.mdshops__count {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 11px;
  background: #f1f1f1;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.mdshops__tab.is-active {
  border-color: var(--mdshops-accent);
  background: var(--mdshops-accent);
  color: #fff;
}

.mdshops__tab.is-active .mdshops__count {
  background: rgb(255 255 255 / 25%);
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .mdshops__tab:not(.is-active):hover {
    border-color: var(--mdshops-accent);
    color: var(--mdshops-accent);
  }
}

.mdshops__tab:focus-visible {
  outline: 2px solid var(--mdshops-accent);
  outline-offset: 2px;
}

/* карта: на ПК ліворуч список адрес, праворуч карта; на телефоні - лише карта */
.mdshops-map {
  display: flex;
  height: 460px;
  overflow: hidden;
  border: 1px solid #ddd;
}

.mdshops-map__list {
  flex: 0 0 360px;
  max-width: 360px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid #ddd;
  scrollbar-width: thin;
}

.mdshops-map__item {
  padding: 11px 18px 11px 17px;
  border-bottom: 1px solid #eee;
  border-left: 3px solid transparent;
  color: #777;
  font-size: 13px;
  line-height: 1.45;
  transition: background-color .2s, border-color .2s;
}

@media (hover: hover) and (pointer: fine) {
  .mdshops-map__item:hover {
    background: #fafafa;
  }
}

.mdshops-map__item.is-active {
  border-left-color: var(--mdshops-accent);
  background: #fff5ef;
}

.mdshops-map__item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 2px;
}

.mdshops-map__item-head .mdshops-distance {
  flex: none;
  background: #f1f1f1;
}

.mdshops-map__item-head .mdshops-distance.is-nearest {
  background: var(--mdshops-accent);
}

.mdshops-map__item-title {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #222;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.mdshops-map__item-title:disabled {
  cursor: default;
}

.mdshops-map__num {
  color: var(--mdshops-accent);
}

@media (hover: hover) and (pointer: fine) {
  .mdshops-map__item-title:not(:disabled):hover {
    color: var(--mdshops-accent);
  }
}

.mdshops-map__phone {
  display: inline-block;
  margin-top: 3px;
  color: #222;
  font-size: 13px;
  font-weight: 600;
}

.mdshops-map__phone:hover {
  color: var(--mdshops-accent);
}

.mdshops-map__hours {
  margin-top: 3px;
  color: #999;
  font-size: 12px;
  line-height: 1.4;
}

.mdshops-map__box {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.mdshops-map__canvas {
  width: 100%;
  height: 100%;
}

/* поки карту не активовано кліком - підказка зверху (сторінка гортається над картою) */
.mdshops-map__hint {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 2;
  max-width: calc(100% - 120px);
  padding: 6px 12px;
  border-radius: 16px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity .2s;
}

.mdshops-map.is-active .mdshops-map__hint {
  opacity: 0;
}

/* вікно мітки */
.mdshops-info {
  max-width: 230px;
  color: #555;
  font-size: 13px;
  line-height: 1.45;
}

.mdshops-info__photo {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 6px;
}

.mdshops-info__title {
  margin-bottom: 2px;
  color: #222;
  font-size: 14px;
  font-weight: 700;
}

.mdshops-info__title > span:not(.mdshops-distance) {
  color: var(--mdshops-accent);
}

.mdshops-info .mdshops-distance {
  background: #f1f1f1;
  font-size: 11px;
}

.mdshops-info .mdshops-distance.is-nearest {
  background: var(--mdshops-accent);
}

.mdshops-info .mdshops-status {
  font-size: 12px;
}

.mdshops-info__phone {
  display: inline-block;
  margin-top: 2px;
  color: #222;
  font-weight: 600;
}

.mdshops-info__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mdshops-info__links a {
  padding: 4px 10px;
  border: 1px solid var(--mdshops-accent);
  border-radius: 14px;
  color: var(--mdshops-accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mdshops-info__links a:hover {
  background: var(--mdshops-accent);
  color: #fff;
}

/* картки магазинів обраної вкладки - вигляд, що був у "Магазинах на сторінці контактів" */
.mdshops-cards__title {
  display: block;
  margin: 20px 0;
  padding: 8px 15px;
  background-color: var(--mdshops-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.42857;
}

.mdshops-cards__list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.mdshops-card {
  display: flex;
  gap: 0 10px;
  width: calc(100% / 2 - 10px);
  min-height: 200px;
  background-color: #ededed;
}

.mdshops-card.is-nearest {
  outline: 2px solid var(--mdshops-accent);
}

.mdshops-card__photo {
  display: block;
  position: relative;
  flex: 0 0 50%;
  width: 50%;
  line-height: 0;
  cursor: zoom-in;
}

.mdshops-card__photo img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mdshops-card__info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 20px 0 0;
}

.mdshops-card__name {
  color: var(--mdshops-accent);
  font-size: 15px;
  font-weight: bold;
}

.mdshops-card__name a {
  color: inherit;
}

.mdshops-card__name a:hover,
.mdshops-card__name a:focus {
  color: inherit;
  text-decoration: underline;
}

.mdshops-card__row {
  display: flex;
  align-items: flex-start;
  gap: 0 6px;
  font-size: 13px;
}

/* значок - як гліф шрифту: 12 px завширшки (стискається до ширини гліфа), заввишки в 1em, угорі рядка */
.mdshops-card__icon {
  display: block;
  width: 12px;
  height: 1em;
  fill: var(--mdshops-accent);
}

.mdshops-card__row a {
  color: #000;
  text-decoration: underline;
}

.mdshops-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}

.mdshops-card__actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}

.mdshops-card__more {
  padding: 0;
  border: 0;
  background: none;
  color: var(--mdshops-accent);
  font: inherit;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.mdshops-card__more:hover,
.mdshops-card__more:focus {
  color: var(--mdshops-accent);
  text-decoration: underline;
}

.mdshops-card__thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 52px));
  gap: 6px;
  margin: 3px 0 0;
  padding: 0;
  list-style: none;
}

.mdshops-card__thumb {
  display: block;
  position: relative;
  line-height: 0;
  cursor: zoom-in;
}

.mdshops-card__thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: opacity .2s;
}

.mdshops-card__thumb:hover img {
  opacity: .85;
}

.mdshops-card__thumb-more {
  display: flex;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 50%);
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
}

@media (max-width: 1100px) {
  .mdshops-card {
    width: 100%;
  }
}

/* телефони й вузькі планшети: заголовок над вкладками, лише карта (картки нижче - список магазинів) */
@media (max-width: 799px) {
  .mdshops__top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .mdshops__head {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  /* вкладки одним рядком, гортаються пальцем; рідна смужка прокрутки на телефонах не видна - своя під вкладками */
  .mdshops__tabs {
    flex-wrap: nowrap;
    margin: -4px;
    padding: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .mdshops__tabs::-webkit-scrollbar {
    display: none;
  }

  .mdshops__scroll {
    display: block;
    position: relative;
    height: 4px;
    margin-top: 10px;
    border-radius: 2px;
    background: #e8e8e8;
  }

  .mdshops__scroll[hidden] {
    display: none;
  }

  .mdshops__scroll-thumb {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    min-width: 24px;
    border-radius: 2px;
    background: var(--mdshops-accent);
  }

  .mdshops-map {
    height: 420px;
  }

  .mdshops-map__list {
    display: none;
  }
}

@media (max-width: 575px) {
  .mdshops-card {
    min-height: 0;
  }

  .mdshops-card__info {
    padding: 10px 0 6px;
    font-size: 12px;
  }

  .mdshops-card__name {
    margin-bottom: 5px;
    font-size: 14px;
  }

  .mdshops-card__row,
  .mdshops-card__more {
    font-size: 12px;
  }
}

@media (max-width: 499px) {
  .mdshops__title {
    font-size: 20px;
    line-height: 28px;
  }

  .mdshops__near {
    font-size: 13px;
  }

  .mdshops__tabs {
    gap: 6px 5px;
  }

  .mdshops__tab {
    min-height: 30px;
    padding: 3px 5px 3px 11px;
    font-size: 13px;
  }

  .mdshops__count {
    min-width: 20px;
    padding: 1px 6px;
    font-size: 11px;
  }

  .mdshops-map__hint {
    max-width: calc(100% - 110px);
    font-size: 11px;
  }
}
