.th-woo-entry-summary .product-action-compare {
  position: absolute;
  top: 20px;
  right: 30px;
}

@media only screen and (max-width: 768px) {
  .th-woo-entry-summary .product-action-compare {
    position: unset;
    top: 20px;
    right: 30px;
  }
}

.th-woocommerce-compare-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid rgb(var(--color-background));
    border-radius: 4px;    
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    gap: 8px;
    transition: background-color 0.3s, color 0.3s;    
    background-color: rgb(var(--color-background));
    color: rgb(var(--color-foreground));
}

.th-woocommerce-compare-button.added-to-compare {
    background-color: rgb(var(--color-foreground));
    border-color: rgb(var(--color-foreground));
    color: rgb(var(--color-background));
}

.th-woocommerce-compare-button:hover {
    background-color: rgb(var(--color-foreground));
	color: rgb(var(--color-background));
}

.th-woocommerce-compare-button.added-to-compare:hover {
    background-color: rgb(var(--color-background));
   color: rgb(var(--color-foreground));
}

.th-woocommerce-compare-button .dashicons-table-col-after {
    font-size: 18px;
}

.th-woocommerce-compare-button.added-to-compare .dashicons-table-col-after::before {
    content: "\f538";
}

/* Tooltip styles */
.th-woocommerce-compare-button[data-tooltip] {
    position: relative;
}

.th-woocommerce-compare-button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;    
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    background-color: rgb(var(--color-foreground));
    color: rgb(var(--color-background));
}

.th-woocommerce-compare-button[data-tooltip]::before {
    content: '';
    position: absolute;
    border: 5px solid transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.th-woocommerce-compare-button:hover[data-tooltip]::after,
.th-woocommerce-compare-button:hover[data-tooltip]::before {
    opacity: 1;
    visibility: visible;
}

/* Tooltip position: Top (default) */
.th-woocommerce-compare-button[data-tooltip-position="top"]::after {
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
}

.th-woocommerce-compare-button[data-tooltip-position="top"]::before {
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    border-top-color: rgb(var(--color-foreground));
}

/* Tooltip position: Bottom */
.th-woocommerce-compare-button[data-tooltip-position="bottom"]::after {
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
}

.th-woocommerce-compare-button[data-tooltip-position="bottom"]::before {
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: rgb(var(--color-foreground));
}

/* Tooltip position: Right */
.th-woocommerce-compare-button[data-tooltip-position="right"]::after {
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}

.th-woocommerce-compare-button[data-tooltip-position="right"]::before {
    left: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%);
    border-right-color: rgb(var(--color-foreground));
}

/* Tooltip position: Left */
.th-woocommerce-compare-button[data-tooltip-position="left"]::after {
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}

.th-woocommerce-compare-button[data-tooltip-position="left"]::before {
    right: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%);
    border-left-color: rgb(var(--color-foreground));
}

.remove-compare-product-btn {
    position: absolute;
    top: 0;
    right: 0;
}

.remove-compare-product-btn .icon {
    display: flex;
    width: auto;
    height: auto;
}