/* Blocksayac 2.1 — FO 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 instead of hardcoding a dark ink —
     this keeps the block readable on light Classic AND dark Hummingbird/3rd-party
     footers. */
  color: inherit;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

/* Match Classic footer column width. */
#blocksayac.blocksayac-block {
  min-width: 0;
  box-sizing: border-box;
}

/* De-dup: show exactly one Visitor Stats heading per breakpoint even on themes
   that purge Bootstrap display utilities (d-none / d-md-block / d-md-none). The
   templates use those utilities; this is a belt-and-suspenders fallback so the
   desktop <p> heading and the mobile collapse title never render together. */
@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.
 * The .blocksayac-footer-row class is added by front.js only to the correct
 * footer row (Classic or Hummingbird/third-party), so it is safe to match on
 * that class alone without a theme-specific ancestor.
 * Third-party modules are moved to .blocksayac-extra-footer-row by JS.
 */
@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 list visible inside Classic 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 .circle .ipflag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1.1rem;
  width: 1.1rem;
  height: 1.1rem;
  text-align: center;
}

.blocksayac-kpi-row .circle .ipflag-img {
  display: block;
  width: 16px;
  height: 12px;
  object-fit: cover;
  border-radius: 1px;
}

.blocksayac-kpi-row .tagname,
.blocksayac-kpi-row .tagnamecolumn {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  float: none !important;
  font-size: 0.875rem;
  /* Muted relative to the inherited footer colour, so it adapts to any theme. */
  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-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);
  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);
}

.blocksayac-chart-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  min-height: 280px;
}

.blocksayac-chart-wrap canvas {
  max-width: 100%;
}

.statloading {
  font-size: 0.75rem;
  color: inherit;
  opacity: 0.7;
  display: none;
}

.statloading img {
  width: 16px;
  height: auto;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.today {
  font-size: 15px;
  vertical-align: middle;
}

@media (min-width: 768px) {
  #footer_sayac > li,
  #footer_sayac1 > li {
    height: auto !important;
    /* Inherit footer colour; the label (.tagname) mutes itself via opacity, the
       value (.kpi) stays at full inherited colour. */
    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-chart-wrap {
    min-height: 240px;
  }
  .blocksayac-actions .btn-sm {
    min-height: 2.25rem;
    font-size: 0.6rem;
  }
}

/* Mobile compact (collapsed) title parity with the theme's native footer accordion.
   The block ships Classic's .h3 + .collapse-icons markup; newer themes style their
   footer titles differently, so bring the compact title in line without touching
   Classic. */
@media (max-width: 767.98px) {
  /* Show exactly one chevron per state. The theme's own collapse-icon toggling is
     Classic-only; Bootstrap 4 and 5 both set aria-expanded on the toggle, so key
     off that instead (works on any theme, and stops both chevrons showing at once). */
  #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 -- so the
     Classic look, built around the larger .h3, is left exactly as it was. */
  .footer__main #blocksayac .title,
  .footer__main #blocksayac_hidden_footer .title {
    display: flex;
    align-items: center;
    /* font-size:0 collapses the template's whitespace-only text nodes, which would
       otherwise become phantom flex items and keep the toggle off the right edge.
       The title text and the icons carry their own font-size, so they are unaffected. */
    font-size: 0;
  }
  .footer__main #blocksayac .title .h3,
  .footer__main #blocksayac_hidden_footer .title .h3 {
    margin: 0;
    font-size: 1rem;
  }
  /* Push the toggle flush to the right edge like the native accordion arrow (an auto
     margin resolves before justify-content, so phantom whitespace items cannot shift it). */
  .footer__main #blocksayac .title .float-xs-right,
  .footer__main #blocksayac_hidden_footer .title .float-xs-right {
    margin-left: auto;
  }
}
