/* ===== METFI Unified Bottom Bar ===== */

.metfi-bb {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transform: translateY(100%);
  transition: transform .3s ease;
}
.metfi-bb.visible {
  transform: translateY(0);
}


/* Mini progress bar inside shipping section */
.metfi-bb-ship-progress {
  height: 3px;
  background: #eee;
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}
.metfi-bb-ship-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #B80C09, #2ecc71);
  transition: width .4s ease;
  width: 0;
  border-radius: 2px;
}

/* Inner layout */
.metfi-bb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Shipping info */
.metfi-bb-shipping {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.metfi-bb-shipping-cost {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}
.metfi-bb-ship-label {
  color: #666;
  font-weight: 400;
}
.metfi-bb-ship-value {
  color: #B80C09;
  font-weight: 700;
}
.metfi-bb-ship-value.free {
  color: #2ecc71;
}
.metfi-bb-free-msg {
  display: block;
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metfi-bb-free-msg strong {
  color: #B80C09;
  font-weight: 700;
}
.metfi-bb-free-msg .bb-green {
  color: #2ecc71;
  font-weight: 700;
}
.metfi-bb-free-msg.achieved {
  color: #2ecc71;
}

/* Paliers promo */
.metfi-bb-paliers {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.metfi-bb-palier-msg {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metfi-bb-palier-msg strong {
  color: #B80C09;
}
.metfi-bb-palier-msg .achieved {
  color: #2ecc71;
  font-weight: 600;
}

/* Cart section */
.metfi-bb-cart {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.metfi-bb-cart-total {
  text-align: right;
}
.metfi-bb-cart-count {
  display: block;
  font-size: 13px;
  color: #555;
  font-weight: 600;
}
.metfi-bb-cart-value {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #222;
}

/* Buttons */
.metfi-bb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  border: none;
  transition: background .2s, transform .1s;
}
.metfi-bb-btn:active {
  transform: scale(.97);
}
.metfi-bb-btn-cart {
  background: #222;
  color: #fff;
}
.metfi-bb-btn-cart:hover {
  background: #444;
  color: #fff;
  text-decoration: none;
}

/* ATC section (product pages) */
.metfi-bb-atc {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.metfi-bb-price-label {
  display: block;
  font-size: 10px;
  color: #888;
}
.metfi-bb-price-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #B80C09;
}
.metfi-bb-btn-atc {
  background: #B80C09;
  color: #fff;
  padding: 12px 20px;
  font-size: 13px;
}
.metfi-bb-btn-atc:hover {
  background: #8B0000;
}
.metfi-bb-btn-atc.is-adding {
  opacity: .7;
  pointer-events: none;
}
.metfi-bb-btn-atc.is-added {
  background: #2ecc71;
}

/* Product mode: hide cart section, show ATC */
.metfi-bb.product-mode .metfi-bb-cart {
  display: none;
}
.metfi-bb.product-mode .metfi-bb-atc {
  display: flex;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .metfi-bb-inner {
    padding: 6px 10px;
    gap: 8px;
  }
  .metfi-bb-shipping-cost { font-size: 12px; }
  .metfi-bb-btn { padding: 10px 12px; font-size: 11px; }
  .metfi-bb-price-value { font-size: 14px; }
  .metfi-bb-cart-value { font-size: 13px; }
  .metfi-bb-paliers { display: none; }
}

@media (max-width: 480px) {
  .metfi-bb-inner {
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 4px;
  }
  .metfi-bb-shipping {
    flex: 1 1 100%;
    flex-direction: column;
    gap: 1px;
  }
  .metfi-bb-cart {
    flex: none;
  }
  .metfi-bb-atc {
    flex: 1;
    justify-content: space-between;
  }
  .metfi-bb-btn-cart {
    padding: 10px 14px;
  }
  .metfi-bb-btn-atc {
    flex: 1;
    justify-content: center;
  }
  .metfi-bb-paliers { display: none; }
}


/* ===== Cart Slide-Up Panel ===== */
.metfi-bb-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -4px 20px rgba(0,0,0,.12);
  border-radius: 12px 12px 0 0;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%) translateY(60px);
  opacity: 0;
  visibility: hidden;
  transition: transform .3s ease, opacity .3s ease, visibility .3s ease;
  pointer-events: none;
}
.metfi-bb-panel.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.metfi-bb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.metfi-bb-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #222;
}
.metfi-bb-panel-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.metfi-bb-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

/* Product items in panel */
.metfi-bb-panel-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  align-items: center;
}
.metfi-bb-panel-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  background: #f5f5f5;
  flex-shrink: 0;
}
.metfi-bb-panel-item-info {
  flex: 1;
  min-width: 0;
}
.metfi-bb-panel-item-name {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.metfi-bb-panel-item-meta {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.metfi-bb-panel-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #B80C09;
  white-space: nowrap;
  flex-shrink: 0;
}


/* Qty controls in panel */
.metfi-bb-panel-item-qty {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 4px;
}
.metfi-bb-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #ddd;
  background: #f8f8f8;
  color: #333;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  padding: 0;
  line-height: 1;
}
.metfi-bb-qty-btn:hover {
  background: #eee;
}
.metfi-bb-qty-minus {
  border-radius: 4px 0 0 4px;
}
.metfi-bb-qty-plus {
  border-radius: 0 4px 4px 0;
}
.metfi-bb-qty-val {
  width: 30px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  height: 26px;
  line-height: 26px;
  background: #fff;
}

/* Item right section (price + delete) */
.metfi-bb-panel-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.metfi-bb-item-delete {
  background: none;
  border: none;
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color .15s;
}
.metfi-bb-item-delete:hover {
  color: #e53935;
}

/* Discounts in panel */
.metfi-bb-panel-discounts {
  padding: 0 16px;
}
.metfi-bb-panel-discount-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  color: #2ecc71;
  font-weight: 600;
}
.metfi-bb-panel-discount-line .label {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Footer / totals */
.metfi-bb-panel-footer {
  padding: 10px 16px 12px;
  border-top: 1px solid #eee;
}
.metfi-bb-panel-totals {
  margin-bottom: 8px;
}
.metfi-bb-panel-total-line {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 13px;
  color: #555;
}
.metfi-bb-panel-total-line.total {
  font-size: 16px;
  font-weight: 800;
  color: #222;
  padding: 6px 0 2px;
  border-top: 1px solid #eee;
  margin-top: 4px;
}
.metfi-bb-btn-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 14px;
  background: #B80C09;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s;
}
.metfi-bb-btn-checkout:hover {
  background: #8B0000;
  color: #fff;
  text-decoration: none;
}

/* Empty cart state */
.metfi-bb-panel-empty {
  text-align: center;
  padding: 24px;
  color: #999;
  font-size: 14px;
}

/* Panel overlay (click outside to close) */
.metfi-bb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
}
.metfi-bb-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Hide leo-fly-cart globally */
.leo-fly-cart.type-fixed { display: none !important; }
.leo-fly-cart-slidebar { display: none !important; }

/* Cart sheet above bottom bar */
#metfi-cart-sheet-overlay { z-index: 10000; }
#metfi-cart-sheet { z-index: 10001; }

/* Hide bottom bar on checkout and cart pages */
body#checkout .metfi-bb,
body#cart .metfi-bb { display: none !important; }
