/**
 * CBD Mini-cart panel styles
 * Couleurs site : vert #004437 — jaune #FFD517
 */

/* Header: only show cart from displayNav2 (hide ps_customersignin / any other module) */
.cbd-header-cart-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cbd-header-cart-wrap .ps_customersignin,
.cbd-header-cart-wrap > *:not(#cbd_desktop_cart):not(.cbd-cart) {
  display: none !important;
}
.cbd-header-cart-wrap .cbd-cart,
.cbd-header-cart-wrap #cbd_desktop_cart {
  display: block !important;
}
/* Trigger = same look as original .icon.icon--cart (button reset) */
.cbd-header-cart-wrap .cbd-cart-trigger {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 12px 12px 28px 12px;
  position: relative;
  transition: background 0.3s;
  color: #004437;
  background: rgba(255, 213, 23, 0.2);
}
.cbd-header-cart-wrap .cbd-cart-trigger:hover {
  background: rgba(255, 213, 23, 0.4);
}
.cbd-header-cart-wrap .cbd-cart-trigger svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.cbd-header-cart-wrap .cart-products-count,
.cbd-header-cart-wrap .cbd-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: #004437;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cbd-font, inherit);
}

/* Overlay: must be in front of page, behind panel */
.cbd-minicart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 68, 55, 0.35);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}
.cbd-minicart-overlay--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Panel: fixed to viewport, above overlay */
.cbd-minicart-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cbd-minicart-panel--open {
  transform: translateX(0);
}
.cbd-minicart-panel__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header du panneau */
.cbd-minicart-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #004437;
  color: #fff;
  flex-shrink: 0;
}
.cbd-minicart-panel__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #BFD0CD !important;
}
.cbd-minicart-panel__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  color: #fff;
  opacity: 0.8;
}
.cbd-minicart-panel__close:hover {
  opacity: 1;
}

/* Product list */
.cbd-minicart-products {
  list-style: none;
  margin: 0;
  padding: 12px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.cbd-minicart-product-line {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e8e8e8;
  position: relative;
}
.cbd-minicart-product-line__img {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  overflow: hidden;
  border-radius: 8px;
}
.cbd-minicart-product-line__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cbd-minicart-product-line__body {
  flex: 1;
  min-width: 0;
}
.cbd-minicart-product-line__name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #004437;
  text-decoration: none;
  margin-bottom: 4px;
  line-height: 1.3;
}
.cbd-minicart-product-line__name:hover {
  text-decoration: underline;
  color: #004437;
}
.cbd-minicart-product-line__price {
  display: block;
  font-size: 0.875rem;
  color: #3D3D3D;
  font-weight: 700;
  margin-bottom: 8px;
}
.cbd-minicart-product-line__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #004437;
  border-radius: 4px;
  overflow: hidden;
}
.cbd-minicart-qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0, 68, 55, 0.08);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: #004437;
  font-weight: 700;
}
.cbd-minicart-qty-btn:hover:not(:disabled) {
  background: rgba(0, 68, 55, 0.18);
}
.cbd-minicart-qty-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.cbd-minicart-qty-input {
  width: 36px;
  height: 28px;
  border: none;
  border-left: 1px solid #004437;
  border-right: 1px solid #004437;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  background: #fff;
  color: #004437;
}
.cbd-minicart-product-remove {
  position: absolute;
  top: 12px;
  right: 0;
  font-size: 1.25rem;
  color: #999;
  text-decoration: none;
  padding: 4px;
  line-height: 1;
}
.cbd-minicart-product-remove:hover {
  color: #c00;
}

/* Summary */
.cbd-minicart-summary {
  padding: 12px 20px;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
}
.cbd-minicart-summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin-bottom: 6px;
  color: #3D3D3D;
}
.cbd-minicart-summary-shipping-detail {
  font-size: 0.75rem;
  color: #666;
  margin-top: 2px;
}
.cbd-minicart-summary-line--promo {
  margin-top: 8px;
}
.cbd-minicart-apply-code {
  color: #004437;
  text-decoration: underline;
  font-size: 0.875rem;
  font-weight: 600;
}
.cbd-minicart-apply-code:hover {
  text-decoration: none;
}

