/**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 *
 * @author    Captain Film
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 */

/* Overlay sombre en arrière-plan */
#def-lateralcart-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  z-index: 9998 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

#def-lateralcart-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Panier latéral */
#def-lateralcart {
  position: fixed !important;
  top: 0 !important;
  right: -100% !important;
  width: 100% !important;
  max-width: 450px !important;
  height: 100vh !important;
  background-color: #ffffff !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1) !important;
  transition: right 0.3s ease !important;
  overflow: hidden !important;
}

#def-lateralcart.active,
#def-lateralcart.def-lateralcart-open {
  right: 0 !important;
}

/* Header du panier */
.def-lateralcart-header {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  background-color: #f8f9fa;
}

.def-lateralcart-header-top {
  display: flex;
  align-items: center;
}

.def-lateralcart-header-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  background-color: #f8f9fa;
}

.def-lateralcart-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

.def-lateralcart-count {
  font-size: 1.5rem;
  font-weight: 600;
  color: #666;
}

.def-lateralcart-close {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #666;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.def-lateralcart-close:hover {
  color: #333;
}

.def-lateralcart-close-icon {
  width: 10px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.def-lateralcart-close-icon path {
  fill: currentColor;
}

.def-lateralcart-close-text {
  line-height: 1;
}

/* Corps du panier */
.def-lateralcart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.def-lateralcart-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.def-lateralcart-products {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Produit dans le panier */
.def-lateralcart-product {
  display: flex;
  gap: 15px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e5e5;
}

.def-lateralcart-product:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.def-lateralcart-product-image {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
}

.def-lateralcart-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.def-lateralcart-product-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* Header : Titre et prix en flex between */
.def-lateralcart-product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
}

.def-lateralcart-product-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  flex: 1;
}

.def-lateralcart-product-name a {
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
}

.def-lateralcart-product-name a:hover {
  color: #007bff;
}

/* Attributs sous forme de tags */
.def-lateralcart-product-attributes-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.def-lateralcart-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background-color: #f0f0f0;
  border-radius: 12px;
  font-size: 0.75rem;
  color: #555;
  line-height: 1.2;
}

.def-lateralcart-product-tag-label {
  font-weight: 600;
  color: #333;
}

.def-lateralcart-product-tag-value {
  color: #666;
}

/* Footer : Quantité et bouton supprimer en flex between */
.def-lateralcart-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

/* Input quantité avec boutons +/- */
.def-lateralcart-product-quantity-wrapper {
  flex-shrink: 0;
}

.def-lateralcart-quantity-input {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  width: fit-content;
}

.def-lateralcart-quantity-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: #f8f9fa;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.def-lateralcart-quantity-btn:hover {
  background-color: #e9ecef;
  color: #007bff;
}

.def-lateralcart-quantity-btn:active {
  background-color: #dee2e6;
}

.def-lateralcart-quantity-btn span {
  line-height: 1;
  display: block;
}

.def-lateralcart-quantity-input-field {
  width: 50px;
  height: 32px;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.def-lateralcart-quantity-input-field::-webkit-outer-spin-button,
.def-lateralcart-quantity-input-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.def-lateralcart-quantity-input-field:focus {
  outline: none;
  background-color: #fff;
}

.def-lateralcart-product-price {
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
}

/* Dimensions (hauteur et largeur) */
.def-lateralcart-product-dimensions {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: #666;
}

.def-lateralcart-product-dimension {
  display: flex;
  align-items: center;
  gap: 5px;
}

.def-lateralcart-product-dimension-label {
  font-weight: 500;
  color: #555;
}

.def-lateralcart-product-dimension-value {
  color: #333;
}

/* Bouton supprimer (sans style btn) */
.def-lateralcart-product-remove {
  display: inline-block;
  padding: 0;
  background: none;
  border: none;
  color: #dc3545;
  text-decoration: underline;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.def-lateralcart-product-remove:hover {
  color: #c82333;
  text-decoration: underline;
}

.def-lateralcart-product-remove:focus {
  outline: 2px solid #dc3545;
  outline-offset: 2px;
}

.def-lateralcart-product-remove.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* État de mise à jour */
.def-lateralcart-product.updating {
  opacity: 0.6;
  pointer-events: none;
}

.def-lateralcart-product.updating .def-lateralcart-quantity-input-field {
  background-color: #f8f9fa;
}

/* Footer du panier */
.def-lateralcart-footer {
  border-top: 1px solid #e5e5e5;
  padding: 20px;
  background-color: #f8f9fa;
}

.def-lateralcart-totals {
  margin-bottom: 20px;
}

.def-lateralcart-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.def-lateralcart-total-line:not(:last-child) {
  border-bottom: 1px solid #e5e5e5;
}

.def-lateralcart-total-label {
  font-size: 0.95rem;
  color: #666;
}

.def-lateralcart-total-value {
  font-weight: 600;
  color: #333;
}

.def-lateralcart-total-final {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 2px solid #333;
}

.def-lateralcart-total-final .def-lateralcart-total-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

.def-lateralcart-total-final .def-lateralcart-total-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
}

/* Bouton continuer et payer */
.def-lateralcart-actions {
  margin-top: 15px;
}

.def-lateralcart-checkout-btn {
  width: 100%;
  padding: 15px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: block;
  border-radius: 4px;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.def-lateralcart-checkout-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .def-lateralcart {
    max-width: 100%;
  }

  .def-lateralcart-header {
    padding: 15px;
  }

  .def-lateralcart-title {
    font-size: 1.3rem;
  }

  .def-lateralcart-close-text {
    display: none;
  }

  .def-lateralcart-body {
    padding: 15px;
  }

  .def-lateralcart-footer {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .def-lateralcart-product {
    gap: 10px;
  }

  .def-lateralcart-product-image {
    width: 60px;
    height: 60px;
  }

  .def-lateralcart-product-name {
    font-size: 0.9rem;
  }

  .def-lateralcart-product-attributes {
    font-size: 0.8rem;
  }
}

/* Empêcher le scroll du body quand le panier est ouvert */
body.def-lateralcart-open {
  overflow: hidden !important;
}

/* S'assurer que html n'a pas d'overflow bloqué quand le panier est fermé */
html {
  overflow-x: hidden;
  overflow-y: auto;
}

