/* ============================================
   SIDEBAR BASKET / FAVORITES POPUP
   ============================================ */

.basketActive .basketBox--basket,
.favActive .basketBox--fav {
  opacity: 1;
  right: 90px;
  height: auto;
  max-height: 80vh;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
}

.basketBox {
  position: fixed;
  color: #333;
  top: -200%;
  right: 0;
  height: 0;
  width: 320px;
  max-height: 100%;
  overflow: hidden;
  text-align: left;
  background: #fff;
  opacity: 0;
  padding: 20px;
  cursor: initial;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  transition: opacity .2s ease, right .2s ease;
}

.basketBox_title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #222;
}

.basketBox .basketList {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  scrollbar-width: thin;
}

.basketBox .basketList::-webkit-scrollbar { width: 3px; }
.basketBox .basketList::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.basketBox_all {
  display: inline-block;
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  color: inherit;
}
.basketBox_all:hover { opacity: .7; }

/* ---- Sidebar item (sb-item) ---- */
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}
.sb-item:last-child { border-bottom: none; }

.sb-item__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.sb-item__img {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sb-item__img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.sb-item__info {
  flex: 1;
  min-width: 0;
}

.sb-item__name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sb-item__price {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #222;
}

.sb-item__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.sb-item__qty {
  display: flex;
  align-items: center;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
}

.sb-item__qty-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: #fafafa;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  padding: 0;
  line-height: 1;
}
.sb-item__qty-btn:hover { background: #eee; }

.sb-item__qty-val {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 24px;
}

.sb-item__del {
  width: 22px;
  height: 22px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  font-size: 14px;
  color: #bbb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  position: relative;
  z-index: 2;
}
.sb-item__del:hover { background: #fce4e4; color: #e53935; }

/* ---- Sidebar bottom: total + button ---- */
.basketBottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-top: 1px solid #eee;
  margin-top: 8px;
}

.basketBottom_total {
  font-size: 12px;
  color: #888;
}

.basketBottom_total_caption {
  display: block;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 2px;
  font-size: 11px;
}

.basketTotal {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #222;
  white-space: nowrap;
}

.basketBottom_btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  height: 36px;
  padding: 0 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}
.basketBottom_btn:hover { opacity: .85; }

.basketContinue {
  display: block !important;
  text-align: center;
  margin-top: 8px;
  padding: 7px;
  font-size: 12px;
  color: #666 !important;
  background: #f5f5f5 !important;
  border-radius: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  width: 100%;
}
.basketContinue:hover { background: #eee !important; }

.basketEmpty:before {
  content: "\0412\0430\0448\0430 \043a\043e\0440\0437\0438\043d\0430 \043f\0443\0441\0442\0430";
  display: block;
  text-align: center;
  padding: 24px 0;
  color: #aaa;
  font-size: 13px;
}
.basketEmpty + .basketBottom { display: none; }
.basketEmpty + .basketBottom + .basketContinue { margin-top: 0; }

@media (max-width: 480px) {
  .basketActive .basketBox--basket,
  .favActive .basketBox--fav {
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    top: auto;
    bottom: 0;
    transform: none;
    max-height: 85vh;
  }
}

@media (max-width: 1200px) {
  .basketActive .basketBox--basket,
  .favActive .basketBox--fav {
    right: 72px;
  }
}

@media (max-width: 900px) {
  .basketActive .basketBox--basket,
  .favActive .basketBox--fav {
    right: 62px;
  }
}

.basketActive .nav-block > div:hover,
.basketActive .nav-block > div:focus,
.favActive .nav-block > div:hover,
.favActive .nav-block > div:focus {
  opacity: 1;
}


/* ============================================
   BASKET PAGE (basket.tpl)
   ============================================ */

.basket-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0 40px;
}

.basket-page__layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.basket-page__items {
  flex: 1;
  min-width: 0;
}

.basket-page__summary {
  position: sticky;
  top: 20px;
  width: 280px;
  flex-shrink: 0;
}

.basket-summary {
  background: #f9f9f9;
  border-radius: 10px;
  padding: 18px 22px;
}

.basket-summary__row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #666;
  padding: 5px 0;
}

.basket-summary__row--total {
  border-top: 2px solid #e5e5e5;
  margin-top: 8px;
  padding-top: 12px;
  font-size: 19px;
  font-weight: 700;
  color: #222;
}

/* Basket card (cart item on basket page) */
.basket-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  position: relative;
  transition: box-shadow .15s;
}
.basket-card + .basket-card { margin-top: 10px; }
.basket-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }

.basket-card__link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 10px;
}

.basket-card__img-wrap {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.basket-card__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.basket-card__info {
  flex: 1;
  min-width: 0;
}

.basket-card__name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  color: #222;
}

.basket-card__price-unit {
  font-size: 13px;
  color: #999;
  margin: 3px 0 0;
}

.basket-card__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.basket-card__qty {
  display: flex;
  align-items: center;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
}

.basket-card__qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #fafafa;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}
.basket-card__qty-btn:hover { background: #eee; }

.basket-card__qty-val {
  min-width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 32px;
}

.basket-card__total-price {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}

.basket-card__remove {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  font-size: 16px;
  color: #bbb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.basket-card__remove:hover { background: #fce4e4; color: #e53935; }

@media (max-width: 768px) {
  .basket-page__layout { flex-direction: column; }
  .basket-page__summary { width: 100%; position: static; }
  .basket-card { flex-wrap: wrap; gap: 10px; }
  .basket-card__info { flex: 1 1 calc(100% - 92px); }
  .basket-card__controls {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .basket-page { padding: 0 0 30px; }
  .basket-card { padding: 12px; }
  .basket-card__img-wrap { width: 56px; height: 56px; }
}


/* ============================================
   CHECKOUT FORM
   ============================================ */

.basket-page__checkout { margin-top: 32px; }

.checkout-form { max-width: 680px; }

.checkout-form__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 18px;
}

.checkout-form__error {
  background: #fce4e4;
  color: #c62828;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.checkout-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.checkout-form__field {
  display: flex;
  flex-direction: column;
}
.checkout-form__field--full { grid-column: 1 / -1; }

.checkout-form__label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 4px;
}
.checkout-form__req { color: #e53935; }

.checkout-form__input {
  height: 42px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  color: #222;
  background: #fff;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}
.checkout-form__input:focus { outline: none; border-color: #999; }

.checkout-form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.checkout-form__textarea {
  height: 80px;
  padding: 10px 14px;
  resize: vertical;
  font-family: inherit;
}

.checkout-form__actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.checkout-form__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 26px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity .15s;
}
.checkout-form__btn:hover { opacity: .9; }
.checkout-form__btn--back { background: #f0f0f0; color: #444; }
.checkout-form__btn--submit { color: #fff; min-width: 200px; }

.checkout-form__auth { margin-top: 12px; }
.checkout-form__auth-text { font-size: 14px; color: #555; margin-bottom: 16px; }
.checkout-form__auth-link { font-weight: 600; text-decoration: underline; }

@media (max-width: 600px) {
  .checkout-form__grid { grid-template-columns: 1fr; }
  .checkout-form__actions { flex-direction: column; }
  .checkout-form__btn { width: 100%; }
}


/* ============================================
   BASKET EMPTY STATE
   ============================================ */

.basket-page__empty-msg {
  text-align: center;
  padding: 40px 0;
}

.basket-page__empty-msg svg { margin-bottom: 16px; }

.basket-page__empty-msg p {
  font-size: 17px;
  color: #888;
  margin: 0 0 20px;
}

.basket-page__success {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
