/**
 * VentOpt B2B Cart — Изолированные стили
 * Все селекторы имеют префикс .ventopt- для предотвращения конфликтов
 * с legacy CSS Joomla-шаблона.
 */

/* ========================================================================
 * 1. TOAST-УВЕДОМЛЕНИЕ «Добавлено в корзину»
 * ======================================================================== */

.ventopt-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: #fff;
  border-left: 4px solid #28a745;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.35s ease;
  font-family: Arial, Helvetica, sans-serif;
  max-width: 360px;
}

.ventopt-toast--visible {
  transform: translateX(0);
  opacity: 1;
}

.ventopt-toast__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e6f7ec;
  color: #28a745;
  font-size: 18px;
  font-weight: 700;
}

.ventopt-toast__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ventopt-toast__text strong {
  font-size: 14px;
  color: #212529;
  font-weight: 600;
}

.ventopt-toast__text span {
  font-size: 12px;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ========================================================================
 * 2. БЕЙДЖ НА МЕНЮ «КОРЗИНА»
 * ======================================================================== */

.ventopt-cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 10px;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  font-family: Arial, sans-serif;
}

/* ========================================================================
 * 3. СТРАНИЦА КОРЗИНЫ — ОБЩИЙ КОНТЕЙНЕР
 * ======================================================================== */

.ventopt-cart {
  font-family: Arial, Helvetica, sans-serif;
  color: #212529;
  max-width: 100%;
  padding: 0 0 40px;
}

.ventopt-cart__title {
  font-family: BebasNeue, Arial, sans-serif;
  font-size: 2.2rem;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e9ecef;
  color: #212529;
}

/* ========================================================================
 * 4. ТАБЛИЦА ТОВАРОВ
 * ======================================================================== */

.ventopt-cart-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}

.ventopt-cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ventopt-cart-table thead th {
  background: #343a40;
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ventopt-cart-table thead th:first-child {
  border-radius: 4px 0 0 0;
}

.ventopt-cart-table thead th:last-child {
  border-radius: 0 4px 0 0;
}

.ventopt-cart-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background 0.15s;
}

.ventopt-cart-table tbody tr:hover {
  background: #f8f9fa;
}

.ventopt-cart-table tbody td {
  padding: 12px;
  vertical-align: middle;
}

.ventopt-cart-table__num {
  width: 40px;
  text-align: center;
  color: #868e96;
  font-weight: 600;
}

.ventopt-cart-table__name {
  min-width: 200px;
  font-weight: 500;
}

.ventopt-cart-table__price,
.ventopt-cart-table__total {
  white-space: nowrap;
  font-weight: 600;
  text-align: right;
}

.ventopt-cart-table__total {
  color: #212529;
  font-size: 15px;
}

.ventopt-cart-table__qty {
  width: 140px;
}

.ventopt-cart-table__remove {
  width: 44px;
  text-align: center;
}

/* ========================================================================
 * 5. КОНТРОЛЫ КОЛИЧЕСТВА (+/-)
 * ======================================================================== */

.ventopt-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ced4da;
  border-radius: 4px;
  overflow: hidden;
}

.ventopt-qty__btn {
  width: 34px;
  height: 34px;
  border: none;
  background: #f8f9fa;
  color: #495057;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.ventopt-qty__btn:hover {
  background: #e9ecef;
}

.ventopt-qty__btn:active {
  background: #dee2e6;
}

.ventopt-qty__input {
  width: 50px;
  height: 34px;
  border: none;
  border-left: 1px solid #ced4da;
  border-right: 1px solid #ced4da;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #212529;
  background: #fff;
  -moz-appearance: textfield;
  padding: 0;
  margin: 0;
}

.ventopt-qty__input::-webkit-inner-spin-button,
.ventopt-qty__input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Кнопка удаления строки */
.ventopt-remove-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #dc3545;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.ventopt-remove-btn:hover {
  background: #fde8ea;
  color: #c0392b;
}

/* ========================================================================
 * 6. БЛОК ИТОГО
 * ======================================================================== */

