/* common */

#acat a {
  color: rgba(243, 109, 55, 1);
}

#acat .card {
  width: 150px;
  margin: 10px;
  font-size: 12px;
}

#acat .card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

#acat .card-footer {
  height: 100%;
}

#acat .card-text {
  padding: 5px;
}

#acat .card a {
  color: inherit;
  text-decoration: initial;
  background-color: transparent;
}

#acat .card a:hover {
  color: initial;
  text-decoration: initial;
  background-color: transparent;
}

#acat .icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
}

/* page groups */

#ac-groups img {
  width: 120px;
  height: 80px;
  margin: 10px auto;
}

/* page marks */

#ac-marks img {
  width: 50px;
  height: 50px;
  margin: 10px auto;
}

/* page models */

#ac-models select {
  width: 250px;
}

@media screen and (max-width: 576px) {
  #ac-models select {
    width: 150px;
  }
}

#ac-models img {
  width: 120px;
  height: 80px;
  margin: 10px auto;
}

/* page picture tree */

#ac-pictures li {
  cursor: pointer;
}

#ac-pictures .ac-icon {
  margin-right: 10px;
}

#ac-pictures .ac-subgroup {
  margin-left: 20px;
}

#ac-pictures .ac-picture {
  margin-left: 20px;
}

#ac-pictures .ac-model-img {
  height: 80px;
  width: 120px;
  margin: 5px auto;
  display: block;
}

/* page picture */

#ac-picture-container {
  width: 100%;
  width: calc(100% - 2px);
  height: 500px;
  position: relative;
  overflow: scroll;
  border: 1px solid #C4C4C4;
  scrollbar-width: none;
}

@media screen and (max-width: 576px) {
  #ac-picture-container {
    height: 42svh;
    max-height: 380px;
    min-height: 220px;
  }
}

#ac-picture-container::-webkit-scrollbar {
  display: none;
}

#ac-picture {
  position: absolute;
  left: 0px;
  top: 0px;
  cursor: move;
}

#ac-picture img {
  float: left;
  max-width: initial;
}

/* iOS: do not transform:scale the scheme (WebKit crash). Keep a real box.
   svh is stable — dvh followed the address bar and could reload the tab. */
.bz-ios #ac-picture-container {
  height: 42svh;
  max-height: 380px;
  min-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: auto;
  contain: layout;
  touch-action: pan-x pan-y;
}
.bz-ios #ac-picture {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  transform: none !important;
  -webkit-transform: none !important;
}
.bz-ios #ac-picture img {
  display: block;
  float: none;
  width: 100%;
  max-width: none;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
}
.bz-ios #ac-picture .ac-part-rectangle {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto !important;
  height: auto !important;
  min-width: 22px;
  min-height: 20px;
  padding: 2px 6px;
  overflow: visible;
  line-height: 1 !important;
  font-size: 11px !important;
  font-weight: 700;
  z-index: 2;
  color: #c8102e;
  background: #fff;
  border: 1.5px solid #c8102e;
  border-radius: 999px;
  -webkit-text-size-adjust: 100%;
}
.bz-ios #ac-picture .ac-part-rectangle.selected {
  z-index: 6;
}

.ac-part-rectangle {
  position: absolute;
  border: 1px solid #C4C4C4;
  text-align: center;
  font-size: 16px;
  -ms-border-radius: 2px;
  border-radius: 2px;
  font-weight: bold;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  background: white;
  line-height: 1.5 !important;
  box-sizing: border-box;
}

#ac-picture .selected {
  background: #c8102e !important;
  color: #fff !important;
  border-color: #9e0c24;
}

#ac-parts-table .selected {
  font-weight: bold;
  color: #FFF;
  background: #F34A21 !important;
}

/* Цена — ссылка темы (оранжевая); на выделенной строке иначе сливается с фоном */
#ac-parts-table .selected a {
  color: #FFF !important;
}

#ac-parts-table > tbody > tr {
  cursor: default;
}

#ac-parts-table td {
  vertical-align: middle !important;
}

/* acat_bootstrap сбрасывает .btn в transparent и не задаёт .btn-primary —
   «Купить» выглядело как серый текст и на узком экране уезжало в горизонтальный скролл. */
