/* Quick Stats 3.0 - storefront styles */
:root {
  --blocksayac-accent: #0d6e6e;
  /* Translucent so the row separators read on both light (Classic) and dark
     (Hummingbird) footer backgrounds. */
  --blocksayac-border: rgba(128, 128, 128, 0.25);
}

.blocksayac-block {
  /* Inherit the theme footer's text colour: readable on light Classic AND dark
     Hummingbird / third-party footers. */
  color: inherit;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

#blocksayac.blocksayac-block {
  min-width: 0;
  box-sizing: border-box;
}

/* Exactly one Visitor Stats heading per breakpoint even on themes that purge
   Bootstrap display utilities (d-none / d-md-block / d-md-none). */
@media (min-width: 768px) {
  #blocksayac > .title.clearfix,
  #blocksayac_hidden_footer > .title.clearfix {
    display: none;
  }
}
@media (max-width: 767.98px) {
  #blocksayac > .block-contact-title,
  #blocksayac_hidden_footer > #blocksayach4_mobile {
    display: none;
  }
}

/**
 * Equal width for native footer columns + Visitor Stats. front.js adds
 * .blocksayac-footer-row to the correct footer row only, so matching on the
 * class alone is safe. Third-party modules are moved to .blocksayac-extra-footer-row.
 */
@media (min-width: 768px) {
  .row.blocksayac-footer-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  .row.blocksayac-footer-row > .links,
  .row.blocksayac-footer-row > .block-contact,
  .row.blocksayac-footer-row > #block_myaccount_infos,
  .row.blocksayac-footer-row > .ps-linklist,
  .row.blocksayac-footer-row > .ps-customeraccountlinks,
  .row.blocksayac-footer-row > .ps-contactinfo,
  .row.blocksayac-footer-row > #blocksayac {
    flex: 1 1 0;
    width: calc(100% / var(--blocksayac-footer-cols, 5));
    max-width: calc(100% / var(--blocksayac-footer-cols, 5));
    float: none;
    min-width: 0;
  }
}

/* Desktop: keep the list visible inside Classic's footer collapse pattern */
@media (min-width: 768px) {
  #blocksayac #footer_sayac.collapse,
  #blocksayac_hidden_footer #footer_sayac1.collapse {
    display: block !important;
    height: auto !important;
    visibility: visible;
  }
}

#blocksayac .account-list,
#blocksayac #footer_sayac {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

#blocksayac #footer_sayac > li {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  clear: both;
  float: none;
  overflow: hidden;
}

.blocksayac-kpi-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0;
  margin: 0;
  line-height: 1.35;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-bottom: 1px solid var(--blocksayac-border);
  float: none !important;
}

.blocksayac-kpi-row .circle {
  flex: 0 0 1.1rem;
  width: 1.1rem;
  float: none !important;
}

.blocksayac-kpi-row .circle img {
  max-width: 16px;
  height: auto;
  display: block;
}

.blocksayac-kpi-row .ipflag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1.1rem;
  height: 1.1rem;
  text-align: center;
}

.blocksayac-kpi-row .ipflag-img {
  display: block;
  width: 16px;
  height: 12px;
  object-fit: cover;
  border-radius: 1px;
}

.blocksayac-kpi-row .tagname {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  float: none !important;
  font-size: 0.875rem;
  color: inherit;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blocksayac-kpi-row .kpi {
  flex: 0 0 auto;
  width: auto !important;
  float: none !important;
  font-weight: 600;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 2rem;
  max-width: 45%;
}

.blocksayac-kpi-row .kpi .today {
  font-size: 15px;
  vertical-align: middle;
}

.blocksayac-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  padding: 0.5rem 0;
  height: auto !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  float: none !important;
}

.blocksayac-actions .btn-sm {
  flex: 1 1 50%;
  min-width: 0;
  font-size: 0.62rem;
  line-height: 1.2;
  padding: 0.35rem 0.15rem;
  background: var(--blocksayac-accent);
  border-color: var(--blocksayac-accent);
  color: #fff;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.blocksayac-actions .btn-sm .material-icons {
  font-size: 12px !important;
  margin: 0;
}

