/**
 * Bongoto WooCommerce — Cart Icon Styles (Compact + Centered)
 * Works on all header variants (1–5)
 * Uses global Customizer-driven color variables where applicable.
 *
 * @package BongotoWooCommerce
 */

:root {
  /* Increase to 36px if you want it slightly larger */
  --bt-cart-size: 34px;

  /* Base visual tokens */
  --bt-cart-bg: #f9fafb;                                /* Subtle background */
  --bt-cart-color: var(--bt-color-text, #111827);       /* Inherit from theme text color */
  --bt-cart-hover-bg: #e5e7eb;                          /* Hover background */

  /* Accent colors from global primary */
  --bt-cart-accent: var(--bt-color-primary, #2563eb);   /* Badge / active color */
  --bt-cart-accent-dark: #1d4ed8;
}

/* ---------------------------------
   Header Wrapper (div) – keep relative for badge/overlay
---------------------------------- */
.bt-header-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* ---------------------------------
   Cart Click Area (anchor) + Icon Variant
---------------------------------- */
.bt-header-cart .bt-cart-link,
.bt-cart-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--bt-cart-size);
  height: var(--bt-cart-size);
  border-radius: 8px;
  background: var(--bt-cart-bg);
  color: var(--bt-cart-color);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease, color 0.25s ease;
  vertical-align: middle;
}

.bt-header-cart .bt-cart-link:hover,
.bt-cart-icon:hover {
  background: var(--bt-cart-hover-bg);
  transform: translateY(-2px);
}

/* ---------------------------------
   Dashicon / SVG Alignment
---------------------------------- */
.bt-header-cart .dashicons,
.bt-cart-icon .dashicons {
  font-size: 17px;
  line-height: 1;
  color: var(--bt-cart-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  transition: color 0.25s ease;
}

/* SVG icon from bongoto_icon() */
.bt-header-cart .bt-cart-link svg,
.bt-cart-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--bt-cart-color);
  fill: currentColor;
  transition: color 0.25s ease;
}

.bt-header-cart .bt-cart-link:hover .dashicons,
.bt-cart-icon:hover .dashicons,
.bt-header-cart .bt-cart-link:hover svg,
.bt-cart-icon:hover svg {
  color: var(--bt-cart-accent);
}

/* ---------------------------------
   Cart Count Badge
---------------------------------- */
.bt-cart-count,
.bt-header-cart .cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bt-cart-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transform: scale(1);
  transform-origin: top right;
  transition: transform 0.2s ease-in-out;
}

/* Hide badge reliably when cart is empty (requires data-count="0" in markup) */
.bt-cart-count[data-count="0"],
.bt-header-cart .cart-count[data-count="0"]{
  display: none;
}

/* Fallback: hide if truly empty */
.bt-cart-count:empty,
.bt-header-cart .cart-count:empty {
  display: none;
}

.bt-header-cart .bt-cart-link:hover .bt-cart-count,
.bt-cart-icon:hover .bt-cart-count {
  transform: scale(1.1);
}

/* ---------------------------------
   WooCommerce Mini Cart Overlay (optional)
---------------------------------- */
.bt-cart-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bt-color-bg, #ffffff);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,.1);
  padding: 10px;
  min-width: 280px;
  z-index: 1000;
  display: none;
}

/* Hover on wrapper or link will show panel */
.bt-header-cart:hover .bt-cart-panel,
.bt-header-cart .bt-cart-link:hover + .bt-cart-panel {
  display: block;
}

/* ---------------------------------
   Responsive Adjustments
---------------------------------- */
@media (max-width: 768px) {
  .bt-header-cart .bt-cart-link,
  .bt-cart-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  }

  .bt-cart-count,
  .bt-header-cart .cart-count {
    min-width: 13px;
    height: 13px;
    font-size: 10px;
    line-height: 13px;
  }

  .bt-header-cart .dashicons,
  .bt-cart-icon .dashicons {
    font-size: 16px;
  }

  .bt-header-cart .bt-cart-link svg,
  .bt-cart-icon svg {
    width: 17px;
    height: 17px;
  }
}