#acat a.btn-primary,
#acat .btn-primary {
  color: #fff !important;
  background-color: #c8102e !important;
  border-color: #c8102e !important;
}
#acat a.btn-primary:hover,
#acat .btn-primary:hover,
#acat a.btn-primary:focus,
#acat .btn-primary:focus {
  color: #fff !important;
  background-color: #9e0c24 !important;
  border-color: #9e0c24 !important;
}

#acat .table-responsive-md {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#ac-parts-table .offers .table {
  margin-bottom: 0;
}

.ac-pos-short {
  display: none;
}

@media screen and (max-width: 767px) {
  #account-account h1 {
    margin: 8px 0 12px;
    font-size: 1.35rem;
    line-height: 1.3;
  }
  #ac-parts {
    padding-bottom: 8px;
  }
  #ac-picture-container {
    border: 0;
    border-radius: 16px;
    background: #f3f3f3;
  }
  #ac-picture {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    transform: none !important;
    -webkit-transform: none !important;
  }
  #ac-picture img {
    display: block;
    float: none;
    width: 100%;
    max-width: none;
    height: auto;
  }
  #ac-picture .ac-part-rectangle {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
    min-width: 22px;
    min-height: 20px;
    padding: 2px 6px;
    overflow: visible;
    line-height: 1 !important;
    font-size: 11px !important;
    font-weight: 700;
    z-index: 2;
    color: #c8102e;
    background: #fff;
    border: 1.5px solid #c8102e;
    border-radius: 999px;
    -webkit-text-size-adjust: 100%;
  }
  #ac-picture .ac-part-rectangle.selected {
    background: #c8102e !important;
    color: #fff !important;
    border-color: #9e0c24;
    z-index: 6;
  }
  #btn-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 10px 0 4px;
  }
  #acat #btn-toolbar .btn-group {
    display: flex;
    flex-wrap: nowrap;
    float: none;
    margin: 0;
    padding: 3px;
    background: #f4f4f4;
    border-radius: 12px;
  }
  #acat #btn-toolbar .btn-group.float-right {
    float: none;
    margin-left: auto;
  }
  #acat #btn-toolbar .btn-group > .btn {
    float: none;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #444;
    box-shadow: none;
    line-height: 1;
  }
  #acat #btn-toolbar .btn-group > .btn .icon {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
  .ac-scheme-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px 0 14px;
    padding: 10px 12px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #f7f7f7;
    font-size: 13px;
    line-height: 1.35;
    color: #555;
  }
  .ac-scheme-hint::before {
    content: "i";
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #c8102e;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-style: italic;
    line-height: 20px;
    text-align: center;
  }
  .ac-parts-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    color: #2d2d2d;
  }
  .ac-parts-meta {
    font-size: 13px;
    font-weight: 500;
    color: #8a8a8a;
  }
  #acat .table-responsive-md {
    overflow-x: visible;
  }
  #ac-parts-table {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    font-size: 15px;
    margin-bottom: 8px;
  }
  #ac-parts-table thead {
    display: none;
  }
  #ac-parts-table tbody {
    display: block;
    width: 100%;
  }
  #ac-parts-table > tbody > tr:not(.offers) {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    grid-template-areas:
      "pos num info"
      "name name name"
      "price price price";
    align-items: center;
    gap: 4px 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid #ececec;
    border-radius: 16px;
    background: #fff;
  }
  #ac-parts-table > tbody > tr:not(.offers).is-active {
    border-color: #c8102e;
    background: #fffafb;
  }
  #ac-parts-table > tbody > tr:not(.offers) td {
    display: block;
    width: auto;
    max-width: 100%;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    background: transparent !important;
    color: inherit;
    font-weight: inherit;
  }
  #ac-parts-table > tbody > tr:not(.offers) td.selected {
    background: transparent !important;
    color: inherit !important;
    font-weight: inherit;
  }
  #ac-parts-table > tbody > tr:not(.offers) td.selected a {
    color: #c8102e !important;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(1) {
    grid-area: pos;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    white-space: nowrap;
    border-radius: 50%;
    background: #c8102e !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(1) .ac-pos-full:not(:only-child) {
    display: none;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(1) .ac-pos-short {
    display: inline;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(2) {
    grid-area: num;
    font-weight: 700;
    font-size: 15px;
    color: #2d2d2d;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(2)::before {
    content: "Артикул";
    display: block;
    margin-bottom: 1px;
    font-size: 11px;
    font-weight: 500;
    color: #8a8a8a;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(3) {
    grid-area: info;
    text-align: right;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(3) .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid #eee;
    border-radius: 50%;
    background: #f7f7f7;
    color: #666;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(4) {
    grid-area: name;
    padding-top: 2px;
    font-size: 14px;
    line-height: 1.35;
    color: #444;
  }
  #ac-parts-table > tbody > tr:not(.offers) td:nth-child(5) {
    grid-area: price;
    padding-top: 6px;
    font-weight: 700;
    font-size: 17px;
    color: #c8102e;
  }
  #ac-parts-table > tbody > tr:not(.offers) td.ac-part-nostock {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
  }
  #ac-parts-table .ac-part-stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f0f0f0;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
  }
  #ac-parts-table .ac-part-price-link::after {
    content: " ▾";
    font-size: 12px;
    font-weight: 500;
    opacity: 0.65;
  }
  #ac-parts-table .offers > td {
    padding: 4px 6px 12px;
    white-space: normal;
  }
  #ac-parts-table .offers .table {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    background: #fafafa;
  }
  #ac-parts-table .offers .table,
  #ac-parts-table .offers .table tbody,
  #ac-parts-table .offers .table tr,
  #ac-parts-table .offers .table td {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  #ac-parts-table .offers .table tr {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
  }
  #ac-parts-table .offers .table tr:last-child {
    border-bottom: 0;
  }
  #ac-parts-table .offers .table td {
    border: 0;
    padding: 3px 0;
    text-align: left !important;
    white-space: normal;
  }
  #ac-parts-table .offers .product-item-detail-buy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    margin-top: 8px;
    white-space: nowrap;
    border-radius: 12px;
  }
}

