@import "../../../../styles/varibale.scss";

/* ---------- Header base ---------- */
.MobileHeaderContainer {
  border-bottom: $lightBorder;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: $whiteBackground;
  overflow-x: hidden; /* prevent header from creating horizontal scroll */
}

.MobileHeaderContainerHome {
  border-bottom: $lightBorder;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: $whiteBackground;
}

/* Top support bar */
.topSupportBar {
  width: 100%;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 16px;
  box-sizing: border-box;
  z-index: 1000;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- Existing styles kept and improved ---------- */
.contactUsEmail {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: $primaryColor;
  font-style: normal;
}

.contactUsEmailTotal {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  font-style: normal;
  text-align: right;
  background: #fff;
  padding: 0 0.5rem;
}

.itemIcons {
  color: #291C61;
  font-size: 1.8em;
}

.badgeStyle {
  padding: 0.25rem 0rem;
  margin-right: 0.75rem;
}
.badgeStyle:hover {
  border-radius: 5em;
  background: #fff;
}

/* ---------- Main header row ---------- */
.displayContainer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* Logo wrapper: allow shrink so right-side items remain visible */
.logoButton {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  flex: 0 1 auto; /* allow shrink */
  min-width: 0;   /* critical to allow children to shrink */
  overflow: hidden; /* prevent content overflow */
}

/* Make the image responsive inside the logo wrapper */
.logoButton .ant-image,
.logoButton img {
  max-width: 170px;
  width: auto;
  height: 50px;
  object-fit: contain;
  display: block;
}

/* Right-side icons group */
.mobileHeaderIcons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap; /* will change to wrap on small screens */
  min-width: 0; /* allow shrinking inside flex */
}

/* Generic mobile card */
.mobileCard {
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  box-sizing: border-box;
}

/* Buttons should not force overflow */
.mobileCard,
.rfqbtn,
.shopBtn,
.menuBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}

/* RFQ button */
.rfqbtn {
  background: #F3465F;
  color: #ffffff;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  z-index: 11; /* keep above logo if needed */
  min-width: 72px;
}

/* RFQ arrow */
.rfqArrow {
  color: #2a1c61;
  font-size: 1.1em;
  font-weight: bold;
}

/* Shop button */
.shopBtn {
  background: #291C61;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  min-width: 120px;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
}

/* Menu icon wrapper */
.menuBtn {
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Cart badges */
.cartText {
  color: #fff;
  background: #f00;
  border-radius: 50%;
  padding: 0 3px;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-left: -6px;
  font-size: 10px;
  margin-bottom: 3px;
  position: relative;
  top: 0;
}
.cartText1 {
  display: none;
  color: #fff;
  background: #fff;
  border-radius: 50%;
  padding: 0 3px;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-left: -6px;
  font-size: 10px;
  margin-bottom: 3px;
  position: relative;
  top: 0;
}

/* ---------- Animations ---------- */
.blink {
  animation: blink .75s linear infinite;
}
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 1; }
  50.01% { opacity: 0.4; }
  100% { opacity: 0.4; }
}

/* ---------- Page content padding to avoid overlap ---------- */
/* Replace .pageContent with your app's main wrapper selector if different */
.pageContent {
  padding-top: calc(50px + 40px); /* logo height + support bar height; adjust as needed */
  box-sizing: border-box;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 480px) {
  .mobileHeaderIcons {
    flex-wrap: wrap;            /* allow buttons to wrap to next line */
    justify-content: flex-end;
    gap: 6px;
  }

  .shopBtn {
    min-width: 90px;
    padding: 6px 8px;
    font-size: 14px;
  }

  .rfqbtn {
    min-width: 72px;
    padding: 6px 8px;
    font-size: 14px;
  }

  .logoButton .ant-image,
  .logoButton img {
    max-width: 140px;
    height: 44px;
  }

  .pageContent {
    padding-top: calc(44px + 48px); /* adjust if support bar height changes on small screens */
  }
}

/* Additional responsive rule: allow wrapping up to tablet widths to avoid horizontal scroll */
@media (max-width: 768px) {
  .mobileHeaderIcons {
    flex-wrap: wrap;
    gap: 6px;
  }

  .shopBtn {
    min-width: 90px;
    padding: 6px 8px;
    font-size: 14px;
  }

  .rfqbtn {
    min-width: 64px;
    padding: 6px 8px;
    font-size: 14px;
  }

  .displayContainer {
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* Improved stacking and wrapping for the header on small screens */
@media (max-width: 768px) {
  .displayContainer {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  /* Put logo on its own line on very small screens if needed */
  .logoButton {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 55%;
  }

  /* Icons group should be allowed to take remaining space and wrap */
  .mobileHeaderIcons {
    flex: 1 1 40%;
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
    box-sizing: border-box;
  }

  /* Make action buttons smaller and able to shrink */
  .shopBtn {
    min-width: 84px;
    padding: 6px 8px;
    font-size: 14px;
  }

  .rfqbtn {
    min-width: 56px;
    padding: 6px 8px;
    font-size: 13px;
  }

  /* Ensure the menu button doesn't push layout */
  .menuBtn {
    flex-shrink: 1;
  }

  .logoButton .ant-image,
  .logoButton img {
    max-width: 140px;
    height: auto;
  }
}
