/*WOOCOMMERCE*/

.woocommerce a.button  {
    color: var(--kbps-global-color-text-white);
    background-color: var(--kbps-global-color-main);
}
.woocommerce a.button:hover  {
    color: var(--kbps-global-color-text-white);
    background-color: var(--kbps-global-color-secondary);
}

.woocommerce-Price-amount {
    color: var(--kbps-global-color-secondary);
}

.woocommerce ul.products li.product, .woocommerce-page ul.products li.product {
    height: 400px;
}

.woocommerce ul.products li.product .button {
    margin-top:auto;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-weight: 200;
    font-size: smaller;
    font-style: normal;
}

.product {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
}

.product .add_to_cart_button {
    margin-top: auto;
}

.product .woocommerce-LoopProduct-link {
    /* flex-grow: 1; */
    /* padding-bottom: 15px; */
}

.kbps-cart-count {
    background-color: var(--kbps-global-color-secondary);
    color: white;
}

button.button,
.checkout-button.button.alt.wc-forward {
    background-color: var(--kbps-global-color-main) !important;
}

button.button:hover,
.checkout-button.button.alt.wc-forward:hover {
    background-color: var(--kbps-global-color-secondary) !important;
}


.actions {
  box-sizing: border-box;
  width: 100% !important;
}




@media (max-width: 768px) {

  .quantity {
    display: flex;
    flex-direction: row;
  }

  input .input-tex.qty {
    padding: 0 !important;
  }

  button.button,
  .checkout-button.button.alt.wc-forward {
    box-sizing: border-box;
    left: unset !important;
    margin: auto !important;
    text-align: center;
  }

  td[data-title="Doprava"]::before {
  content: attr(data-title);
  display: block;
  font-size: 0.8rem;
  font-weight: normal;
  margin-bottom: 10px;
  color: #333;
}

}



/*Checkout form*/

/* 1. ФИКС ГЛОБАЛЬНЫХ ПРОБЛЕМ */
#customer_details * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 2. ВЫРАВНИВАНИЕ КОЛОНОК */
.col2-set {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  width: 100%;
}

.col-1, .col-2 {
  flex: 1;
  min-width: 0; /* Фикс переполнения */
}

/* 3. ФИКС СТРОК С ПОЛЯМИ */
.form-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 20px;
  width: 100%;
}

.form-row-first, .form-row-last {
  flex: 1;
  min-width: 200px;
}

.form-row-wide {
  flex: 0 0 100%;
}

/* 4. СТИЛИ ПОЛЕЙ ВВОДА */
.input-text, select, textarea {
  width: 100% !important;
  padding: 0;

  background: #fff;
  font-size: 16px;
  outline: none;
}

.woocommerce form .form-row .input-text, .woocommerce form .form-row select {
  border: unset;
}

.select2-selection.select2-selection--single {
    border: unset;
    cursor: not-allowed;
}
 
.select2-selection__arrow {
    display: none;
}

/* 1. Фиксим контейнер */
.woocommerce-input-wrapper {
  display: block;
  width: 100%;
}

/* 2. Исправляем textarea */
#order_comments {
  width: 100% !important;
  min-height: 120px !important; /* Минимальная высота */
  padding: 12px 15px !important;
  border: 1px solid #ddd !important;
  border-radius: 4px !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  resize: vertical; /* Разрешаем изменять высоту */
  box-sizing: border-box !important;
}

/* 3. Убираем cols/rows из HTML (они мешают) */
#order_comments[cols],
#order_comments[rows] {
  width: 100% !important;
  height: auto !important;
}



/* 5. ФИКС ВЫПАДАЮЩИХ СПИСКОВ */
.select2-container {
  width: 100% !important;
}

.select2-selection {
  height: auto !important;
  padding: 10px !important;
}

/* 6. КНОПКА "ДРУГАЯ АДРЕС" */
#ship-to-different-address {
  margin: 25px 0;
  clear: both;
}

/* 7. ПОДПИСИ ПОЛЕЙ */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  width: 100%;
}

/* 8. АДАПТИВНОСТЬ */
@media (max-width: 768px) {
  .form-row-first, .form-row-last {
    flex: 0 0 100%;
  }
}