.blocksayac-actions .btn-sm:hover,
.blocksayac-actions .btn-sm:focus {
  filter: brightness(0.92);
}

/* Server-rendered doughnut charts (modals) */
.blocksayac-modal .modal-body {
  color: #363a41;
}

.bs-chart__row {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.bs-donut {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  flex: 0 0 180px;
  position: relative;
  margin: 0 auto;
}

.bs-donut__hole {
  position: absolute;
  top: 34px;
  right: 34px;
  bottom: 34px;
  left: 34px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #6c757d;
  text-align: center;
}

.bs-donut__hole strong {
  font-size: 1.2rem;
  color: #363a41;
  font-variant-numeric: tabular-nums;
}

.bs-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 220px;
  min-width: 200px;
  font-size: 0.85rem;
}

.bs-legend__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.bs-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex: 0 0 12px;
}

.bs-legend__flag {
  width: 16px;
  height: 12px;
  flex: 0 0 16px;
  border-radius: 1px;
}

.bs-legend__label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bs-legend__pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.bs-legend__count {
  font-variant-numeric: tabular-nums;
  color: #6c757d;
  min-width: 3.5em;
  text-align: right;
}

.bs-chart__empty {
  margin: 0;
  color: #6c757d;
  font-style: italic;
}

.bs-modal__sub {
  font-size: 0.75em;
  font-weight: 400;
  opacity: 0.7;
  margin-left: 0.5rem;
}

.bs-modal__attrib {
  margin-right: auto;
  opacity: 0.7;
}

@media (min-width: 768px) {
  #footer_sayac > li,
  #footer_sayac1 > li {
    height: auto !important;
    color: inherit;
  }
  #blocksayac_hidden_footer {
    display: none;
  }
}

@media (max-width: 767.98px) {
  #blocksayac_hidden_footer {
    display: block;
    padding-left: 0;
    font-weight: 700;
    line-height: 1.2;
    font-size: 1.15rem;
  }
  #blocksayac_hidden_footer > .title {
    padding-left: 0;
  }
  .blocksayac-actions .btn-sm {
    min-height: 2.25rem;
    font-size: 0.6rem;
  }
  .bs-donut {
    width: 150px;
    height: 150px;
    flex-basis: 150px;
  }
  .bs-donut__hole {
    top: 28px;
    right: 28px;
    bottom: 28px;
    left: 28px;
  }
}

/* Mobile compact (collapsed) title parity with the theme's native footer accordion. */
@media (max-width: 767.98px) {
  /* Exactly one chevron per state, keyed off aria-expanded (Bootstrap 4 and 5). */
  #blocksayac .title .collapse-icons .remove,
  #blocksayac_hidden_footer .title .collapse-icons .remove {
    display: none;
  }
  #blocksayac .title[aria-expanded="true"] .collapse-icons .add,
  #blocksayac_hidden_footer .title[aria-expanded="true"] .collapse-icons .add {
    display: none;
  }
  #blocksayac .title[aria-expanded="true"] .collapse-icons .remove,
  #blocksayac_hidden_footer .title[aria-expanded="true"] .collapse-icons .remove {
    display: inline;
  }

  /* Match the native .footer-block__title (1rem title, toggle flush right). Scoped
     to .footer__main, a Hummingbird / PS8-9 marker absent from Classic. */
  .footer__main #blocksayac .title,
  .footer__main #blocksayac_hidden_footer .title {
    display: flex;
    align-items: center;
    /* font-size:0 collapses whitespace-only text nodes that would otherwise become
       phantom flex items; the title text and icons carry their own font-size. */
    font-size: 0;
  }
  .footer__main #blocksayac .title .h3,
  .footer__main #blocksayac_hidden_footer .title .h3 {
    margin: 0;
    font-size: 1rem;
  }
  .footer__main #blocksayac .title .float-xs-right,
  .footer__main #blocksayac_hidden_footer .title .float-xs-right {
    margin-left: auto;
  }
}