/* page search */

#ac-search select {
  width: 250px;
}

#ac-search #ac-search-mode {
  max-width: 250px;
}

@media screen and (max-width: 576px) {
  #ac-search #input-search {
    width: 100%;
  }
  #ac-search #ac-search-mode {
    max-width: 100%;
  }
}

#ac-search .pagination li {
  cursor: pointer;
}

#ac-search .ac-search-result-table {
  border-radius: 8px;
  overflow: hidden;
  background: #FFF;
}

#ac-search .ac-search-result-table tbody tr {
  transition: background-color .15s ease-in-out;
}

#ac-search .ac-search-result-table tbody tr:hover {
  background-color: rgba(243, 109, 55, 0.06);
}

#ac-search mark {
  padding: 0 2px;
  border-radius: 3px;
  color: inherit;
  background: #FFF3B0;
}

#ac-search .glyphicon-refresh-animate {
  -webkit-animation: spin 0.7s infinite linear;
  animation: spin 0.7s infinite linear;
}

@-webkit-keyframes spin {
  from {
    -webkit-transform: rotate(0deg);
  }
  to {
    -webkit-transform: rotate(360deg);
  }
}

@keyframes spin {
  from {
    transform: scale(1) rotate(0deg);
  }
  to {
    transform: scale(1) rotate(360deg);
  }
}

/* Phone: 150px cards leave a gap and look like postage stamps. */
@media screen and (max-width: 767px) {
  #acat-search.input-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
  }
  #acat-search > .form-control,
  #acat-search #ac-search {
    float: none;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border-radius: 12px 0 0 12px;
  }
  #acat-search .input-group-btn {
    display: block;
    width: 44px;
    font-size: 0;
    white-space: nowrap;
  }
  #acat-search .btn,
  #acat-search .btn-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 0 12px 12px 0;
    font-size: 16px;
    line-height: 1;
    text-shadow: none;
  }
  #acat-search .btn .fa {
    font-size: 16px;
    line-height: 1;
  }
  #acat #ac-groups,
  #acat #ac-marks,
  #acat #ac-models > div.d-flex {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    justify-content: stretch;
  }
  #acat .card {
    width: auto;
    margin: 0;
    height: 100%;
  }
  #acat .card-footer {
    height: auto;
    margin-top: auto;
    padding: 8px 6px;
  }
  #ac-groups img,
  #ac-models img {
    width: calc(100% - 16px);
    height: auto;
    max-height: 110px;
    object-fit: contain;
  }
  #ac-marks img {
    width: 64px;
    height: 64px;
  }
}