/*Колонки*/
/* Основные стили для колонок */
.col2-set {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  width: 100%;
}

.col-1, .col-2 {
  flex: 1;
  min-width: 0; /* Важно для правильного сжатия */
}

/* Мобильная версия */
@media (max-width: 768px) {
  .col2-set {
    flex-direction: column;
    gap: 20px;
  }
  
  .col-1, .col-2 {
    flex: 0 0 100%;
    width: 100%;
  }
  
  /* Дополнительные исправления для полей */
  .form-row-first, .form-row-last {
    width: 100% !important;
    float: none !important;
    margin-right: 0 !important;
  }

  .woocommerce-info {
    font-size: x-small;
    padding: 0.5rem;
    margin: 0.3rem;
  }

  .woocommerce-info::before {
    display: none;
  }
}

/*End Checkout Form*/












.woocommerce-shipping-methods li:has(> input.shipping_method[type="radio"]:checked) {
    color: var(--kbps-global-color-text-white);
    background-color: var(--kbps-global-color-main);
    padding: 8px 12px;
    border-radius: 4px;
}

#shipping_method li input.shipping_method[type="radio"]:checked + label .woocommerce-Price-amount {
    color: white;
}

.woocommerce-shipping-calculator {
    display: none;
}



/* 1. Исправляем контейнер оплаты */
.woocommerce-checkout-payment {
  overflow: hidden; /* Обрезает вылезающие элементы */
  min-width: 0; /* Разрешает сжатие */
  background: var(--kbps-global-color-background) !important;
}

.form-row.place-order {
    display: block;
    box-sizing: border-box;
}

/* 2. Фиксим кнопку */
#place_order {
  width: auto !important; 
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal; /* Перенос текста */
  word-wrap: break-word;
}

/* 3. Чиним блок с условиями */
.woocommerce-terms-and-conditions-wrapper {
  overflow: visible; /* Отменяем скролл */
}
.woocommerce-terms-and-conditions {
  max-height: none !important; /* Убираем ограничение */
  overflow: visible !important;
}


/* Enable cart thumbs on mobile*/
@media only screen and (max-width: 768px) {
    .woocommerce table.cart .product-thumbnail {
        display: table-cell !important;
    }
}



@media (max-width: 768px) {

  /* Скрываем шапку таблицы */
  table.cart thead {
    display: none;
  }

  /* Таблица и её элементы — блочные */
  table.cart,
  table.cart tbody,
  table.cart th,
  table.cart td,
  table.cart tr {
    display: block !important;
  }

  /* Карточка товара */
  table.cart tr.cart_item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
  }

  /* Убираем подписи из data-title */
  table.cart td::before {
    content: none !important;
  }

  /* Крестик удаления — абсолютный справа сверху */
  table.cart tr.cart_item > td.product-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0;
    margin: 0;
    z-index: 10;
  }

  table.cart tr.cart_item > td.product-remove a.remove {
    font-size: 1.5rem;
    color: #cc0000;
    cursor: pointer;
    text-decoration: none;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    padding: 0 6px;
    line-height: 1;
    user-select: none;
  }

  /* Превью — на всю ширину */
  table.cart tr.cart_item > td.product-thumbnail {
    padding: 0;
    margin-bottom: 2.5rem;
    width: 100%;
    box-sizing: border-box;
    display: block;
  }

  table.cart td.product-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    object-fit: contain;
  }

  /* Название товара — блок, на всю ширину */
  table.cart td.product-name {
    display: block;
    padding: 0 0 0.75rem 0;
    font-weight: 600;
    font-size: 1rem;
  }

  table.cart td.product-name a {
    display: inline-block;
    font-size: smaller;
    margin-top: 2rem;
  }

  /* Цена, количество и сумма — выравниваем по правому краю */
  table.cart td.product-price,
  table.cart td.product-quantity,
  table.cart td.product-subtotal {
    display: block;
    padding: 0.25rem 1rem 0.25rem 0;
    font-size: 0.9rem;
    text-align: right !important;
    direction: rtl !important;
  }

  /* Количество — убираем лишние отступы */
  table.cart td.product-quantity .quantity {
    padding-left: 0;
  }

}