/* Free shipping gauge — vert + jaune + animation */
.cbd-minicart-freeship {
  padding: 12px 20px;
  flex-shrink: 0;
  background: rgba(0, 68, 55, 0.04);
}
.cbd-minicart-freeship-text {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: #004437;
  font-weight: 600;
}
.cbd-minicart-freeship-bar {
  height: 10px;
  background: rgba(0, 68, 55, 0.12);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
}
.cbd-minicart-freeship-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #004437 0%, #00695c 50%, #004437 100%);
  background-size: 200% 100%;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation: cbd-gauge-shimmer 2s ease-in-out infinite;
  position: relative;
}
.cbd-minicart-freeship-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: cbd-gauge-shine 2s ease-in-out infinite;
  border-radius: 5px;
}
@keyframes cbd-gauge-shimmer {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}
@keyframes cbd-gauge-shine {
  0% { background-position: 200% 0%; }
  100% { background-position: -200% 0%; }
}
.cbd-minicart-freeship-remaining {
  margin: 0;
  font-size: 0.8125rem;
  color: #004437;
}
.cbd-minicart-freeship-done {
  margin: 0;
  font-size: 0.8125rem;
  color: #004437;
  font-weight: 700;
}

/* Total */
.cbd-minicart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 1rem;
  border-top: 2px solid #004437;
  flex-shrink: 0;
  color: #004437;
}
.cbd-minicart-total-value {
  font-size: 1.125rem;
  color: #004437;
}

/* Actions */
.cbd-minicart-actions {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.cbd-minicart-btn {
  display: block;
  text-align: center;
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.cbd-minicart-btn--secondary {
  background: transparent;
  border: 2px solid #004437;
  color: #004437;
}
.cbd-minicart-btn--secondary:hover {
  background: #004437;
  color: #fff;
}
.cbd-minicart-btn--primary {
  background: #FFD517;
  border: 2px solid #FFD517;
  color: #004437;
  font-weight: 700;
}
.cbd-minicart-btn--primary:hover {
  background: #e6c015;
  border-color: #e6c015;
  color: #004437;
}
.cbd-minicart-btn--small {
  padding: 6px 12px;
  font-size: 0.75rem;
  margin-top: 4px;
  border-radius: 6px;
}

/* Empty */
.cbd-minicart-empty {
  padding: 40px 20px;
  text-align: center;
  color: #666;
  font-size: 0.9375rem;
  margin: 0;
}

/* Upsell */
.cbd-minicart-upsell {
  padding: 16px 20px;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
}
.cbd-minicart-upsell-title {
  text-align: center;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: #004437;
  font-weight: 600;
}
.cbd-minicart-upsell-title span {
  display: inline-block;
  padding: 0 12px;
  position: relative;
}
.cbd-minicart-upsell-title span::before,
.cbd-minicart-upsell-title span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 60px;
  height: 1px;
  background: #004437;
  opacity: 0.3;
}
.cbd-minicart-upsell-title span::before {
  right: 100%;
  margin-right: 8px;
}
.cbd-minicart-upsell-title span::after {
  left: 100%;
  margin-left: 8px;
}
.cbd-minicart-upsell-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e8e8e8;
}
.cbd-minicart-upsell-item:last-child {
  border-bottom: none;
}
.cbd-minicart-upsell-img {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  overflow: hidden;
  border-radius: 8px;
}
.cbd-minicart-upsell-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cbd-minicart-upsell-info {
  flex: 1;
  min-width: 0;
}
.cbd-minicart-upsell-name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #004437;
  text-decoration: none;
  margin-bottom: 2px;
}
.cbd-minicart-upsell-name:hover {
  text-decoration: underline;
}
.cbd-minicart-upsell-price {
  display: block;
  font-size: 0.8125rem;
  color: #3D3D3D;
  font-weight: 600;
}

/* Footer */
.cbd-minicart-panel__footer {
  padding: 12px 20px;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
  text-align: center;
}
.cbd-minicart-continue {
  font-size: 0.875rem;
  text-decoration: underline;
  color: #004437;
  font-weight: 600;
}
.cbd-minicart-continue:hover {
  text-decoration: none;
  color: #004437;
}

/* Body scroll lock when open */
body.cbd-minicart-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .cbd-minicart-panel {
    max-width: 100%;
  }
}
