/* PixelBondhu Suite v1.0.0 – pbs.css
 * Author: Ibna Hassan – pixelbondhu.com
 * Covers: Floating Buttons (Cart + Messenger) + Slide Cart Panel + Shopkeeper overrides
 * Loaded on ALL frontend pages (lightweight, gzips well)
 * Product-page AAZ styles are injected inline via wp_add_inline_style only on product pages
 */

:root {
  --pbs-brand:      #142E25;
  --pbs-brand2:     #1e4535;
  --pbs-messenger:  #0084FF;
  --pbs-messenger2: #0066cc;
  --pbs-white:      #ffffff;
  --pbs-grey:       #f4f4f4;
  --pbs-border:     #e0e0e0;
  --pbs-text:       #333333;
  --pbs-muted:      #666666;
  --pbs-radius:     10px;
  --pbs-speed:      0.3s;
  --pbs-fab-size:   48px;
  --pbs-fab-right:  20px;
  --pbs-fab-bottom: 24px;
  --pbs-fab-gap:    12px;
  /* z-index sits at 9900 – below WC notices (9999) but above all Shopkeeper content */
  --pbs-fab-z:      9900;
}

/* ═══════════════════════════════════════════
   FLOATING ACTION BUTTONS
   ═══════════════════════════════════════════ */

#pbs-fab-wrap {
  position: fixed;
  right: var(--pbs-fab-right);
  bottom: var(--pbs-fab-bottom);
  z-index: var(--pbs-fab-z);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pbs-fab-gap);
  pointer-events: none; /* wrapper doesn't capture clicks */
}

/* Shared FAB base */
#pbs-fab-cart,
#pbs-fab-messenger {
  pointer-events: all;
  width: var(--pbs-fab-size);
  height: var(--pbs-fab-size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  outline: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.22), 0 1px 4px rgba(0,0,0,.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

#pbs-fab-cart:hover,
#pbs-fab-messenger:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 8px 24px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.14);
}

#pbs-fab-cart:active,
#pbs-fab-messenger:active {
  transform: translateY(0) scale(0.96);
}

/* Cart FAB */
#pbs-fab-cart {
  background: var(--pbs-brand);
  color: var(--pbs-white);
  order: 1; /* Cart sits below Messenger */
}

/* Messenger FAB */
#pbs-fab-messenger {
  background: var(--pbs-messenger);
  color: var(--pbs-white);
  order: 0; /* Messenger sits on top */
}

/* Cart badge */
#pbs-fab-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: #e63946;
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  border: 2px solid var(--pbs-white);
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: content-box;
}

#pbs-fab-count.pbs-fab-count--visible {
  display: block;
}

/* ═══════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════ */

#pbs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99990;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#pbs-overlay.pbs-visible { display: block; }

/* ═══════════════════════════════════════════
   SLIDE PANEL
   ═══════════════════════════════════════════ */

#pbs-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 380px;
  max-width: 95vw;
  height: 100%;
  background: var(--pbs-white);
  z-index: 99995;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  transition: right var(--pbs-speed) cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--pbs-radius) 0 0 var(--pbs-radius);
  overflow: hidden;
}
#pbs-panel.pbs-open { right: 0; }

/* Panel header */
#pbs-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pbs-border);
  flex-shrink: 0;
}

#pbs-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--pbs-text);
  margin: 0;
  line-height: 1;
}

/* Close button */
#pbs-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pbs-grey);
  border: none;
  border-radius: 6px;
  color: var(--pbs-muted);
  cursor: pointer;
  transition: color .2s, background .2s;
  flex-shrink: 0;
}
#pbs-close:hover { color: var(--pbs-brand); background: var(--pbs-border); }

/* Panel body */
#pbs-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════
   CART ITEM
   ═══════════════════════════════════════════ */

.pbs-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--pbs-border);
  margin-bottom: 14px;
  position: relative;
  transition: opacity .2s ease;
}

.pbs-item--busy {
  opacity: .88;
}

.pbs-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--pbs-border);
  display: block;
}

.pbs-info { flex: 1; min-width: 0; }

.pbs-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--pbs-text);
  margin: 0 0 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pbs-price {
  font-size: 14px;
  color: var(--pbs-brand);
  font-weight: 700;
  margin: 0 0 10px;
}

.pbs-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Qty controls */
.pbs-qty-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--pbs-border);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}

.pbs-qty-btn {
  width: 32px;
  height: 32px;
  background: var(--pbs-grey);
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--pbs-text);
  transition: background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.pbs-qty-btn:hover { background: var(--pbs-border); }

