/**
 * Public-facing CSS for OneCMS Social Share
 *
 * @since 2.1.0
 */

.ocss-wrapper {
  font-family: 'Poppins', sans-serif;
  margin: 1em 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  z-index: 9999;
}

.ocss-wrapper.ocss-visible {
  opacity: 1;
  visibility: visible;
}

.ocss-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ocss-share-label {
  font-weight: 700;
  margin-right: 10px;
}

/* Alignment */
.ocss-align-left {
  justify-content: flex-start;
}

.ocss-align-center {
  justify-content: center;
}

.ocss-align-right {
  justify-content: flex-end;
}

/* Icon Shapes */
.ocss-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px;
  width: 40px;
  height: 40px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  border-radius: 50%; /* Circle as default */
  will-change: transform;
}

.ocss-shape-rounded .ocss-icon {
  border-radius: 12px;
}

.ocss-shape-square .ocss-icon {
  border-radius: 0;
}

.ocss-shape-rectangle .ocss-icon {
  border-radius: 0;
  padding: 10px 20px;
  width: auto;
  height: auto;
}

.ocss-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.ocss-icon:focus {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
}

/* Tooltip */
.ocss-icon .tooltip-text {
  visibility: hidden;
  width: 80px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  padding: 5px 0;
  position: absolute;
  top: 50%;
  left: 110%;
  transform: translateY(-50%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  pointer-events: none;
}

.ocss-icon.show-tooltip .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Copy Link button click */
.ocss-icon .tooltip-text-top {
  visibility: hidden;
  width: 80px; /* Adjust width as needed */
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  padding: 5px 0;
  position: absolute;
  /* --- CHANGES START HERE --- */
  /* Position the tooltip above the icon */
  top: auto; /* Remove previous top positioning */
  bottom: 100%; /* Position above the icon, 100% of parent's height */
  left: 50%; /* Center horizontally relative to the icon */
  transform: translateX(-50%); /* Fine-tune centering */

  /* Increase z-index to ensure it's on top of other icons */
  z-index: 10; /* Increase this significantly, e.g., 10, 100, or more */
  /* --- CHANGES END HERE --- */
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  pointer-events: none;
}

/* Base vertical layout container */
.ocss-layout-vertical {
  background-color: #fff;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ocss-layout-vertical .ocss-share-label {
  margin-right: 0;
  margin-bottom: 8px;
}

/* When in vertical layout, make icons stack vertically */
.ocss-layout-vertical .ocss-icons {
  flex-direction: column;
  align-items: center;
}

/* Floating style - fixed on desktop */
.ocss-vertical-floating {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999; /* instead of 9999, used 999 means below 1000 as pjax loader is using 1000 into hello-theme-child-master theme */
}

/* Left and right alignment for floating layout */
.ocss-float-left {
  left: 0;
  right: auto;
}

.ocss-float-right {
  right: 0;
  left: auto;
}

/* Responsive: On smaller screens */
@media screen and (max-width: 767px) {
  .ocss-share-label {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .ocss-layout-vertical {
    position: static !important;
    transform: none !important;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .ocss-vertical-floating,
  .ocss-float-left,
  .ocss-float-right {
    all: unset;
  }
  
  .ocss-layout-vertical .ocss-icons {
    flex-direction: row;
  }
}
