/* CloudNova v7.6.6 — cart brand centering, no JS, no first-paint jump
 * Supports both legacy .navbar-brand-box markup and newer direct-logo brand columns.
 */

/* 1) The brand cell itself: preserve its existing width, only normalize alignment. */
#page-topbar .navbar-brand-box,
.navbar-header .navbar-brand-box,
.cn-store-brand,
.cn7-store-brand,
.cn76-store-brand,
.cloudnova-store-brand {
  box-sizing: border-box !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  height: 100% !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
  text-align: center !important;
  overflow: hidden !important;
}

/* 2) Cancel v7.6.5/v7.6.4 absolute positioning completely. */
#page-topbar a.logo,
.navbar-header a.logo,
.cn-store-brand > a,
.cn7-store-brand > a,
.cn76-store-brand > a,
.cloudnova-store-brand > a {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

/* 3) Normal legacy structure: make the anchor occupy the whole brand cell. */
#page-topbar .navbar-brand-box > a.logo,
.navbar-header .navbar-brand-box > a.logo,
.cn-store-brand > a,
.cn7-store-brand > a,
.cn76-store-brand > a,
.cloudnova-store-brand > a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
}

/* 4) Newer cart header variant: logo anchor can be the brand column itself. */
#page-topbar .navbar-header > .d-flex:first-child > a.logo,
.navbar-header > .d-flex:first-child > a.logo,
#page-topbar .navbar-header > div:first-child > a.logo,
.navbar-header > div:first-child > a.logo {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: stretch !important;
  min-height: 100% !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
}

/* If the direct logo already owns a fixed/flex width, center inside that width rather than changing it. */
#page-topbar .navbar-header > .d-flex:first-child > a.logo > span,
.navbar-header > .d-flex:first-child > a.logo > span,
#page-topbar .navbar-brand-box > a.logo > span,
.navbar-header .navbar-brand-box > a.logo > span,
.cn-store-brand > a > span,
.cn7-store-brand > a > span,
.cn76-store-brand > a > span,
.cloudnova-store-brand > a > span {
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Only the currently-visible logo variant participates. We do not override display:none. */
#page-topbar a.logo .logo-lg:not([style*="display: none"]),
#page-topbar a.logo .logo-sm:not([style*="display: none"]),
.navbar-header a.logo .logo-lg:not([style*="display: none"]),
.navbar-header a.logo .logo-sm:not([style*="display: none"]) {
  max-width: 100% !important;
}

#page-topbar a.logo img,
.navbar-header a.logo img,
.cn-store-brand img,
.cn7-store-brand img,
.cn76-store-brand img,
.cloudnova-store-brand img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 150px !important;
  max-height: 44px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* Avoid a hidden sibling/logo variant reserving horizontal space. */
#page-topbar a.logo.logo-light[style*="display: none"],
#page-topbar a.logo.logo-dark[style*="display: none"],
.navbar-header a.logo.logo-light[style*="display: none"],
.navbar-header a.logo.logo-dark[style*="display: none"] {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Do not let old cart styles inject horizontal offset into the left header group. */
#page-topbar .navbar-header > .d-flex:first-child,
.navbar-header > .d-flex:first-child {
  align-items: stretch !important;
}

@media (max-width: 991.98px) {
  #page-topbar .navbar-brand-box,
  .navbar-header .navbar-brand-box,
  #page-topbar .navbar-header > .d-flex:first-child > a.logo,
  .navbar-header > .d-flex:first-child > a.logo {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  #page-topbar a.logo img,
  .navbar-header a.logo img { max-width: 126px !important; max-height: 38px !important; }
}

@media (max-width: 575.98px) {
  #page-topbar a.logo img,
  .navbar-header a.logo img { max-width: 108px !important; max-height: 34px !important; }
}