.ventopt-cart__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 2px solid #e9ecef;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.ventopt-cart__total-block {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}

.ventopt-cart__total-block span {
  color: #6c757d;
}

.ventopt-cart__total-block strong {
  font-size: 24px;
  color: #212529;
}

/* ========================================================================
 * 7. ФОРМА B2B ЗАКАЗА
 * ======================================================================== */

.ventopt-order-form-wrap {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 28px;
}

.ventopt-order-form__title {
  font-family: BebasNeue, Arial, sans-serif;
  font-size: 1.6rem;
  margin: 0 0 20px;
  color: #212529;
}

.ventopt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ventopt-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ventopt-form-group--full {
  grid-column: 1 / -1;
}

.ventopt-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
}

.ventopt-req {
  color: #dc3545;
}

.ventopt-form-group input,
.ventopt-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  font-family: Arial, Helvetica, sans-serif;
  color: #212529;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ventopt-form-group input:focus,
.ventopt-form-group textarea:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.ventopt-form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.ventopt-form-actions {
  margin-top: 24px;
  text-align: right;
}

/* ========================================================================
 * 8. КНОПКИ
 * ======================================================================== */

.ventopt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: Arial, Helvetica, sans-serif;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  text-decoration: none;
  line-height: 1.4;
}

.ventopt-btn:active {
  transform: scale(0.98);
}

.ventopt-btn--primary {
  background: #28a745;
  color: #fff;
}

.ventopt-btn--primary:hover {
  background: #218838;
  box-shadow: 0 4px 14px rgba(40, 167, 69, 0.3);
}

.ventopt-btn--primary:disabled {
  background: #94d3a2;
  cursor: not-allowed;
}

.ventopt-btn--outline {
  background: transparent;
  color: #495057;
  border: 2px solid #ced4da;
}

.ventopt-btn--outline:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #212529;
}

.ventopt-btn--ghost {
  background: transparent;
  color: #dc3545;
  border: 1px solid #dc3545;
  padding: 8px 16px;
  font-size: 13px;
}

.ventopt-btn--ghost:hover {
  background: #fde8ea;
}

/* ========================================================================
 * 9. ПУСТАЯ КОРЗИНА
 * ======================================================================== */

.ventopt-cart-empty {
  text-align: center;
  padding: 60px 20px;
}

.ventopt-cart-empty__icon {
  margin-bottom: 20px;
  opacity: 0.6;
}

.ventopt-cart-empty h2 {
  font-family: BebasNeue, Arial, sans-serif;
  font-size: 2rem;
  margin: 0 0 8px;
  color: #495057;
}

.ventopt-cart-empty p {
  color: #6c757d;
  font-size: 15px;
  margin: 0 0 24px;
}

/* ========================================================================
 * 10. УСПЕХ ОТПРАВКИ
 * ======================================================================== */

.ventopt-cart-success {
  text-align: center;
  padding: 60px 20px;
}

.ventopt-cart-success__icon {
  margin-bottom: 20px;
}

.ventopt-cart-success h2 {
  font-family: BebasNeue, Arial, sans-serif;
  font-size: 2rem;
  margin: 0 0 12px;
  color: #28a745;
}

.ventopt-cart-success p {
  color: #6c757d;
  font-size: 15px;
  margin: 0 0 24px;
  line-height: 1.6;
}

/* ========================================================================
 * 11. АДАПТИВНОСТЬ (MOBILE)
 * ======================================================================== */

@media (max-width: 768px) {
  .ventopt-form-grid {
    grid-template-columns: 1fr;
  }

  .ventopt-cart__summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .ventopt-cart__total-block {
    width: 100%;
    justify-content: flex-end;
  }

  .ventopt-order-form-wrap {
    padding: 16px;
  }

  .ventopt-cart-table__name {
    min-width: 140px;
  }

  .ventopt-toast {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .ventopt-cart__title {
    font-size: 1.6rem;
  }

  .ventopt-cart-table {
    font-size: 12px;
  }

  .ventopt-qty__btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .ventopt-qty__input {
    width: 38px;
    height: 28px;
    font-size: 12px;
  }
}