.pbs-qty-input {
  width: 44px;
  height: 32px;
  border: none;
  border-left: 1px solid var(--pbs-border);
  border-right: 1px solid var(--pbs-border);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--pbs-text);
  -moz-appearance: textfield;
  outline: none;
  background: #fff;
}
.pbs-qty-input::-webkit-inner-spin-button,
.pbs-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.pbs-remove-btn {
  border: none;
  background: transparent;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 8px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pbs-remove-btn:hover {
  color: #912018;
}

.pbs-item-status {
  margin-top: 10px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pbs-muted);
}

.pbs-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(20,46,37,.18);
  border-top-color: var(--pbs-brand);
  border-radius: 50%;
  animation: pbs-spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes pbs-spin {
  to { transform: rotate(360deg); }
}

/* Totals row */
.pbs-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--pbs-text);
  padding: 4px 0;
}
.pbs-total-price { color: var(--pbs-brand); }

/* Empty / Loading */
.pbs-empty,
.pbs-loading {
  text-align: center;
  color: var(--pbs-muted);
  padding: 40px 0;
  font-size: 14px;
}
.pbs-loading { padding: 20px; }

/* Panel action buttons */
#pbs-panel-actions {
  padding: 14px 20px 20px;
  border-top: 1px solid var(--pbs-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.pbs-btn {
  display: block;
  width: 100%;
  padding: 13px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  text-decoration: none;
  border: 2px solid transparent;
  letter-spacing: .3px;
  line-height: 1.2;
  box-sizing: border-box;
}

.pbs-btn--primary {
  background: var(--pbs-brand);
  color: var(--pbs-white) !important;
  border-color: var(--pbs-brand);
}
.pbs-btn--primary:hover {
  background: var(--pbs-brand2);
  border-color: var(--pbs-brand2);
  color: var(--pbs-white) !important;
  text-decoration: none;
}

.pbs-btn--secondary {
  background: transparent;
  color: var(--pbs-brand) !important;
  border-color: var(--pbs-brand);
}
.pbs-btn--secondary:hover {
  background: var(--pbs-brand);
  color: var(--pbs-white) !important;
}

/* ═══════════════════════════════════════════
   SHOPKEEPER THEME COMPATIBILITY
   ═══════════════════════════════════════════ */

:root { --brand: #142E25; --brand-hover: #1a382d; }

/* Cart icon in Shopkeeper header */
.header-cart-icon, .site-header-cart, .shopkeeper-cart-trigger {
  color: var(--brand) !important;
}

/* Shopkeeper native slide cart styling */
.widget_shopping_cart, .shopkeeper-slide-cart, .shopkeeper-cart-wrapper {
  border-left: 4px solid var(--brand) !important;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1) !important;
}

.widget_shopping_cart .widget-title,
.shopkeeper-slide-cart .cart-title,
.shopkeeper-cart-header {
  background: var(--brand) !important;
  color: #fff !important;
  padding: 16px 20px !important;
  font-weight: 600 !important;
}

.widget_shopping_cart .checkout,
.shopkeeper-slide-cart .checkout,
.shopkeeper-cart-footer .checkout {
  background: var(--brand) !important;
  color: #fff !important;
  border-radius: 6px !important;
  padding: 14px 20px !important;
  font-weight: 600 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease !important;
}
.widget_shopping_cart .checkout:hover,
.shopkeeper-slide-cart .checkout:hover {
  background: var(--brand-hover) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20,46,37,0.3);
}

.shopkeeper-cart-footer a:not(.checkout),
.widget_shopping_cart .continue-shopping {
  color: var(--brand) !important;
  font-weight: 500;
  text-decoration: none;
}

.quantity .plus, .quantity .minus,
.shopkeeper-qty-btn {
  background: var(--brand) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 4px !important;
}

.cart_item .price, .shopkeeper-cart-price {
  color: var(--brand) !important;
  font-weight: 600;
}

.shopkeeper-cart-overlay, .cart-overlay {
  background: rgba(0,0,0,0.4) !important;
  backdrop-filter: blur(2px);
}

/* Add to Cart button */
button.single_add_to_cart_button.button,
button.add_to_cart_button.button {
  background-color: #142E25 !important;
  color: #ffffff !important;
  width: 100% !important;
  border-radius: 10px !important;
  padding: 18px 20px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(20, 46, 37, 0.25) !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
}

button.single_add_to_cart_button:hover,
button.add_to_cart_button:hover {
  opacity: 0.9 !important;
  transform: translateY(-2px) !important;
}

/* Hide quantity on single product (AAZ style) */
.cart .quantity.custom,
.single-product .quantity {
  display: none !important;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 480px) {
  #pbs-panel {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
  }
  :root {
    --pbs-fab-size:   44px;
    --pbs-fab-right:  14px;
    --pbs-fab-bottom: 16px;
    --pbs-fab-gap:    10px;
  }
}
